/* ============================================================
   ECL FRUVER — Design System Responsive
   ============================================================ */

/* ── Variables ── */
:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --info:          #0891b2;
  --dark:          #1e293b;
  --body-bg:       #f1f5f9;
  --card-bg:       #ffffff;
  --border:        #e2e8f0;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --radius:        .75rem;
  --radius-sm:     .5rem;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.12);
  --transition:    .18s ease;
  --navbar-h:      56px;
  --container-px:  1rem;
}
@media (min-width: 768px)  { :root { --container-px: 1.5rem; --navbar-h: 60px; } }
@media (min-width: 1200px) { :root { --container-px: 2rem; } }

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: .9rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; padding: 1rem var(--container-px) 2rem; }
img { max-width: 100%; height: auto; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ══════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════ */
.app-navbar {
  background: var(--dark);
  min-height: var(--navbar-h);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: sticky;
  top: 0;
  z-index: 1030;
  padding: 0 var(--container-px);
}
.app-navbar .navbar-brand {
  color: #fff !important;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -.2px;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 0;
}
.app-navbar .brand-icon {
  width: 30px; height: 30px;
  background: var(--primary);
  border-radius: .45rem;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}

/* Toggler */
.app-navbar .navbar-toggler {
  border: none;
  padding: .4rem .5rem;
  color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.08);
  border-radius: .4rem;
}
.app-navbar .navbar-toggler:focus { box-shadow: none; }
.app-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255%2c255%2c255%2c.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Nav links */
.app-navbar .nav-link {
  color: rgba(255,255,255,.7) !important;
  font-size: .82rem;
  font-weight: 500;
  padding: .45rem .7rem !important;
  border-radius: .4rem;
  transition: background var(--transition), color var(--transition);
  display: flex; align-items: center; gap: .35rem;
  white-space: nowrap;
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
  background: rgba(255,255,255,.12);
  color: #fff !important;
}
.app-navbar .nav-link i { font-size: .9rem; }
.app-navbar .nav-link.nav-danger { color: #fca5a5 !important; }
.app-navbar .nav-link.nav-danger:hover { background: rgba(220,38,38,.25); }

/* Menú colapsado en móvil */
@media (max-width: 991.98px) {
  .app-navbar .navbar-collapse {
    background: var(--dark);
    border-top: 1px solid rgba(255,255,255,.08);
    padding: .5rem 0 .75rem;
    margin: 0 calc(-1 * var(--container-px));
    padding-left: var(--container-px);
    padding-right: var(--container-px);
  }
  .app-navbar .nav-link {
    padding: .6rem .75rem !important;
    border-radius: .4rem;
    font-size: .88rem;
  }
  .app-navbar .navbar-nav { gap: .15rem; }
}

/* ══════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.page-title {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  color: var(--dark);
  margin: 0;
  display: flex; align-items: center; gap: .5rem;
}
.page-title i { color: var(--primary); }

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.1rem;
  font-weight: 600;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
}
.card-body { padding: 1.1rem; }
@media (max-width: 575.98px) {
  .card-header { padding: .75rem .9rem; }
  .card-body   { padding: .9rem; }
}

/* ══════════════════════════════════════════
   STAT CARDS
══════════════════════════════════════════ */
.stat-card {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: .85rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 44px; height: 44px; border-radius: .6rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: var(--primary); }
.stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-icon.amber  { background: #fffbeb; color: var(--warning); }
.stat-icon.cyan   { background: #ecfeff; color: var(--info); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-value {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 700; line-height: 1;
}
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

@media (max-width: 575.98px) {
  .stat-card { padding: .75rem 1rem; gap: .65rem; }
  .stat-icon { width: 38px; height: 38px; font-size: 1.1rem; }
}

/* ══════════════════════════════════════════
   TABLES — responsive con scroll horizontal
══════════════════════════════════════════ */
.table-responsive { -webkit-overflow-scrolling: touch; }
.table { font-size: .85rem; margin-bottom: 0; }
.table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  padding: .6rem .9rem;
  white-space: nowrap;
}
.table tbody td {
  padding: .65rem .9rem;
  vertical-align: middle;
  border-color: var(--border);
}
.table-hover tbody tr:hover { background: #f8fafc; }
.table-sm thead th { padding: .4rem .65rem; }
.table-sm tbody td { padding: .4rem .65rem; }

/* En móvil: reducir padding de tabla */
@media (max-width: 575.98px) {
  .table { font-size: .8rem; }
  .table thead th { padding: .5rem .6rem; font-size: .7rem; }
  .table tbody td { padding: .5rem .6rem; }
}

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  font-weight: 500;
  font-size: .875rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: .35rem;
  touch-action: manipulation;
}
.btn-primary   { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success   { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }
.btn-sm { font-size: .78rem; padding: .28rem .6rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; flex-shrink: 0; }

/* Botones táctiles más grandes en móvil */
@media (max-width: 767.98px) {
  .btn { min-height: 38px; }
  .btn-sm { min-height: 32px; }
  .btn-icon { width: 36px; height: 36px; }
}

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  padding: .5rem .85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: #fff;
  -webkit-appearance: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  outline: none;
}
.form-label { font-size: .82rem; font-weight: 600; color: var(--text-muted); margin-bottom: .35rem; }
.input-group-text {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--text-muted);
  font-size: .875rem;
}
/* Inputs más grandes en móvil para evitar zoom en iOS */
@media (max-width: 767.98px) {
  .form-control, .form-select { font-size: 16px; }
}

/* ══════════════════════════════════════════
   BADGES & ALERTS
══════════════════════════════════════════ */
.badge { font-weight: 600; font-size: .7rem; border-radius: .35rem; padding: .28em .55em; }
.alert { border-radius: var(--radius-sm); font-size: .875rem; border: none; }
.alert-info    { background: #eff6ff; color: #1d4ed8; }
.alert-success { background: #f0fdf4; color: #15803d; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-danger  { background: #fef2f2; color: #991b1b; }

/* ══════════════════════════════════════════
   MESA CARDS
══════════════════════════════════════════ */
.mesa-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
  height: 100%;
}
.mesa-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
  transition: background var(--transition);
}
.mesa-card.libre::before     { background: var(--success); }
.mesa-card.ocupada::before   { background: var(--warning); }
.mesa-card.reservada::before { background: var(--info); }
.mesa-card.bloqueada::before { background: var(--danger); }
.mesa-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.mesa-numero { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 800; color: var(--dark); }
.mesa-desc   { font-size: .75rem; color: var(--text-muted); min-height: 1rem; }
.estado-badge {
  position: absolute; top: .65rem; right: .65rem;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}

/* ══════════════════════════════════════════
   OFFCANVAS PEDIDO
══════════════════════════════════════════ */
#canvasPedido { width: min(520px, 100vw) !important; }
#canvasPedido .offcanvas-header {
  background: var(--dark);
  color: #fff;
  padding: .8rem 1.1rem;
  flex-shrink: 0;
}
#canvasPedido .offcanvas-header .btn-close { filter: invert(1) opacity(.8); }
#canvasPedido .offcanvas-title { font-size: .95rem; font-weight: 700; }
#canvasPedido .offcanvas-body  { padding: 0; overflow: hidden; }

.pedido-layout { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

/* Catálogo — altura adaptable */
.catalogo-panel {
  flex: 0 0 auto;
  height: 50%;
  min-height: 180px;
  max-height: 55%;
  display: flex; flex-direction: column;
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
}
.catalogo-search {
  padding: .6rem .75rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.catalogo-grid {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .4rem .6rem .6rem;
  flex: 1 1 auto;
}

/* Tiles de producto */
.prod-tile {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .55rem;
  background: #fff;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  user-select: none;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}
.prod-tile:hover  { background: var(--primary-light); border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.1); }
.prod-tile:active { transform: scale(.96); }
.prod-tile .prod-nombre { font-size: .8rem; font-weight: 600; line-height: 1.2; color: var(--dark); }
.prod-tile .prod-codigo { font-size: .65rem; color: var(--text-muted); margin-bottom: .15rem; }
.prod-tile .prod-precio { font-size: .68rem; margin-top: .25rem; }

/* Panel pedido */
.pedido-panel {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: #fff;
}
.pedido-items {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}
.pedido-footer {
  padding: .65rem .9rem;
  border-top: 2px solid var(--border);
  background: #f8fafc;
  flex-shrink: 0;
}

/* En pantallas muy pequeñas ajustar proporción */
@media (max-height: 600px) {
  .catalogo-panel { height: 45%; min-height: 150px; }
}
@media (max-width: 400px) {
  .catalogo-grid .col-6 { width: 50%; }
  .prod-tile { padding: .4rem; }
  .prod-tile .prod-nombre { font-size: .75rem; }
}

/* ══════════════════════════════════════════
   COCINA
══════════════════════════════════════════ */
.cocina-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: #fff;
  transition: box-shadow var(--transition);
}
.cocina-card:hover { box-shadow: var(--shadow); }
.cocina-card .product-name { font-weight: 700; font-size: .95rem; }
.cocina-card .meta { color: var(--text-muted); font-size: .78rem; }
.cocina-note {
  background: #fef2f2;
  border: 1px solid rgba(220,38,38,.2);
  color: #b91c1c;
  border-radius: .4rem;
  padding: .3rem .55rem;
  font-weight: 600;
  font-size: .82rem;
}
.empty-state {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 2rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

/* ══════════════════════════════════════════
   LOGIN
══════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.login-card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.75rem;
  width: 100%; max-width: 400px;
}
.login-logo {
  width: 52px; height: 52px; border-radius: .7rem;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin: 0 auto 1rem;
}

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.app-footer {
  background: var(--dark);
  color: rgba(255,255,255,.4);
  font-size: .75rem;
  padding: .75rem var(--container-px);
  text-align: center;
  flex-shrink: 0;
}
.app-footer strong { color: rgba(255,255,255,.65); }

/* ══════════════════════════════════════════
   MODALES — mejor en móvil
══════════════════════════════════════════ */
@media (max-width: 575.98px) {
  .modal-dialog { margin: .5rem; }
  .modal-content { border-radius: var(--radius); }
  .modal-header { padding: .85rem 1rem; }
  .modal-body   { padding: 1rem; }
  .modal-footer { padding: .75rem 1rem; }
}

/* ══════════════════════════════════════════
   SWEETALERT2 — ajustes táctiles
══════════════════════════════════════════ */
.swal2-popup { border-radius: var(--radius) !important; font-size: .9rem !important; }
.swal2-confirm, .swal2-cancel, .swal2-deny {
  border-radius: var(--radius-sm) !important;
  font-size: .875rem !important;
  min-height: 38px !important;
}
@media (max-width: 575.98px) {
  .swal2-popup { width: 92vw !important; padding: 1.25rem !important; }
}

/* ══════════════════════════════════════════
   UTILIDADES
══════════════════════════════════════════ */
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.text-primary { color: var(--primary) !important; }
.rounded-xl   { border-radius: var(--radius) !important; }
.gap-xs       { gap: .35rem !important; }
.overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Ocultar texto en botones pequeños en móvil */
@media (max-width: 575.98px) {
  .btn-label-sm { display: none; }
}
