/**
 * Frontend Sidebar — Pure CSS
 * Dark-first: deep navy with hot-pink accent.
 * Light mode overrides at the bottom.
 */

/* ─── Container ─────────────────────────────────────────────── */
.frontend-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width, 260px);
    height: 100vh;
    background: var(--sidebar-bg, #0a0a1a);
    border-right: 1px solid var(--border-color, rgba(255,255,255,0.06));
    z-index: 1000;
    overflow-y: auto;
    transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--primary, #e91e8c) var(--sidebar-bg, #0a0a1a);
}

.frontend-sidebar::-webkit-scrollbar { width: 4px; }
.frontend-sidebar::-webkit-scrollbar-track { background: transparent; }
.frontend-sidebar::-webkit-scrollbar-thumb { background: var(--primary, #e91e8c); border-radius: 4px; }

/* ─── Brand ──────────────────────────────────────────────────── */
.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
    flex-shrink: 0;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--primary, #e91e8c);
}

.sidebar-logo {
    max-width: 40px;
    height: auto;
    border-radius: 8px;
}

.sidebar-brand-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary, #e91e8c);
    letter-spacing: -0.02em;
}

/* ─── User Profile ───────────────────────────────────────────── */
.user-profile-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
    flex-shrink: 0;
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.user-avatar-container { flex-shrink: 0; }

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary, #e91e8c);
    transition: border-color 0.2s;
}

.user-avatar:hover {
    border-color: var(--color-primary-light, #f472b6);
}

.user-info { flex: 1; min-width: 0; }
.user-name-link { text-decoration: none; color: inherit; }

.user-name {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #f0f0fa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-username {
    margin: 0;
    font-size: 0.75rem;
    color: #aaaac8;
}

.user-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary, #e91e8c);
}

.stat-label {
    font-size: 0.6875rem;
    color: #aaaac8;
}

/* ─── Navigation ─────────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #6e6e90);
    margin: 0 0 6px 20px;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item { margin: 1px 0; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text, #c4c4e0);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.nav-link:hover {
    background: rgba(233, 30, 140, 0.08);
    color: var(--color-text, #f0f0fa);
    border-left-color: rgba(233, 30, 140, 0.5);
    text-decoration: none;
}

.nav-link.active {
    background: rgba(233, 30, 140, 0.14);
    color: var(--primary, #e91e8c);
    border-left-color: var(--primary, #e91e8c);
    font-weight: 600;
}

.nav-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-link.active i,
.nav-link:hover i { opacity: 1; }

.nav-link span {
    flex: 1;
    font-weight: 500;
}

.nav-badge {
    background: var(--color-danger, #f87171);
    color: #fff;
    border-radius: 9999px;
    padding: 1px 7px;
    font-size: 0.6875rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Submenu ────────────────────────────────────────────────── */
.submenu-toggle { cursor: pointer; }

.submenu-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    opacity: 0.6;
}

.nav-item-with-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.submenu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background: rgba(233, 30, 140, 0.04);
}

.submenu-list.show { max-height: 1000px; }

.submenu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px 9px 48px;
    color: var(--sidebar-text, #aaaac8);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.submenu-link i {
    font-size: 0.875rem;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.submenu-link:hover {
    background: rgba(233, 30, 140, 0.08);
    color: var(--primary, #e91e8c);
}

.submenu-link.active {
    background: rgba(233, 30, 140, 0.12);
    color: var(--primary, #e91e8c);
    border-left-color: var(--primary, #e91e8c);
}

/* ─── Sidebar Footer ─────────────────────────────────────────── */
.sidebar-footer {
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.footer-links a {
    font-size: 0.75rem;
    color: var(--text-muted, #6e6e90);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--primary, #e91e8c); }

.footer-links a:not(:last-child)::after {
    content: '·';
    margin-left: 6px;
    color: var(--text-muted, #6e6e90);
}

.copyright {
    font-size: 0.6875rem;
    color: var(--text-muted, #6e6e90);
    margin: 0;
}

.logout-form-hidden { display: none; }

/* ─── Mobile Toggle ──────────────────────────────────────────── */
.mobile-sidebar-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--primary, #e91e8c);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(233, 30, 140, 0.35);
    transition: all 0.2s ease;
}

.mobile-sidebar-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(233, 30, 140, 0.5);
}

.mobile-sidebar-toggle i { font-size: 1.25rem; }

/* ─── Overlay ────────────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999;
    opacity: 0;
    transition: opacity 250ms ease;
}

.sidebar-overlay.visible { display: block; opacity: 1; }

/* ─── Light Mode Overrides ───────────────────────────────────── */
[data-theme="light"] .frontend-sidebar {
    background: #ffffff;
    border-right-color: #ddd8ee;
    box-shadow: 2px 0 8px rgba(26,26,46,0.06);
}

[data-theme="light"] .nav-link { color: #5a5a7a; }
[data-theme="light"] .nav-link:hover { background: rgba(233,30,140,0.06); color: #1a1a2e; }
[data-theme="light"] .nav-link.active { background: rgba(233,30,140,0.10); color: #e91e8c; }
[data-theme="light"] .submenu-list { background: rgba(233,30,140,0.03); }
[data-theme="light"] .submenu-link { color: #6b6b8e; }
[data-theme="light"] .sidebar-brand { border-bottom-color: #ddd8ee; }
[data-theme="light"] .user-profile-section { border-bottom-color: #ddd8ee; }
[data-theme="light"] .sidebar-footer { border-top-color: #ddd8ee; }
[data-theme="light"] .user-name { color: #1a1a2e; }
[data-theme="light"] .user-username { color: #6b6b8e; }
[data-theme="light"] .stat-label { color: #6b6b8e; }
[data-theme="light"] .nav-section-title { color: #8888aa; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991px) {
    .mobile-sidebar-toggle { display: flex; }
    .frontend-sidebar { transform: translateX(-100%); }
    .frontend-sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }
    .nav-link { min-height: 44px; }
    .submenu-link { min-height: 44px; }
}

@media (max-width: 480px) {
    .frontend-sidebar { width: 100%; }
    .nav-link { padding: 14px 20px; font-size: 0.9375rem; }
}
