/* ============================================================
   SIDEBAR SYSTEM — Datanow Standard v14
   ============================================================ */

/* ── Layout Grid ── */
.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: calc(100vh - 60px);
    overflow: hidden;
}
.layout.collapsed {
    grid-template-columns: 0px 1fr;
}

/* ── Base Sidebar Container ── */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    min-width: 0;
    transition: width 0.3s ease, padding 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: var(--surface-lowest);
    border-right: 1px solid var(--border-ghost);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 10;
    position: relative;
}

/* ── Sidebar Title ── */
.sidebar h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-family: var(--font-headline);
    letter-spacing: -0.02em;
}
.sidebar h2 span {
    color: var(--primary-container);
    text-shadow: 0 0 12px rgba(0, 209, 255, 0.4);
}

/* ── Sidebar Collapsed State ── */
.layout.collapsed .sidebar {
    width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    overflow: hidden;
}
.layout.collapsed .sidebar h2,
.layout.collapsed .sidebar nav {
    display: none;
}

/* ── Nav Links (inside sidebar) ── */
.nav-link {
    padding: 0.75rem 1rem;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}
.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}
.nav-link.active {
    background-color: rgba(0, 209, 255, 0.1);
    color: var(--primary) !important;
    border-left: 2px solid var(--primary-container);
}

/* ── Top Navbar Links ── */
.top-nav-links {
    display: flex;
    gap: 15px;
    margin-left: 20px;
}
.top-nav-links .nav-link {
    color: #ffffff;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 0;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}
.top-nav-links .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}
.top-nav-links .nav-link.active {
    background: rgba(0, 209, 255, 0.1);
    color: #ffffff;
    border-left: none;
}

/* ── Logout Button ── */
.logout-btn {
    margin-top: auto;
    background: transparent !important;
    border: 1px solid var(--border-ghost);
    color: var(--text-secondary);
    width: 100%;
    text-align: center;
    box-shadow: none;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.logout-btn:hover {
    background: rgba(255, 115, 115, 0.1) !important;
    color: var(--error);
    border-color: rgba(255, 115, 115, 0.3);
}

/* ── Collapse Sidebar Button (navbar — stays visible when collapsed) ── */
#collapseSidebarBtn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-ghost);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.7rem;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
#collapseSidebarBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .sidebar { width: 200px; }
    .layout { grid-template-columns: 200px 1fr; }
}
@media (max-width: 900px) {
    .sidebar { width: 0; padding: 0; border-right: none; }
    .layout { grid-template-columns: 0px 1fr; }
}
