/* ═══════════════════════════════════════════════════════════
   SHARED SIDEBAR — Automated Worx
   Unified sidebar for all 22 dashboard/admin pages
   Works with navbar-dashboard.css
   ═══════════════════════════════════════════════════════════ */

/* ══ ISOLATION: prevent page styles from leaking in ═════ */
.dash-sidebar,
.dash-sidebar *,
.dash-sidebar *::before,
.dash-sidebar *::after {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
    letter-spacing: normal;
    text-transform: none;
    font-style: normal;
    box-sizing: border-box;
}
.dash-sidebar a             { text-decoration: none; outline: none; }
.dash-sidebar ul,
.dash-sidebar li            { list-style: none; margin: 0; padding: 0; }

/* ── Layout Wrapper ──────────────────────────────────── */
.dash-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 56px;  /* navbar-dashboard height */
}

/* ── Sidebar ─────────────────────────────────────────── */
.dash-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    background: rgba(10, 15, 36, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid rgba(14, 242, 255, 0.08);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    transition: transform 0.3s ease, width 0.3s ease;
}

/* Scrollbar */
.dash-sidebar::-webkit-scrollbar {
    width: 4px;
}

.dash-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.dash-sidebar::-webkit-scrollbar-thumb {
    background: rgba(14, 242, 255, 0.15);
    border-radius: 2px;
}

/* ── Sidebar Sections ────────────────────────────────── */
.ds-section {
    padding: 1rem 0 0.5rem;
}

.ds-section:first-child {
    padding-top: 0.75rem;
}

.ds-section-title {
    padding: 0 1.25rem;
    margin-bottom: 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #475569;
}

/* ── Sidebar Links ───────────────────────────────────── */
.ds-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ds-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 450;
    border-left: 3px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.ds-nav a:hover {
    color: #e2e8f0;
    background: rgba(14, 242, 255, 0.04);
}

.ds-nav a.active {
    color: #0ef;
    background: rgba(14, 242, 255, 0.06);
    border-left-color: #0ef;
}

.ds-nav .ds-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* ── Sidebar Footer ──────────────────────────────────── */
.ds-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(14, 242, 255, 0.06);
}

.ds-footer a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.15s;
}

.ds-footer a:hover {
    color: #94a3b8;
}

/* ── Main Content Area ───────────────────────────────── */
.dash-main {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
    min-height: calc(100vh - 56px);
    width: calc(100% - 250px);
}

/* ── Auto-offset: push all content siblings after sidebar ── */
.dash-sidebar ~ .dashboard-wrapper,
.dash-sidebar ~ .container,
.dash-sidebar ~ main,
.dash-sidebar ~ section,
.dash-sidebar ~ .content,
.dash-sidebar ~ .page-content,
.dash-sidebar ~ .helpdesk-layout {
    margin-left: 250px !important;
    width: calc(100% - 250px);
}

/* Override old sidebar margin from pages that had 280px offset */
.dash-sidebar ~ .dashboard-wrapper .main-content {
    margin-left: 0 !important;
    width: 100%;
}

/* ── Responsive: Tablet ──────────────────────────────── */
@media (max-width: 1024px) {
    .dash-sidebar {
        transform: translateX(-100%);
        width: 260px;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
    }

    .dash-sidebar.open {
        transform: translateX(0);
    }

    .dash-main {
        margin-left: 0;
        width: 100%;
    }

    /* Remove auto-offset on tablet/mobile */
    .dash-sidebar ~ .dashboard-wrapper,
    .dash-sidebar ~ .container,
    .dash-sidebar ~ main,
    .dash-sidebar ~ section,
    .dash-sidebar ~ .content,
    .dash-sidebar ~ .page-content,
    .dash-sidebar ~ .helpdesk-layout {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Overlay when sidebar is open */
    .dash-overlay {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .dash-overlay.active {
        display: block;
    }
}

/* ── Responsive: Mobile ──────────────────────────────── */
@media (max-width: 640px) {
    .dash-main {
        padding: 1rem;
    }
}
