/* ============================================================
   RestoBar — Feuille de styles globale
   Version complète : auth + layout + composants
   ============================================================ */

/* ── Variables CSS ───────────────────────────────────────── */
:root {
    --rb-primary:      #e8500a;
    --rb-primary-dark: #c94008;
    --rb-secondary:    #1a1a2e;
    --rb-secondary-lt: #16213e;
    --rb-accent:       #f5a623;
    --rb-success:      #198754;
    --rb-danger:       #dc3545;
    --rb-bg:           #f4f6f9;
    --rb-sidebar-w:    250px;
    --rb-topbar-h:     56px;
    --rb-radius:       10px;
    --rb-shadow:       0 2px 12px rgba(0,0,0,.08);
}

/* ── Reset / base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    background: var(--rb-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .95rem;
    color: #333;
}
a { text-decoration: none; }
img { max-width: 100%; }

/* ============================================================
   PAGES AUTH  (login.php / register.php)
   ============================================================ */
body.auth-page {
    background: linear-gradient(135deg, var(--rb-secondary) 0%, var(--rb-secondary-lt) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}



/* Sidebar styles */
.rb-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.rb-sidebar .nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 20px 4px;
    color: #64748b;
    font-weight: 600;
}

.rb-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.rb-sidebar .nav-link i {
    width: 20px;
    font-size: 1.1rem;
}

.rb-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.rb-sidebar .nav-link.active {
    background: rgba(232, 80, 10, 0.2);
    color: #e8500a;
    border-right: 3px solid #e8500a;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    opacity: 0.7;
}

.modal {
    z-index: 1055 !important;
}

.modal-dialog {
    max-height: 95vh;
}

.modal-content {
    max-height: 95vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
}



/* FIX MODAL SCROLL */
.modal-dialog {
    max-height: 90vh;
}

.modal-content {
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
}

/* IMPORTANT: ne bloque pas le scroll */
body.modal-open {
    padding-right: 0 !important;
}

.rb-content {
    overflow: visible;
}

/* FIX FINAL MODAL */
body {
    overflow: auto !important;
}

.modal-open {
    overflow: auto !important;
}

.modal {
    position: fixed !important;
    inset: 0;
    overflow-y: auto !important;
}

.modal-dialog {
    margin: 2rem auto;
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.rb-wrapper {
    height: auto !important;
}

.rb-content {
    overflow: visible !important;
}
.auth-card {
    width: 100%;
    max-width: 460px;
    border: none;
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0,0,0,.45);
    overflow: hidden;
}
.auth-card .card-header {
    background: var(--rb-primary);
    padding: 2.2rem 2rem 1.8rem;
    text-align: center;
    border: none;
}
.auth-card .card-header .brand-icon {
    font-size: 3rem;
    color: #fff;
    display: block;
    line-height: 1;
}
.auth-card .card-header h1 {
    color: #fff;
    font-size: 1.7rem;
    font-weight: 800;
    margin: .5rem 0 .25rem;
    letter-spacing: -.3px;
}
.auth-card .card-header p {
    color: rgba(255,255,255,.78);
    margin: 0;
    font-size: .88rem;
}
.auth-card .card-body { padding: 2rem 2.2rem; }
.auth-card .nav-pills .nav-link {
    color: #666;
    border-radius: 8px;
    font-size: .9rem;
    padding: .45rem .9rem;
    transition: all .15s;
}
.auth-card .nav-pills .nav-link.active {
    background: var(--rb-primary);
    color: #fff;
}
.auth-card .form-control {
    border-radius: 8px;
    border: 1.5px solid #dee2e6;
    font-size: .95rem;
    padding: .55rem .85rem;
    transition: border-color .15s, box-shadow .15s;
}
.auth-card .form-control:focus {
    border-color: var(--rb-primary);
    box-shadow: 0 0 0 .2rem rgba(232,80,10,.18);
}
.auth-card .form-label { font-size: .88rem; color: #555; margin-bottom: .35rem; }
.auth-card .btn-primary {
    background: var(--rb-primary);
    border-color: var(--rb-primary);
    border-radius: 8px;
    font-weight: 600;
    width: 100%;
    padding: .65rem;
    font-size: 1rem;
    transition: background .15s, transform .1s;
}
.auth-card .btn-primary:hover {
    background: var(--rb-primary-dark);
    border-color: var(--rb-primary-dark);
    transform: translateY(-1px);
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

.rb-wrapper { display: flex; min-height: 100vh;

 }

/* ── Sidebar ─────────────────────────────────────────────── */
.rb-sidebar {
    width: var(--rb-sidebar-w);
    background: var(--rb-secondary);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}
.rb-sidebar::-webkit-scrollbar { width: 4px; }
.rb-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.rb-sidebar .sidebar-brand {
    padding: 1.1rem 1.4rem;
    background: rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    gap: .65rem;
    color: #fff;
    font-weight: 800;
    font-size: 1.15rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.rb-sidebar .sidebar-brand .bi { font-size: 1.5rem; color: var(--rb-primary); }

.rb-sidebar .nav-section {
    padding: 1rem 1.4rem .3rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,.3);
    font-weight: 600;
}
.rb-sidebar .nav-link {
    color: rgba(255,255,255,.65);
    padding: .52rem 1.4rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .9rem;
    border-left: 3px solid transparent;
    transition: all .15s;
    border-radius: 0;
}
.rb-sidebar .nav-link .bi { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.rb-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.07);
    border-left-color: rgba(232,80,10,.5);
}
.rb-sidebar .nav-link.active {
    color: #fff;
    background: rgba(232,80,10,.15);
    border-left-color: var(--rb-primary);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.2rem;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.sidebar-footer .user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(232,80,10,.35);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.sidebar-footer .user-name {
    color: #fff; font-size: .85rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-footer .user-role { color: rgba(255,255,255,.4); font-size: .75rem; }
.sidebar-footer .logout-link {
    color: rgba(220,53,69,.8); font-size: .85rem;
    display: flex; align-items: center; gap: .4rem;
    padding: .35rem 0; transition: color .15s;
}
.sidebar-footer .logout-link:hover { color: var(--rb-danger); }

.counter-badge {
    margin: .4rem .8rem;
    padding: .45rem .8rem;
    background: rgba(232,80,10,.12);
    border: 1px solid rgba(232,80,10,.25);
    border-radius: 8px;
    font-size: .8rem;
    color: var(--rb-accent);
    display: flex; align-items: center; gap: .4rem;
}

/* ── Topbar ──────────────────────────────────────────────── */
.rb-topbar {
    position: fixed;
    top: 0; left: var(--rb-sidebar-w); right: 0;
    height: var(--rb-topbar-h);
    background: #fff;
    box-shadow: 0 1px 0 #e9ecef, var(--rb-shadow);
    display: flex; align-items: center;
    padding: 0 1.5rem;
    z-index: 1030; gap: 1rem;
}
.rb-topbar .topbar-title {
    flex: 1; font-size: 1rem; font-weight: 700;
    color: var(--rb-secondary); margin: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rb-topbar .sidebar-toggle {
    display: none; background: none; border: none;
    font-size: 1.4rem; color: var(--rb-secondary);
    padding: .2rem .4rem; cursor: pointer; line-height: 1;
}

/* ── Contenu ─────────────────────────────────────────────── */
.rb-content {
    margin-left: var(--rb-sidebar-w);
    margin-top: var(--rb-topbar-h);
    padding: 1.75rem 1.5rem;
    flex: 1; min-width: 0;
}

/* ── Overlay mobile ──────────────────────────────────────── */
.rb-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 1039;
}
.rb-overlay.show { display: block; }

/* ============================================================
   COMPOSANTS
   ============================================================ */

/* Stat cards */
.stat-card {
    border: none; border-radius: var(--rb-radius);
    padding: 1.4rem 1.6rem; position: relative;
    overflow: hidden; box-shadow: var(--rb-shadow);
}
.stat-card .stat-icon {
    font-size: 2.8rem; opacity: .18; position: absolute;
    right: 1.2rem; top: 50%; transform: translateY(-50%);
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: .8rem; opacity: .85; margin-top: .3rem; font-weight: 500; }
.stat-card .stat-sub   { font-size: .75rem; opacity: .65; margin-top: .15rem; }

/* Card générique */
.rb-card {
    background: #fff; border: none;
    border-radius: var(--rb-radius); box-shadow: var(--rb-shadow);
}
.rb-card > .card-header {
    background: #fff; border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.3rem;
    border-radius: var(--rb-radius) var(--rb-radius) 0 0;
    font-weight: 700; font-size: .95rem; color: var(--rb-secondary);
    display: flex; align-items: center; gap: .5rem;
}

/* Tables */
.table-rb { font-size: .88rem; }
.table-rb thead th {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .6px;
    color: #8898aa; font-weight: 700; border-bottom: 2px solid #f0f0f0;
    white-space: nowrap; background: #fafafa; padding: .75rem 1rem;
}
.table-rb tbody td { padding: .75rem 1rem; vertical-align: middle; }
.table-rb tbody tr:hover { background: #f8f9ff; }

/* Stock */
.stock-low  { color: var(--rb-danger);  font-weight: 700; }
.stock-ok   { color: var(--rb-success); font-weight: 600; }
.stock-warn { color: #fd7e14;           font-weight: 600; }

/* Formulaires */
.form-label { font-size: .87rem; font-weight: 600; color: #555; margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: 8px; border: 1.5px solid #dee2e6; font-size: .9rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--rb-primary);
    box-shadow: 0 0 0 .2rem rgba(232,80,10,.15);
}

/* Boutons */
.btn { border-radius: 8px; font-weight: 500; font-size: .88rem; }
.btn-primary { background: var(--rb-primary); border-color: var(--rb-primary); }
.btn-primary:hover { background: var(--rb-primary-dark); border-color: var(--rb-primary-dark); }
.btn-sm { font-size: .8rem; padding: .3rem .65rem; }

/* Image produit */
.product-img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.product-img-placeholder {
    width: 48px; height: 48px; border-radius: 8px; background: #f0f0f0;
    display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 1.3rem;
}

/* Alertes */
.alert { border-radius: 10px; font-size: .9rem; border: none; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: #aaa; }
.empty-state .bi { font-size: 3.5rem; display: block; margin-bottom: .75rem; opacity: .4; }
.empty-state p { font-size: .95rem; margin: 0; }

/* Pagination */
.pagination .page-link {
    border-radius: 6px !important; margin: 0 2px;
    font-size: .83rem; color: var(--rb-primary); border-color: #dee2e6;
}
.pagination .page-item.active .page-link {
    background: var(--rb-primary); border-color: var(--rb-primary);
}

/* Menu client */
.menu-card {
    border: none; border-radius: 14px; box-shadow: var(--rb-shadow);
    overflow: hidden; transition: transform .18s, box-shadow .18s; cursor: pointer;
}
.menu-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.menu-card .menu-img { width: 100%; height: 160px; object-fit: cover; }
.menu-card .menu-img-placeholder {
    width: 100%; height: 160px;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: #ccc;
}
.menu-card .card-body { padding: 1rem; }
.menu-card .menu-name { font-weight: 700; font-size: .95rem; margin-bottom: .25rem; }
.menu-card .menu-price { color: var(--rb-primary); font-weight: 800; font-size: 1.05rem; }

/* Panier FAB */
.cart-fab { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1050; }
.cart-fab .btn {
    width: 58px; height: 58px; border-radius: 50%; font-size: 1.4rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 18px rgba(232,80,10,.4);
    background: var(--rb-primary); border: none; color: #fff; position: relative;
}
.cart-fab .cart-count {
    position: absolute; top: -4px; right: -4px;
    background: #fff; color: var(--rb-primary); border-radius: 50%;
    width: 22px; height: 22px; font-size: .72rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .rb-sidebar { transform: translateX(-100%); }
    .rb-sidebar.show { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }
    .rb-topbar { left: 0; }
    .rb-topbar .sidebar-toggle { display: block; }
    .rb-content { margin-left: 0; padding: 1.2rem 1rem; }
}
@media (max-width: 575.98px) {
    .rb-content { padding: 1rem .75rem; }
    .stat-card .stat-value { font-size: 1.45rem; }
    .auth-card .card-body { padding: 1.5rem 1.2rem; }
}
