/* =============================================
   Sidebar Navigation — CustHive
   Design: Modern sidebar matching the design reference
   ============================================= */

/* ---------- CSS Custom Properties ---------- */
:root {
    --sidebar-width: 260px;
    --sidebar-bg: #FFFFFF;
    --sidebar-hover-bg: #F8FAFC;
    --sidebar-active-bg: #F5F3FF;
    --sidebar-active-text: #4F46E5;
    /* Indigo */
    --sidebar-text: #484c51;
    --sidebar-text-active: #4F46E5;
    --sidebar-border: #F1F5F9;
    --sidebar-icon-size: 1rem;
    --sidebar-border-radius: 12px;
    --sidebar-transition: 0.2s ease;
}

/* ---------- Sidebar ---------- */
#app-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 1px 0 10px rgba(0, 0, 0, 0.02);
}

/* ---------- Brand Area ---------- */
.sidebar-brand {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px;
    height: 72px;
    padding: 0 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-brand-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 10px;
    font-weight: 700;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1px;
}

/* ---------- Navigation ---------- */
.sidebar-nav {
    list-style: none;
    padding: 0 16px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 2px;
}

.sidebar-section-title {
    font-size: 9px;
    font-weight: 800;
    color: #959595;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 24px 12px 12px 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--sidebar-border-radius);
    color: var(--sidebar-text);
    text-decoration: none !important;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all var(--sidebar-transition);
    margin-bottom: 4px;
}

.sidebar-link i {
    font-size: var(--sidebar-icon-size);
    color: #94A3B8;
    transition: color 0.2s;
    width: 20px;
    text-align: center;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: #1E293B;
}

.sidebar-link--active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text) !important;
}

.sidebar-link--active i {
    color: var(--sidebar-active-text) !important;
}

/* ---------- Footer ---------- */
.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.sidebar-footer-text {
    font-size: 12px;
    font-weight: 600;
    color: #64748B;
}

.sidebar-footer-text span {
    color: #1E293B;
    font-weight: 700;
}

/* ---------- Spacer ---------- */
.sidebar-spacer {
    flex: 1;
}

/* ---------- Main Content Area ---------- */
#app-content {
    flex: 1;
    min-height: 100vh;
    background-color: #F8FAFC;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Authenticated with sidebar */
body.sidebar-active #app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Content area padding below topbar */
#main-content-area {
    padding: 32px 40px 48px 40px;
    flex: 1 1 0 !important;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* ---------- Mobile Toggle Button ---------- */
#sidebar-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: none;
    align-items: center;
    justify-content: center;
    color: #1E293B;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ---------- Sidebar Backdrop (mobile overlay) ---------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* ---------- Desktop: hide toggle, show sidebar normally ---------- */
@media (min-width: 769px) {
    #sidebar-toggle {
        display: none !important;
    }

    .sidebar-backdrop {
        display: none !important;
    }
}

/* ---------- Responsive: Mobile (≤768px) ---------- */
@media (max-width: 768px) {

    /* Sidebar slides in as overlay */
    #app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        z-index: 150;
    }

    #app-sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Content takes full width */
    body.sidebar-active #app-content {
        margin-left: 0;
    }

    /* Show hamburger only when sidebar is active (authenticated) */
    body.sidebar-active #sidebar-toggle {
        display: flex;
    }

    /* Topbar accounts for toggle button */
    body.sidebar-active #app-topbar {
        padding-left: 60px;
    }

    /* Content area tighter padding */
    #main-content-area {
        padding: 20px 16px 40px;
    }
}

/* ---------- Extra small screens (≤480px) ---------- */
@media (max-width: 480px) {
    #main-content-area {
        padding: 16px 12px 32px;
    }

    body.sidebar-active #app-topbar {
        padding-left: 56px;
        padding-right: 12px;
    }
}