/* =============================================
   Sidebar Navigation — eCertifyHub
   Design: clean white vertical sidebar
   ============================================= */

/* ---------- CSS Custom Properties ---------- */
:root {
    --sidebar-width: 220px;
    --sidebar-bg: #ffffff;
    --sidebar-hover-bg: #f8fafc;
    --sidebar-active-bg: #f1f5f9;
    --sidebar-text: #000000;
    --sidebar-text-active: #000000;
    --sidebar-border: #e5e7eb;
    --sidebar-icon-size: 1.1rem;
    --sidebar-brand-size: 1.5rem;
    --sidebar-border-radius: 10px;
    --sidebar-transition: 0.2s ease;
    --sidebar-plan-bg: #f8fafc;
    --sidebar-plan-progress: #000000;
}

/* ---------- App Shell Layout ---------- */
#app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Sidebar ---------- */
#app-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    scrollbar-width: none;
}

#app-sidebar::-webkit-scrollbar {
    display: none;
}

/* ---------- Brand / Logo Area ---------- */
.sidebar-brand {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    height: 78px;
    padding: 0 18px;
    text-decoration: none;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #000000;
    letter-spacing: 1.2px;
    white-space: nowrap;
    text-transform: uppercase;
}

/* ---------- Nav List ---------- */
.sidebar-nav {
    list-style: none;
    padding: 0 10px;
    margin: 0;
    flex: 1;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

/* ---------- Nav Item Link ---------- */
.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;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--sidebar-transition),
        color var(--sidebar-transition);
    white-space: nowrap;
    user-select: none;
}

.sidebar-link i {
    font-size: var(--sidebar-icon-size);
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

/* Active state */
.sidebar-link--active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    font-weight: 600;
}

/* ---------- Section Divider ---------- */
.sidebar-divider {
    border: none;
    border-top: 1px solid var(--sidebar-border);
    margin: 8px 10px;
}

/* ---------- Pro Plan Widget ---------- */
.sidebar-plan {
    margin: 10px 10px 16px;
    padding: 14px 16px;
    background: var(--sidebar-plan-bg);
    border-radius: var(--sidebar-border-radius);
    border: 1px solid #dbeafe;
}

.sidebar-plan-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 2px;
}

.sidebar-plan-subtitle {
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 10px;
}

.sidebar-plan-progress-track {
    height: 5px;
    border-radius: 3px;
    background: #dbeafe;
    overflow: hidden;
}

.sidebar-plan-progress-bar {
    height: 100%;
    width: 49%;
    border-radius: 3px;
    background: var(--sidebar-plan-progress);
    transition: width 0.4s ease;
}

/* ---------- Main Content Area ---------- */
/* Default: no sidebar (login/signup state) */
#app-content {
    flex: 1;
    min-height: 100vh;
    background-color: #f4f6fb;
    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 36px 60px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Auth/certificate pages fill full area */
#loginSignupPage,
#getallcertificates {
    flex: 1;
    padding: 0;
    margin: 0;
}

/* ---------- Mobile Toggle Button ---------- */
#sidebar-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    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;
    }
}