/* ============================================
   SIDEBAR NAVIGATION - CHICHILOS ADMIN
   Mobile-first responsive system
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Variables ── */
:root {
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --primary: #E30613;
    --primary-hover: #c00510;
    --gray-700: #374151;
    --gray-800: #1a0203;
    --gray-900: #0f0102;
    --transition: 200ms ease;
    --content-padding: 20px;
}

/* ── Base body ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    margin: 0;
    overflow-x: hidden;
}

/* Desktop: body shifts right to make room for sidebar */
body.sidebar-active {
    padding-left: var(--sidebar-width);
    transition: padding-left var(--transition);
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f0102 0%, #1a0203 60%, #2a0304 100%);
    color: white;
    z-index: 1000;
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(227, 6, 19, 0.15);
    border-right: 1px solid rgba(227, 6, 19, 0.2);
    overflow: hidden;
}

/* ── Sidebar header ── */
.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(227, 6, 19, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--topbar-height);
    background: rgba(227, 6, 19, 0.08);
    flex-shrink: 0;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: white;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(227, 6, 19, 0.4);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Sidebar nav ── */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 0.5rem;
    transition: all var(--transition);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(227, 6, 19, 0.18);
    color: white;
    transform: translateX(3px);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 3px 10px rgba(227, 6, 19, 0.4);
    border-left: 3px solid #fff;
}

.nav-icon {
    width: 18px;
    height: 18px;
    min-width: 18px;
}

.nav-text { flex: 1; }

/* ── Sidebar footer ── */
.sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(227, 6, 19, 0.3);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    flex-shrink: 0;
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-height);
    background: white;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.07);
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    /* Compensate for container padding */
    margin: calc(-1 * var(--content-padding)) calc(-1 * var(--content-padding)) var(--content-padding);
    box-sizing: content-box;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: var(--gray-700);
    border-radius: 6px;
    flex-shrink: 0;
    transition: background var(--transition);
}

.hamburger:hover {
    background: #f5f5f5;
}

.topbar-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.user-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 2px 6px rgba(227, 6, 19, 0.3);
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

/* Hidden legacy elements */
.nav,
.header,
.admin-header {
    display: none !important;
}

/* ── Overlay (mobile sidebar backdrop) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ══════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════ */

/* ── Tablet (≤ 1024px): sidebar off-canvas ── */
@media (max-width: 1024px) {
    :root {
        --content-padding: 16px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    body.sidebar-active {
        padding-left: 0;
    }

    .hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        margin: calc(-1 * var(--content-padding)) calc(-1 * var(--content-padding)) var(--content-padding);
        padding: 0 1.25rem;
    }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
    :root {
        --content-padding: 12px;
        --topbar-height: 56px;
    }

    .topbar {
        padding: 0 1rem;
        margin: calc(-1 * var(--content-padding)) calc(-1 * var(--content-padding)) var(--content-padding);
    }

    .topbar-right {
        gap: 0.625rem;
    }

    .user-name {
        display: none;
    }

    .logout-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }

    .topbar-left img {
        display: none;
    }
}

/* ── Small mobile (≤ 480px) ── */
@media (max-width: 480px) {
    :root {
        --content-padding: 10px;
        --topbar-height: 52px;
    }

    .topbar-title {
        font-size: 0.8125rem;
        max-width: 140px;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 0.7rem;
    }

    .logout-btn {
        padding: 5px 10px !important;
        font-size: 11px !important;
    }
}
