/* ============================================================
   FOODCOUNT — Tema moderno
   ============================================================ */

:root {
  --bg:           #f1f5fb;
  --bg-card:      #ffffff;
  --bg-soft:      #eef3fa;
  --text:         #0f1e3a;
  --text-soft:    #64748b;
  --primary:      #2563eb;     /* azul royal */
  --primary-dark: #1d4ed8;
  --secondary:    #0ea5e9;     /* sky */
  --accent:       #06b6d4;     /* cyan */
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --info:         #38bdf8;
  --border:       #dbe4f0;
  --shadow-sm:    0 1px 3px rgba(15,23,42,.06);
  --shadow:       0 10px 30px rgba(15,23,42,.08);
  --shadow-lg:    0 20px 60px rgba(15,23,42,.12);
  --radius:       16px;
  --radius-sm:    10px;
  --gradient:     linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  --gradient-2:   linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 100%);
  --gradient-3:   linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

/* ---------- Sidebar layout ---------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 260px;
  background: #0a1628;
  background-image: linear-gradient(180deg, #0a1628 0%, #0f2447 100%);
  color: #e5e7eb;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.02em;
  padding: .25rem .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.sidebar .brand .logo-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: white;
  box-shadow: 0 6px 18px rgba(37,99,235,.55);
}
.sidebar .nav-section {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6b7280;
  padding: 1rem .75rem .35rem;
}
.sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .7rem .85rem;
  color: #c7cad6;
  border-radius: 10px;
  margin-bottom: .15rem;
  text-decoration: none;
  font-weight: 500;
  font-size: .92rem;
  transition: all .18s ease;
  position: relative;
}
.sidebar a.nav-link i { font-size: 1.05rem; opacity: .85; }
.sidebar a.nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
  transform: translateX(2px);
}
.sidebar a.nav-link.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37,99,235,.4);
}
.sidebar .user-card {
  margin-top: auto;
  padding: .8rem;
  background: rgba(255,255,255,.04);
  border-radius: 12px;
  display: flex; align-items: center; gap: .65rem;
}
.sidebar .user-card .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
}
.sidebar .user-card small { color: #9ca3af; }

.main {
  flex: 1;
  padding: 2rem 2.2rem;
  /* NO se aplica animation/transform/filter/opacity aqui:
     cualquiera de esos crea un "stacking context" o "containing
     block" que rompe los modales de Bootstrap (position: fixed
     deja de anclarse al viewport y queda detras del backdrop). */
}

/* ---------- Animaciones ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes pop {
  0%   { transform: scale(.85); opacity: 0; }
  60%  { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,.55); }
  70%  { box-shadow: 0 0 0 22px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}
@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
@keyframes spinSlow { to { transform: rotate(360deg); } }

/* ---------- Encabezado de página ---------- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-head h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0;
  display: flex; align-items: center; gap: .6rem;
}
.page-head h1 .icon-tile {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--gradient);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 8px 22px rgba(37,99,235,.4);
}
.page-subtitle { color: var(--text-soft); font-size: .92rem; margin-top: .2rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-elevated {
  border: 0;
  box-shadow: var(--shadow);
}
.card-body { padding: 1.4rem; }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.4rem;
  font-weight: 600;
}

/* Stat cards */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card .icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: .8rem;
  color: #fff;
}
.stat-card .icon.g1 { background: var(--gradient); }
.stat-card .icon.g2 { background: var(--gradient-2); }
.stat-card .icon.g3 { background: var(--gradient-3); }
.stat-card .icon.g4 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.stat-card .value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; }
.stat-card .label { color: var(--text-soft); font-size: .85rem; }

/* ---------- Botones ---------- */
.btn {
  font-weight: 600;
  border-radius: 10px;
  padding: .55rem 1.1rem;
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
  border: 0;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 8px 18px rgba(37,99,235,.4);
}
.btn-primary:hover { filter: brightness(1.06); color: white; box-shadow: 0 10px 22px rgba(37,99,235,.55); }
.btn-success {
  background: var(--gradient-3);
  color: white;
  box-shadow: 0 8px 18px rgba(16,185,129,.3);
}
.btn-success:hover { filter: brightness(1.06); color: white; }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #f43f5e);
  color: white;
}
.btn-danger:hover { color: white; filter: brightness(1.06); }
.btn-outline-primary, .btn-outline-secondary, .btn-outline-danger, .btn-outline-success, .btn-outline-warning {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-outline-danger:hover  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-outline-warning:hover { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-link { color: var(--primary); }

/* ---------- Tablas ---------- */
.table {
  margin-bottom: 0;
  --bs-table-bg: transparent;
}
.table thead th {
  background: #f8f9fc;
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border) !important;
  padding: .85rem 1rem;
}
.table tbody td {
  padding: .85rem 1rem;
  border-color: #f1f2f7;
  vertical-align: middle;
}
.table-hover tbody tr { transition: background .15s ease; }
.table-hover tbody tr:hover { background: #fafbff; }

/* ---------- Inputs ---------- */
.form-control, .form-select {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: .55rem .85rem;
  font-size: .95rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}
.form-label { font-weight: 600; font-size: .85rem; color: var(--text); margin-bottom: .3rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ---------- Badges ---------- */
.badge {
  font-weight: 600;
  padding: .35em .65em;
  border-radius: 6px;
  font-size: .72rem;
}
.bg-success { background: rgba(16,185,129,.12) !important; color: #047857 !important; }
.bg-danger  { background: rgba(239,68,68,.12)  !important; color: #b91c1c !important; }
.bg-warning { background: rgba(245,158,11,.15) !important; color: #b45309 !important; }
.bg-info    { background: rgba(6,182,212,.12)  !important; color: #0e7490 !important; }
.bg-primary { background: rgba(37,99,235,.12) !important; color: #1d4ed8 !important; }
.bg-secondary { background: rgba(107,114,128,.15) !important; color: #4b5563 !important; }

/* ---------- Alerts ---------- */
.alert {
  border: 0;
  border-radius: 12px;
  padding: .9rem 1.1rem;
  font-weight: 500;
  animation: fadeUp .4s ease both;
}
.alert-success { background: rgba(16,185,129,.1); color: #047857; }
.alert-danger  { background: rgba(239,68,68,.1);  color: #b91c1c; }
.alert-warning { background: rgba(245,158,11,.12); color: #b45309; }
.alert-info    { background: rgba(6,182,212,.1);  color: #0e7490; }

/* ---------- Modal ---------- */
.modal-content {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--border); padding: 1.1rem 1.4rem; }
.modal-body   { padding: 1.4rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.4rem; }

/* ---------- Login ---------- */
.login-bg {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #2563eb 0%, transparent 40%),
              radial-gradient(circle at 80% 30%, #0ea5e9 0%, transparent 40%),
              radial-gradient(circle at 50% 80%, #06b6d4 0%, transparent 45%),
              #04132c;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.login-bg::before, .login-bg::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
  animation: float 8s ease-in-out infinite;
}
.login-bg::before { background: #2563eb; top: -200px; left: -200px; }
.login-bg::after  { background: #0ea5e9; bottom: -200px; right: -200px; animation-delay: -4s; }

.login-card {
  position: relative;
  z-index: 1;
  max-width: 440px;
  width: 100%;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 2.8rem 2.5rem;
  box-shadow: 0 30px 80px rgba(0,0,0,.3);
  animation: pop .5s ease both;
}
.login-card .logo-mark {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.8rem;
  box-shadow: 0 12px 28px rgba(37,99,235,.55);
  margin: 0 auto 1rem;
}
.login-card h2 {
  text-align: center;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: .25rem;
}
.login-card .sub {
  text-align: center;
  color: var(--text-soft);
  margin-bottom: 2rem;
}
.login-card .btn-primary {
  padding: .75rem;
  font-size: 1rem;
  width: 100%;
  margin-top: .5rem;
}

/* ---------- Avatar / foto empleado ---------- */
.avatar-sm {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.avatar-placeholder {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gradient-2);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .sidebar { position: fixed; left: -260px; z-index: 1000; transition: left .25s; }
  .sidebar.open { left: 0; }
  .main { padding: 1.25rem; }
  .mobile-toggle { display: inline-flex !important; }
}
.mobile-toggle { display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; background: var(--bg-card);
  border: 1px solid var(--border); margin-right: .75rem; cursor: pointer; }
