/* ==========================================================================
   Sistema de Inventario - Estilos
   Inspiración: Windows 11 (Fluent) + Bootstrap 5
   ========================================================================== */

:root {
    --brand: #0067c0;
    --brand-hover: #005ba1;
    --surface: #ffffff;
    --surface-2: #f6f6f9;
    --surface-3: #ececf3;
    --stroke: rgba(0, 0, 0, 0.08);
    --text: #1c1c1e;
    --text-muted: #5c5c66;
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 264px;
    --topbar-h: 56px;
    --shadow-1: 0 1px 2px rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-2: 0 4px 20px rgba(0,0,0,0.06);
}

[data-bs-theme="dark"] {
    --brand: #4cc2ff;
    --brand-hover: #7ad0ff;
    --surface: #1f1f22;
    --surface-2: #17171a;
    --surface-3: #26262b;
    --stroke: rgba(255,255,255,0.08);
    --text: #f2f2f4;
    --text-muted: #a0a0aa;
    --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-2: 0 4px 20px rgba(0,0,0,0.5);
}

* { -webkit-font-smoothing: antialiased; }

body {
    font-family: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont,
                 "Inter", "Roboto", "Helvetica Neue", Arial, sans-serif;
    background: var(--surface-2);
    color: var(--text);
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-hover);
    --bs-btn-hover-border-color: var(--brand-hover);
    --bs-btn-active-bg: var(--brand-hover);
    --bs-btn-active-border-color: var(--brand-hover);
    border-radius: var(--radius-sm);
}

.card {
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--stroke);
}

/* ==========================================================================
   Guest (login)
   ========================================================================== */
.guest-shell {
    min-height: 100vh;
    background: linear-gradient(135deg, #0067c0 0%, #5a3fbe 100%);
    padding: 24px;
}
.guest-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.25);
}
.brand-mark-lg { font-size: 3rem; line-height: 1; }
.brand-header h1 { color: var(--text); }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--stroke);
    padding: 20px 16px;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .18s ease;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 600; font-size: 1.05rem; padding: 6px 8px 20px;
    color: var(--text);
}
.brand-mark { font-size: 1.6rem; }

.sidebar .nav-section {
    font-size: .72rem; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-muted);
    padding: 14px 8px 6px;
}
.sidebar .nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text); font-weight: 500;
    transition: background .1s ease;
}
.sidebar .nav-link:hover { background: var(--surface-3); }
.sidebar .nav-link.active {
    background: color-mix(in srgb, var(--brand) 12%, transparent);
    color: var(--brand);
}
.sidebar .nav-link.disabled { color: var(--text-muted); }
.sidebar .soon {
    margin-left: auto; font-size: .68rem; padding: 2px 6px;
    background: var(--surface-3); border-radius: 999px;
}

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--stroke); }
.user { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-hover));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.user-name { font-weight: 600; font-size: .9rem; }
.user-role { font-size: .75rem; color: var(--text-muted); }

.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    background: var(--surface-2);
}
@media (max-width: 991.98px) {
    .main { margin-left: 0; }
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-2); }
    .sidebar.open { transform: translateX(0); }
}

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--stroke);
    padding: 0 16px;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; }

.content { max-width: 1400px; }

/* ==========================================================================
   Bottom nav (móvil, encargado)
   ========================================================================== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--stroke);
    display: flex; justify-content: space-around;
    z-index: 1020;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a,
.bottom-nav button {
    background: none; border: none;
    display: flex; flex-direction: column; align-items: center;
    color: var(--text-muted); font-size: .7rem;
    padding: 6px 10px; border-radius: 8px; text-decoration: none;
}
.bottom-nav a i, .bottom-nav button i { font-size: 1.15rem; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav .unstyled { cursor: pointer; color: var(--text-muted); }

/* ==========================================================================
   Stats
   ========================================================================== */
.stat-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text);
    text-decoration: none;
    transition: transform .1s ease, box-shadow .1s ease;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); color: var(--text); }
.stat-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--brand) 12%, transparent);
    color: var(--brand);
    font-size: 1.1rem;
    margin-bottom: 10px;
}
.stat-value { font-size: 1.9rem; font-weight: 600; line-height: 1; }
.stat-label { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }

.accent-blue   .stat-icon { background: color-mix(in srgb, #0067c0 15%, transparent); color: #0067c0; }
.accent-green  .stat-icon { background: color-mix(in srgb, #107c10 15%, transparent); color: #107c10; }
.accent-purple .stat-icon { background: color-mix(in srgb, #7c3aed 15%, transparent); color: #7c3aed; }
.accent-teal   .stat-icon { background: color-mix(in srgb, #0e9494 15%, transparent); color: #0e9494; }
.accent-amber  .stat-icon { background: color-mix(in srgb, #d97706 15%, transparent); color: #d97706; }
.accent-red    .stat-icon { background: color-mix(in srgb, #c62828 15%, transparent); color: #c62828; }

/* ==========================================================================
   Estados de stock (badge)
   ========================================================================== */
.badge-stock { padding: 4px 10px; border-radius: 999px; font-weight: 500; font-size: .75rem; }
.stock-ok       { background: #dcfce7; color: #166534; }
.stock-bajo     { background: #fef3c7; color: #92400e; }
.stock-critico  { background: #fee2e2; color: #991b1b; }
.stock-info     { background: #dbeafe; color: #1e40af; }
[data-bs-theme="dark"] .stock-ok      { background: #052e16; color: #86efac; }
[data-bs-theme="dark"] .stock-bajo    { background: #422006; color: #fcd34d; }
[data-bs-theme="dark"] .stock-critico { background: #450a0a; color: #fca5a5; }
[data-bs-theme="dark"] .stock-info    { background: #172554; color: #93c5fd; }

/* ==========================================================================
   Tabla
   ========================================================================== */
.table { --bs-table-hover-bg: var(--surface-3); }
.table thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 500;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--stroke);
}

.module-status li { display: flex; gap: 8px; padding: 4px 0; font-size: .9rem; }

/* Bottom padding para móvil cuando hay bottom-nav */
@media (max-width: 991.98px) {
    .main { padding-bottom: 72px; }
}
