/* ========== Layout ========== */
body {
    display: flex;
    height: 100vh;
}

/* ========== Sidebar ========== */
#sidebar {
    width: 240px;
    min-width: 240px;
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #ffffff;
    text-decoration: none;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg,
.nav-item:hover svg {
    opacity: 1;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 12px;
}

/* ========== Nav Dropdown ========== */
.nav-dropdown-toggle {
    justify-content: flex-start;
}

.nav-dropdown-arrow {
    margin-left: auto;
    opacity: 0.5;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-dropdown.open .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.nav-dropdown.open .nav-dropdown-menu {
    max-height: 200px;
}

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 44px;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-size: 0.85rem;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.15s ease;
    opacity: 0.8;
}

.nav-sub-item:hover {
    background: var(--bg-sidebar-hover);
    color: #ffffff;
    text-decoration: none;
    opacity: 1;
}

.nav-sub-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    opacity: 1;
    font-weight: 500;
}

.nav-sub-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.nav-sub-item.active svg,
.nav-sub-item:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.08);
    color: var(--text-sidebar);
    cursor: pointer;
    transition: all 0.15s;
}

.theme-toggle-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
}

.theme-light .icon-sun { display: none; }
.theme-light .icon-moon { display: block; }
.theme-dark .icon-sun { display: block; }
.theme-dark .icon-moon { display: none; }

/* ========== Main Wrapper ========== */
#main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
}

/* ========== Header ========== */
#header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 60px;
    min-height: 60px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

#page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-clock {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-secondary);
}

/* ========== Content ========== */
#content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle-btn {
        display: flex;
    }

    #content {
        padding: 16px;
    }
}

/* Sidebar overlay on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}
