/* ============================================================
   CANTINE ENTREPRISE — Custom CSS (Bootstrap 5.3 override)
   Palette: Bleu #1e3a8a | Vert #10b981 | Orange #f59e0b
   ============================================================ */

:root {
  --blue-deep:   #1e3a8a;
  --blue-mid:    #2563eb;
  --green:       #10b981;
  --orange:      #f59e0b;
  --red:         #ef4444;
  --gray-light:  #f8fafc;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.1);
  --radius:      .75rem;
}

/* ---- Base ---- */
body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: .9rem; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--blue-deep); }
.section-title { font-size: 1.2rem; font-weight: 700; color: var(--blue-deep); }

/* ---- Navbar ---- */
.navbar { background: var(--blue-deep) !important; }
.navbar-brand { letter-spacing: -.02em; }

/* ---- HERO ---- */
.hero-section {
  background: linear-gradient(135deg, var(--blue-deep) 0%, var(--blue-mid) 60%, #1d4ed8 100%);
  position: relative; overflow: hidden;
}
.hero-section::after {
  content: ''; position: absolute; right: -80px; top: -80px;
  width: 350px; height: 350px; border-radius: 50%;
  background: rgba(255,255,255,.04); pointer-events: none;
}
.stat-card { min-width: 120px; }

/* ---- Cards ---- */
.card { border-radius: var(--radius) !important; }
.menu-card { transition: transform .15s, box-shadow .15s; }
.menu-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md) !important; }

/* ---- Allergen conflict highlight ---- */
.allergen-conflict { background: rgba(239,68,68,.07) !important; border-left: 3px solid var(--red) !important; }

/* ---- Price badge ---- */
.price-badge {
  background: linear-gradient(135deg, var(--blue-deep), var(--blue-mid));
  color: #fff; padding: 2px 10px; border-radius: 20px;
  font-weight: 700; font-size: .82rem; white-space: nowrap;
}

/* ---- Avatar ---- */
.avatar-xs, .avatar-sm, .avatar-lg {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; background: var(--blue-mid); color: #fff; flex-shrink: 0;
}
.avatar-xs { width: 28px; height: 28px; font-size: .7rem; }
.avatar-sm { width: 36px; height: 36px; font-size: .78rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }

/* ---- Icon circle ---- */
.icon-circle {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Buttons ---- */
.btn-primary   { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn-primary:hover { background: #1e3a9a; border-color: #1e3a9a; }
.btn-xs { padding: .2rem .55rem; font-size: .75rem; border-radius: .35rem; }

/* ---- KPI Cards (Admin) ---- */
.kpi-card { border-radius: var(--radius) !important; transition: transform .15s; }
.kpi-card:hover { transform: translateY(-3px); }
.kpi-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; }

/* ---- Sidebar badge pills ---- */
.sidebar-link .badge { padding: .25em .55em; }

/* ---- Tables ---- */
.table { border-radius: var(--radius); overflow: hidden; }
.table th { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---- Footer ---- */
.footer { border-top: 1px solid rgba(255,255,255,.06); }

/* ---- Form controls ---- */
.form-control:focus, .form-select:focus { border-color: var(--blue-mid); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

/* ---- Week calendar ---- */
.opacity-60 { opacity: .6 !important; }

/* ---- Menu item row hover ---- */
.menu-item-row { transition: background .1s; }
.menu-item-row:hover { background: rgba(30,58,138,.04); }

/* ============ DARK MODE ============ */
[data-bs-theme="dark"] {
  --bs-body-bg:    #0f172a;
  --bs-body-color: #e2e8f0;
  --bs-border-color: rgba(255,255,255,.12);
  color-scheme: dark;
}
/* Fond et texte de base */
[data-bs-theme="dark"] body         { background: #0f172a; color: #e2e8f0; }
[data-bs-theme="dark"] .navbar      { background: #0a0f1e !important; border-bottom: 1px solid rgba(255,255,255,.06); }
[data-bs-theme="dark"] .navbar-brand,
[data-bs-theme="dark"] .nav-link    { color: #e2e8f0 !important; }
/* Cards */
[data-bs-theme="dark"] .card        { background: #1e293b !important; border-color: rgba(255,255,255,.08) !important; }
[data-bs-theme="dark"] .card-header { background: #1a2540 !important; color: #e2e8f0 !important; }
[data-bs-theme="dark"] .bg-light    { background: #1e293b !important; color: #e2e8f0 !important; }
/* Tables */
[data-bs-theme="dark"] .table                    { color: #e2e8f0; }
[data-bs-theme="dark"] .table-light th            { background: #1a2540 !important; color: #94a3b8 !important; }
[data-bs-theme="dark"] .table-hover tbody tr:hover{ background: rgba(255,255,255,.04); }
[data-bs-theme="dark"] .table > :not(:first-child) { border-top-color: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .table td, [data-bs-theme="dark"] .table th { border-color: rgba(255,255,255,.07); }
/* Forms */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  background: #0f172a; border-color: rgba(255,255,255,.15); color: #e2e8f0;
}
[data-bs-theme="dark"] .form-control::placeholder { color: #64748b; }
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus { background: #0f172a; color: #e2e8f0; border-color: #3b82f6; }
[data-bs-theme="dark"] .form-label,
[data-bs-theme="dark"] .form-text  { color: #94a3b8; }
[data-bs-theme="dark"] .form-check-label { color: #e2e8f0; }
/* Textes et titres */
[data-bs-theme="dark"] .text-muted  { color: #94a3b8 !important; }
[data-bs-theme="dark"] .text-dark   { color: #e2e8f0 !important; }
[data-bs-theme="dark"] .text-body   { color: #e2e8f0 !important; }
[data-bs-theme="dark"] .page-title,
[data-bs-theme="dark"] .section-title { color: #93c5fd; }
[data-bs-theme="dark"] h1,[data-bs-theme="dark"] h2,[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,[data-bs-theme="dark"] h5,[data-bs-theme="dark"] h6 { color: #f1f5f9; }
[data-bs-theme="dark"] small, [data-bs-theme="dark"] .small { color: #94a3b8; }
/* Dropdowns */
[data-bs-theme="dark"] .dropdown-menu  { background: #1e293b; border-color: rgba(255,255,255,.1); }
[data-bs-theme="dark"] .dropdown-item  { color: #e2e8f0; }
[data-bs-theme="dark"] .dropdown-item:hover { background: rgba(255,255,255,.08); color: #fff; }
[data-bs-theme="dark"] .dropdown-divider { border-color: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .dropdown-header  { color: #94a3b8; }
/* List groups */
[data-bs-theme="dark"] .list-group-item { background: #1e293b; border-color: rgba(255,255,255,.08); color: #e2e8f0; }
/* Alerts avec bon contraste */
[data-bs-theme="dark"] .alert-info    { background: rgba(59,130,246,.2); border-color: rgba(59,130,246,.4); color: #bfdbfe; }
[data-bs-theme="dark"] .alert-warning { background: rgba(245,158,11,.18); border-color: rgba(245,158,11,.4); color: #fde68a; }
[data-bs-theme="dark"] .alert-success { background: rgba(16,185,129,.18); border-color: rgba(16,185,129,.4); color: #a7f3d0; }
[data-bs-theme="dark"] .alert-danger  { background: rgba(239,68,68,.18); border-color: rgba(239,68,68,.4); color: #fca5a5; }
/* Badges */
[data-bs-theme="dark"] .badge.bg-light { background: #334155 !important; color: #e2e8f0 !important; }
[data-bs-theme="dark"] .badge.text-dark { color: #f1f5f9 !important; }
/* KPI & admin */
[data-bs-theme="dark"] .kpi-card      { background: #1e293b !important; }
[data-bs-theme="dark"] .admin-sidebar { background: #0a0f1e !important; }
[data-bs-theme="dark"] .admin-sidebar .sidebar-link { color: #94a3b8; }
[data-bs-theme="dark"] .admin-sidebar .sidebar-link:hover,
[data-bs-theme="dark"] .admin-sidebar .sidebar-link.active { color: #fff; background: rgba(255,255,255,.06); }
/* Sections spéciales */
[data-bs-theme="dark"] .hero-section  { background: linear-gradient(135deg, #0a0f1e 0%, #1e3a8a 100%); }
[data-bs-theme="dark"] .footer        { background: #0a0f1e !important; color: #94a3b8; }
/* Boutons outline */
[data-bs-theme="dark"] .btn-outline-secondary { color: #94a3b8; border-color: #475569; }
[data-bs-theme="dark"] .btn-outline-secondary:hover { background: #334155; color: #fff; border-color: #475569; }
[data-bs-theme="dark"] .btn-outline-primary { color: #93c5fd; border-color: #3b82f6; }
[data-bs-theme="dark"] .btn-outline-primary:hover { background: #1e3a8a; color: #fff; }
/* Scrollbar */
[data-bs-theme="dark"] ::-webkit-scrollbar       { width: 6px; background: #0f172a; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .hero-section  { padding: 2rem 0 !important; }
  .display-5     { font-size: 1.5rem !important; }
  .page-title    { font-size: 1.2rem; }
  .kpi-card .h2  { font-size: 1.4rem; }
  /* Tables scrollables sur mobile */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .table td, .table th { font-size: .82rem; }
  /* Cards full width */
  .col-md-6, .col-lg-4, .col-lg-8 { padding-left: .75rem; padding-right: .75rem; }
  /* Sol-bar sur mobile */
  .sol-bar { flex-wrap: wrap; gap: 6px !important; padding: 8px 10px !important; }
  .sol-bar .sg { font-size: .78rem; }
  .sol-bar .sa { width: 100%; justify-content: space-between; }
  /* Boutons dans week-grid */
  .btn-cmd { font-size: .73rem; padding: 6px 4px; }
  /* Week grid mobile scroll */
  .week-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
/* Thème clair : s'assurer que le contraste est correct */
[data-bs-theme="light"] body          { background: #f8fafc; color: #1e293b; }
[data-bs-theme="light"] .text-muted   { color: #64748b !important; }
[data-bs-theme="light"] .card         { background: #fff; }
[data-bs-theme="light"] .table        { color: #1e293b; }
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select  { color: #1e293b; background: #fff; }

/* ============ ANIMATIONS ============ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeInUp .2s ease-out; }
.alert { animation: fadeInUp .15s ease-out; }

/* ============ PRINT ============ */
@media print {
  .navbar, .footer, .btn, .alert-dismissible .btn-close { display: none !important; }
  .admin-sidebar { display: none !important; }
  .admin-content { margin-left: 0 !important; }
  .card { break-inside: avoid; }
}
