/* ===========================
   Sistema Restaurante — CSS
   IBM Plex Sans · Bootstrap 5
   =========================== */

:root {
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --sidebar-bg: #1e2a3a;
    --sidebar-text: #c8cdd8;
    --sidebar-active-color: #4f8ef7;
    --sidebar-active-border: #0d6efd;
    --primary: #4f8ef7;
    --body-bg: #f4f6fb;
}

* { box-sizing: border-box; }

body {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    background: var(--body-bg);
    margin: 0;
    color: #1a1f2e;
}

.app-frame {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}
.app-frame--fullwidth {
    grid-template-columns: 1fr;
}

.app-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

.app-sidebar {
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.sidebar-nav { padding: .75rem .75rem; flex: 1; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: var(--sidebar-text);
    padding: .6rem .85rem;
    border-radius: 8px;
    font-size: .9rem;
    text-decoration: none;
    transition: background .15s, color .15s;
    margin-bottom: 2px;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.05);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    border-left: 3px solid var(--sidebar-active-border);
    background: rgba(13,110,253,.10);
    color: var(--sidebar-active-color);
    font-weight: 500;
    padding-left: calc(.85rem - 3px); /* compensate border */
}

.sidebar-nav .nav-link i { font-size: 1rem; width: 1.2rem; text-align: center; }

/* Direct links (no group) */
.sidebar-nav .nav-link--direct {
    margin-bottom: 2px;
}

/* Child links inside a group */
.sidebar-nav .nav-link--child {
    padding-left: 2.4rem;
    font-size: .86rem;
}

/* ── Section label (role-restricted area) ── */
.nav-section-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.3);
    padding: .9rem .85rem .3rem;
}

/* Legacy alias kept for any existing views still using .nav-section */
.nav-section {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.3);
    padding: .9rem .85rem .3rem;
}

/* ── Collapsible group header ── */
.nav-group-header {
    display: flex;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;
    color: #8892a0;
    padding: .45rem .85rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    cursor: pointer;
    gap: .5rem;
    margin-top: .4rem;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.nav-group-header:hover {
    color: #c8cdd8;
    background: rgba(255,255,255,.04);
}

.nav-group-icon {
    font-size: .85rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.nav-group-label {
    flex: 1;
    text-align: left;
}

.nav-group-arrow {
    font-size: .7rem;
    transition: transform .22s ease;
    flex-shrink: 0;
}

.nav-group-header.open .nav-group-arrow,
.nav-group-header[aria-expanded="true"] .nav-group-arrow {
    transform: rotate(90deg);
}

/* ── Group collapse container ── */
.nav-group-collapse {
    overflow: hidden;
}

.nav-group-collapse .nav-link--child {
    margin-bottom: 1px;
}

.app-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title { font-weight: 600; font-size: 1rem; }
.app-main { padding: 1.5rem; flex: 1; }
.page-header { margin-bottom: 1.25rem; }
.page-title { font-size: 1.3rem; font-weight: 600; margin: 0; }

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: #6b7280; margin-top: .2rem; }

.login-body {
    background: linear-gradient(135deg, #1a1f2e 0%, #2d3555 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container { width: 100%; max-width: 420px; padding: 1rem; }
.login-card { background: #fff; border-radius: 16px; padding: 2.5rem 2rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-icon { font-size: 3rem; color: var(--primary); }
.login-title { font-size: 1.5rem; font-weight: 700; margin: .5rem 0 .25rem; }
.login-subtitle { color: #6b7280; font-size: .9rem; margin: 0; }

.kitchen-card {
    background: #fff;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    padding: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.kitchen-card.urgent { border-left-color: #ef4444; }
.kitchen-card.warning { border-left-color: #f59e0b; }

/* ── MODO OSCURO ── */
[data-theme="dark"] {
    --bs-body-bg:            #0f0f0f;
    --bs-body-color:         #e0e0e0;
    --bs-card-bg:            #1a1a1a;
    --bs-border-color:       #2e2e2e;
    --bs-table-bg:           transparent;
    --bs-table-striped-bg:   rgba(255,255,255,.03);
    --bs-table-hover-bg:     rgba(255,255,255,.05);
    --bs-secondary-bg:       #1a1a1a;
    --bs-tertiary-bg:        #242424;
    --sidebar-bg:            #111;
    --sidebar-border:        #222;
    --topbar-bg:             #111;
}

[data-theme="dark"] body                    { background: #0f0f0f !important; color: #e0e0e0 !important; }
[data-theme="dark"] .card                   { background: #1a1a1a !important; border-color: #2e2e2e !important; }
[data-theme="dark"] .table                  { color: #e0e0e0; }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select            { background: #242424 !important; border-color: #2e2e2e !important; color: #e0e0e0 !important; }
[data-theme="dark"] .modal-content         { background: #1a1a1a !important; border-color: #2e2e2e !important; color: #e0e0e0 !important; }
[data-theme="dark"] .dropdown-menu         { background: #1a1a1a !important; border-color: #2e2e2e !important; }
[data-theme="dark"] .dropdown-item         { color: #e0e0e0 !important; }
[data-theme="dark"] .dropdown-item:hover   { background: #2e2e2e !important; }
[data-theme="dark"] .app-sidebar           { background: #111 !important; border-color: #222 !important; }
[data-theme="dark"] .app-topbar            { background: #111 !important; border-color: #222 !important; }
[data-theme="dark"] .nav-link              { color: #aaa !important; }
[data-theme="dark"] .nav-link.active       { color: #fff !important; background: rgba(13,110,253,.15) !important; border-left-color: #4f8ef7 !important; }
[data-theme="dark"] .nav-group-header      { color: #666 !important; }
[data-theme="dark"] .nav-group-header:hover { color: #aaa !important; }
[data-theme="dark"] .text-muted            { color: #888 !important; }
[data-theme="dark"] .alert-success         { background: #1a3a1a !important; border-color: #2d5a2d !important; color: #7eca7e !important; }
[data-theme="dark"] .alert-danger          { background: #3a1a1a !important; border-color: #5a2d2d !important; color: #e07e7e !important; }
[data-theme="dark"] .badge.bg-light        { background: #333 !important; color: #e0e0e0 !important; }
