/* Dashboard Layout — Sidebar + Header + Content
   ============================================== */

/* ---- SIDEBAR ---- */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: rgba(8, 8, 8, 0.85);
    backdrop-filter: blur(40px) saturate(180%);
    border-right: 1px solid var(--border);
    transition: width var(--duration) var(--ease-liquid);
    overflow: hidden;
}

.sidebar.expanded,
.sidebar.pinned {
    width: var(--sidebar-expanded);
}

.sidebar.expanded .nav-label,
.sidebar.pinned .nav-label {
    opacity: 1;
    transform: translateX(0);
}

.sidebar.expanded .logo-text,
.sidebar.pinned .logo-text {
    opacity: 1;
    transform: translateX(0);
}

.sidebar.expanded .status-label,
.sidebar.pinned .status-label {
    opacity: 1;
    transform: translateX(0);
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--fg), rgba(255, 255, 255, 0.6));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--bg);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.3s var(--ease-liquid);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
    margin: 12px 16px;
}

.sidebar-nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    color: var(--fg-muted);
    position: relative;
    transition: all 0.3s var(--ease-liquid);
    text-align: left;
}

.sidebar-nav-item:hover {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav-item.active {
    color: var(--fg);
}

.sidebar-nav-item.scaffolded {
    opacity: 0.5;
    cursor: default;
}

.nav-active-indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--fg);
    border-radius: 0 2px 2px 0;
    animation: fade-in 0.3s ease-out;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
    transition: opacity 0.3s, transform 0.3s;
}

.sidebar-nav-item:hover .nav-icon svg {
    opacity: 1;
    transform: scale(1.05);
}

.nav-label {
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.3s var(--ease-liquid);
}

.nav-soon {
    margin-left: 8px;
    font-size: 11px;
    color: var(--fg-dim);
}

/* Footer */
.sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-layer-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 101;
}

.sidebar:hover .sidebar-toggle {
    opacity: 1;
}

/* ---- HEADER ---- */

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 28px;
}

.header-search {
    position: relative;
    max-width: 360px;
    flex: 1;
}

.header-search input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background: var(--bg-layer-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--fg);
    transition: all 0.3s var(--ease-liquid);
}

.header-search input:focus {
    background: var(--bg-layer-2);
    border-color: var(--border-hover);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.02);
}

.header-search input::placeholder {
    color: var(--fg-dim);
}

.header-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fg-dim);
    display: flex;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--fg-muted);
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--fg-muted);
    transition: all 0.3s var(--ease-liquid);
    position: relative;
}

.header-btn:hover {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.06);
}

.header-notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--state-processing);
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-layer-3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: all 0.3s;
}

.header-avatar:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-avatar svg {
    width: 18px;
    height: 18px;
    opacity: 0.6;
}

/* ---- MAIN CONTENT ---- */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 0 40px;
    transition: margin-left var(--duration) var(--ease-liquid);
    animation: fade-in 0.6s ease-out;
}

.page-content {
    max-width: 1400px;
}

/* ---- MOBILE TAB BAR ---- */

.mobile-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(8, 8, 8, 0.92);
    backdrop-filter: blur(40px) saturate(180%);
    border-top: 1px solid var(--border);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    color: var(--fg-dim);
    position: relative;
    transition: color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
    color: var(--fg);
}

.tab-icon {
    display: flex;
}

.tab-icon svg {
    width: 22px;
    height: 22px;
}

.tab-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tab-active-dot {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--fg);
}

/* ---- MOBILE MENU DRAWER ---- */

.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 300;
    opacity: 0;
    transition: opacity 0.35s var(--ease-liquid);
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu-drawer {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    z-index: 301;
    background: rgba(12, 12, 12, 0.95);
    backdrop-filter: blur(60px) saturate(180%);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-liquid);
    flex-direction: column;
    overflow-y: auto;
}

.mobile-menu-drawer.open {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 600;
    flex: 1;
}

.mobile-menu-nav {
    padding: 12px 8px;
    flex: 1;
}

.mobile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: var(--fg-muted);
    border-radius: 12px;
    transition: all 0.25s;
    text-align: left;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-item:hover,
.mobile-menu-item:active {
    background: rgba(255, 255, 255, 0.04);
    color: var(--fg);
}

.mobile-menu-item.active {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.06);
}

.mobile-menu-item.scaffolded {
    opacity: 0.4;
}

.mobile-menu-icon {
    display: flex;
}

.mobile-menu-icon svg {
    width: 20px;
    height: 20px;
}

.mobile-menu-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--fg-muted);
}

body.menu-open {
    overflow: hidden;
}

/* ============================================
   RESPONSIVE — TABLET (≤1024px)
   ============================================ */

@media (max-width: 1024px) {
    .main-content {
        padding: 0 24px;
    }

    .header-status {
        display: none;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (≤768px)
   ============================================ */

@media (max-width: 768px) {
    /* Hide desktop sidebar, show mobile tab bar */
    .sidebar {
        display: none !important;
    }

    .mobile-tab-bar {
        display: flex;
    }

    .mobile-menu-overlay,
    .mobile-menu-drawer {
        display: flex;
    }

    .mobile-menu-overlay:not(.open) {
        pointer-events: none;
    }

    /* Main content — no sidebar margin, bottom padding for tab bar */
    .main-content {
        margin-left: 0;
        padding: 0 16px;
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }

    /* Header — compact */
    .dashboard-header {
        padding: 16px 0 20px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-search {
        max-width: none;
        order: 2;
        width: 100%;
    }

    .header-actions {
        order: 1;
    }

    .header-status {
        display: none;
    }

    .header-btn {
        width: 36px;
        height: 36px;
    }

    .header-avatar {
        width: 32px;
        height: 32px;
    }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (≤480px)
   ============================================ */

@media (max-width: 480px) {
    .main-content {
        padding: 0 12px;
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }

    .header-search input {
        font-size: 14px;
        padding: 12px 16px 12px 40px;
    }
}
