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

:root {
    --bg-light: #f1f5f9;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.85);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --primary-light: #ccfbf1;
    --primary-gradient: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    
    --success: #10b981;
    --success-light: #ecfdf5;
    
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    
    --border: #e2e8f0;
    --border-glass: rgba(255, 255, 255, 0.4);
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.fg-body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    padding: 24px;
    padding-top: 120px; /* topbar-main (54px) + topbar-secondary (38px) + breathing room */
    line-height: 1.5;
}

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5 {
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

h1 { font-size: 2.25rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 2rem;
}

.muted { color: var(--text-muted); }

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover { color: var(--primary-hover); }

/* ═══════════════════════════════════════════════════
   TOPBAR MANOMANO STYLE
   ═══════════════════════════════════════════════════ */
.topbar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.topbar-main {
    background: #0A1128;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4%;
    gap: 10px;
}

.topbar-brand {
    font-size: 1.2rem;
    font-weight: 900;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.topbar-brand svg {
    color: #00AF9A;
}
.topbar-brand:hover {
    color: #ffffff;
}

.search-container {
    flex-grow: 1;
    max-width: 800px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border-radius: 20px;
    border: none;
    font-size: 0.9rem;
    background: #ffffff;
    color: #333;
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #64748b;
    width: 18px;
    height: 18px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.action-icon {
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}
.action-icon:hover {
    color: #00AF9A;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Secondary Nav */
.topbar-secondary {
    background: #0A1128;
    height: 38px;
    display: flex;
    align-items: center;
    padding: 0 4%;
    gap: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-productos {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px 0;
}
.btn-productos:hover {
    color: #00AF9A;
}

.sec-nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}
.sec-nav-links a {
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}
.sec-nav-links a:hover {
    color: #00AF9A;
}

.badge-manoguide {
    background: #00AF9A;
    color: #0A1128;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}
.badge-manoguide:hover {
    background: #008f7d;
    color: #0A1128 !important;
}
.sec-nav-sep {
    color: rgba(255,255,255,0.3);
}

/* Catalog Sidebar — siempre overlay (92px = 54px main + 38px secondary) */
.catalog-sidebar-overlay {
    position: fixed;
    top: 92px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 92px);
    background: rgba(0,0,0,0.5);
    z-index: 900;
}
.catalog-sidebar {
    position: fixed;
    top: 92px;
    left: 0;
    width: 320px;
    height: calc(100vh - 92px);
    background: white;
    z-index: 950;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}
.catalog-sidebar.open {
    transform: translateX(0);
}

.catalog-sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.catalog-sidebar-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.25rem;
}

.catalog-menu {
    list-style: none;
    padding: 12px 0;
}
.catalog-menu li a {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    gap: 16px;
}
.catalog-menu li a:hover {
    background: var(--bg-light);
    color: var(--primary);
}
.catalog-menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.catalog-menu-arrow {
    margin-left: auto;
    color: var(--text-light);
}

/* Buttons */
.btn-action, .btn-save, .btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-action {
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-action:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-action.danger {
    color: var(--danger);
}
.btn-action.danger:hover {
    border-color: var(--danger);
    background: var(--danger-light);
}

.btn-save {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.4);
}
.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 148, 136, 0.5);
}

.btn-logout {
    background: var(--danger-light);
    color: var(--danger);
}
.btn-logout:hover {
    background: var(--danger);
    color: white;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
    gap: 20px;
    flex-wrap: wrap;
}

/* Cards & Containers */
.card, .form-container, .catalog {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.form-container.danger {
    background: var(--danger-light);
    border-color: #fecaca;
}
.form-container.danger h3 {
    color: var(--danger);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input, select, textarea {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text-main);
    transition: var(--transition);
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-light);
}

input.is-invalid, select.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px var(--danger-light);
}

.error-text {
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 4px;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    vertical-align: middle;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:nth-child(even) {
    background-color: #f9fafb; /* Soft grayscale for even rows */
}

tbody tr:hover {
    background-color: #eff6ff; /* Soft blue on hover */
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f1f5f9;
    color: var(--text-muted);
}

/* Clasificación ABC para Inventario */
.badge-a {
    background: rgba(0, 175, 154, 0.1);
    color: #00AF9A;
    border: 1px solid rgba(0, 175, 154, 0.2);
}

.badge-b {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.badge-c {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.badge.activo, .badge.bg-insert {
    background: var(--success-light);
    color: var(--success);
}

.badge.bg-update {
    background: var(--warning-light);
    color: var(--warning);
}

.badge.bg-delete {
    background: var(--danger-light);
    color: var(--danger);
}

code {
    background: #f1f5f9;
    color: #334155;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.4s ease-out;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

/* Utilities */
.d-none { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Dashboard Grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 1024px) {
    .dashboard-grid.admin-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-glass);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-info div {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1;
    margin-top: 4px;
}

/* Animations */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-up {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ═══════════════════════════════════════════════════
   CATÁLOGO PREMIUM 
   ═══════════════════════════════════════════════════ */

.catalog-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.category-section {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out backwards;
}

.category-header {
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.4);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.category-title {
    font-size: 1.8rem;
    margin: 0;
    position: relative;
    display: inline-block;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: 4px;
}

.subcategory-badges {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.badge-pill {
    background: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--primary-light);
}

.product-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 24px;
    padding: 40px;
    scrollbar-width: none;
}
.product-carousel::-webkit-scrollbar { display: none; }

.product-card {
    flex: 0 0 240px;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.product-card:hover::before { opacity: 1; }

.product-image-placeholder {
    width: 100%;
    height: 140px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.product-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-grow: 1;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.product-price .price-value {
    font-size: 1.5rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.product-price .price-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    font-weight: 700;
    text-transform: uppercase;
}

.product-stock {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-light);
    padding: 4px 8px;
    border-radius: 8px;
}

.product-actions {
    position: absolute;
    top: 30px;
    right: 30px;
}

.btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.btn-circle:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

/* Tareas Especiales (Usuarios) */
.task-list {
    list-style: none;
}
.task-list li {
    background: var(--bg-light);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 4px solid var(--primary);
    font-weight: 500;
    font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE (MÓVIL)
   ═══════════════════════════════════════════════════ */

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
}

.mobile-menu {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 20px;
    flex-direction: column;
    gap: 16px;
}

.mobile-menu a {
    font-weight: 600;
    font-size: 1.1rem;
    padding: 12px;
    border-radius: var(--radius-sm);
    display: block;
    color: var(--text-main);
    text-decoration: none;
}

.mobile-menu a.active, .mobile-menu a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

@media (max-width: 768px) {
    body.fg-body {
        padding: 16px;
        padding-top: 120px; /* Evitar que el topbar solape el contenido */
    }

    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.05rem; }

    /* Topbar mobile */
    .topbar-main { padding: 0 3%; gap: 6px; }
    .topbar-brand { font-size: 1rem; }
    .topbar-actions { gap: 10px; }

    /* Ocultar badge "MODO ADMINISTRADOR" en móvil */
    .topbar-role-badge { display: none !important; }

    /* Barra de búsqueda compacta */
    .search-container { max-width: none; flex: 1; }
    .search-input { font-size: 0.85rem; padding: 7px 14px 7px 36px; }

    /* Sidebar de catálogo: ancho amplio en móvil */
    .catalog-sidebar { width: 85vw; }

    .topbar-links.desktop-only { display: none !important; }
    .hamburger-btn { display: block; }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-buttons { width: 100%; }
    .btn-action, .btn-save, .btn-logout { width: 100%; justify-content: center; }

    .card, .form-container { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }

    .category-header {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
    }
    .category-title { font-size: 1.4rem; }

    .product-carousel { padding: 20px; gap: 16px; }
    .product-card { flex: 0 0 220px; }
    .product-image-placeholder { height: 120px; }

    .stat-grid { grid-template-columns: 1fr; gap: 16px; }
    .stat-card { padding: 16px; gap: 12px; }
    .stat-icon { width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0; }
    .stat-info div { font-size: 2rem; }

    .table-wrap { -webkit-overflow-scrolling: touch; }
    .sub-sections { padding: 0 20px 16px !important; }
    .subcategory-badges { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    body.fg-body {
        padding: 12px;
        padding-top: 110px; /* Aumentado para evitar que el topbar solape el contenido */
    }

    h1 { font-size: 1.3rem; }
    h2 { font-size: 1.05rem; }
    h3 { font-size: 0.95rem; }

    .topbar { padding: 0 4%; }
    .topbar-brand { font-size: 1rem; gap: 6px; }
    .topbar-role-badge { display: none; }

    .card, .form-container { padding: 14px; }

    .stat-grid { grid-template-columns: 1fr; }

    .stat-card { flex-direction: row; padding: 14px; gap: 12px; }
    .stat-icon { width: 44px; height: 44px; border-radius: 12px; }
    .stat-info div { font-size: 1.8rem; }

    .product-card { flex: 0 0 180px; }
    .product-image-placeholder { height: 100px; }

    .badge { font-size: 0.7rem; padding: 4px 8px; }
    .btn-action, .btn-save, .btn-logout { font-size: 0.875rem; padding: 10px 16px; }

    .page-header { margin-bottom: 20px; }

    .sub-sections { padding: 0 12px 12px !important; }

    .category-header { padding: 16px; }
    .product-carousel { padding: 16px; gap: 12px; }
}

/* ---------------------------------------------------
   ADMIN SIDEBAR COMPONENT
   --------------------------------------------------- */

/* El overlay oscuro siempre funciona en todos los tamaños */

.admin-sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 92px); /* Siempre debajo del topbar (54px+38px) */
    position: fixed;
    top: 92px;
    left: 0;
    z-index: 950; /* Overlay: mismo nivel que el catalog sidebar */
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 16px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px dashed var(--border);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
}

.user-info .user-name {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}
.user-info .user-role {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 12px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* scroll táctil suave en iOS */
    overscroll-behavior: contain;      /* evita que el scroll propague a la página */
}

/* Scrollbar personalizado para el menú lateral */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    text-decoration: none;
}

.nav-link svg {
    color: var(--text-light);
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.nav-link:hover svg, .nav-link.active svg {
    color: var(--primary);
}

.sidebar-footer {
    padding: 24px 16px;
    border-top: 1px solid var(--border);
}

.nav-link.back-store {
    background: var(--surface);
    border: 1px solid var(--border);
}

.nav-link.back-store:hover {
    background: var(--bg-light);
}

.nav-link.logout-btn {
    color: var(--danger);
}
.nav-link.logout-btn svg {
    color: var(--danger);
}
.nav-link.logout-btn:hover {
    background: var(--danger-light);
    color: var(--danger-hover);
}

/* Para usar junto a la vista principal: */
.admin-layout-wrapper {
    display: block; /* Ya no usamos flex, el sidebar es overlay */
}

.admin-main-content {
    /* El sidebar siempre es overlay, el contenido no se mueve nunca */
    min-width: 0;
    width: 100%;
}
