/* ============================================================
   Restaurante Self-Service — Design System v3.0
   Mobile-first · Bootstrap 5 · Inter font
   ============================================================ */

/* ── Variáveis ───────────────────────────────────────────── */
:root {
  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --success:      #16a34a;
  --danger:       #dc2626;
  --warning:      #d97706;
  --info:         #0891b2;
  --accent:       #0ea5e9;   /* sky-500 — telas do garçom */
  --accent-dark:  #0284c7;
  --navy:         #1e293b;   /* slate-800 — cards produto */
  --dark:         #0f172a;
  --gray-50:      #f8fafc;
  --gray-100:     #f1f5f9;
  --gray-200:     #e2e8f0;
  --gray-300:     #cbd5e1;
  --gray-500:     #64748b;
  --gray-700:     #334155;
  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:    0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:    0 12px 24px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl:    0 20px 40px rgba(0,0,0,.14);
  --transition:   .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 80px;
}

/* ── Navbar topo ─────────────────────────────────────────── */
.navbar {
  background: var(--primary) !important;
  padding: 0.55rem 1rem;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.navbar-brand {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.3px;
}

/* Avatar de usuário no navbar */
.user-avatar-nav {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(255,255,255,.35);
  letter-spacing: -.5px;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* ── Bottom Navigation ───────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
  z-index: 1040;
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .5rem .2rem;
  text-decoration: none;
  color: var(--gray-500);
  font-size: .67rem;
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
  gap: 2px;
}
.bottom-nav-item i { font-size: 1.25rem; }
.bottom-nav-item.active,
.bottom-nav-item:hover { color: var(--primary); }
.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2.5px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}
.bottom-nav-badge {
  position: absolute;
  top: .28rem; right: calc(50% - 1.2rem);
  background: var(--danger);
  color: #fff;
  font-size: .52rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  border-bottom: 1px solid var(--gray-200);
  background: #fff;
  padding: .9rem 1.2rem;
  font-size: .9rem;
}

/* ── Mesas ───────────────────────────────────────────────── */
.card-mesa {
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 2px solid transparent;
  overflow: hidden;
}
.card-mesa:active  { transform: scale(.96); }
.card-mesa:hover   { box-shadow: var(--shadow-lg); }

.mesa-livre      { border-color: #bbf7d0; background: #f0fdf4; }
.mesa-ocupada    { border-color: #fecaca; background: #fff5f5; }
.mesa-fechamento { border-color: #fde68a; background: #fffbeb; }

.mesa-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.mesa-livre      .mesa-status-dot { background: var(--success); }
.mesa-ocupada    .mesa-status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.2); }
.mesa-fechamento .mesa-status-dot { background: var(--warning); box-shadow: 0 0 0 3px rgba(217,119,6,.2); }

.mesa-numero {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1;
}
.mesa-valor {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--success);
}
.mesa-livre-label {
  font-size: .78rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* Mesa tiles (tela garçom) */
.mesa-tile {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  position: relative;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  overflow: hidden;
}
.mesa-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.08);
  opacity: 0;
  transition: opacity .15s;
}
.mesa-tile:hover::after  { opacity: 1; }
.mesa-tile:active { transform: scale(.93); opacity: .9; }
.mesa-tile:hover  { box-shadow: 0 6px 16px rgba(0,0,0,.22); }

.mesa-tile .tile-num  {
  font-size: 1.45rem;
  line-height: 1;
  color: #fff;
  font-weight: 800;
  letter-spacing: -.5px;
}
.mesa-tile .tile-sub  {
  font-size: .52rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.75);
  margin-bottom: 3px;
  font-weight: 600;
}
.mesa-tile .tile-lock {
  position: absolute;
  top: 5px; left: 6px;
  font-size: .68rem;
  color: rgba(255,255,255,.8);
}
.mesa-tile .tile-valor {
  font-size: .58rem;
  color: rgba(255,255,255,.9);
  margin-top: 3px;
  font-weight: 600;
}

.tile-verde {
  background: linear-gradient(145deg, #22c55e 0%, #16a34a 100%);
}
.tile-amarelo {
  background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
}
.tile-cinza {
  background: linear-gradient(145deg, #94a3b8 0%, #64748b 100%);
}

/* ── Botões de Categoria / Produto ──────────────────────── */
.btn-categoria {
  height: 80px;
  font-size: .95rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: 2px solid var(--primary);
  color: var(--primary);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all var(--transition);
  line-height: 1.2;
  padding: .5rem;
}
.btn-categoria:hover,
.btn-categoria:active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(.97);
}

.btn-produto {
  min-height: 90px;
  font-weight: 700;
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
  background: #fff;
  color: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .7rem .5rem;
  transition: all var(--transition);
  gap: 4px;
}
.btn-produto:hover,
.btn-produto:active {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: scale(.97);
}
.btn-produto .produto-nome  { font-size: .95rem; line-height: 1.2; }
.btn-produto .produto-preco { font-size: .8rem; color: var(--success); font-weight: 600; }

/* ── Contador de quantidade ──────────────────────────────── */
.qty-control {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.qty-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  background: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  user-select: none;
}
.qty-btn:hover  { background: var(--gray-100); border-color: var(--primary); }
.qty-btn:active { background: var(--gray-100); transform: scale(.9); }
.qty-display {
  font-size: 1.6rem;
  font-weight: 800;
  min-width: 52px;
  text-align: center;
}

/* ── Tela de Cozinha — Kanban ────────────────────────────── */
.card-pedido {
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card-pedido:hover { box-shadow: var(--shadow-lg); }

.card-pedido.status-Novo     { border-top: 4px solid var(--info); }
.card-pedido.status-Em-preparo { border-top: 4px solid var(--primary); }

@keyframes pulse-new {
  0%   { box-shadow: 0 0 0 0  rgba(8,145,178,.4); }
  70%  { box-shadow: 0 0 0 8px rgba(8,145,178,0);  }
  100% { box-shadow: 0 0 0 0  rgba(8,145,178,0);   }
}
.card-pedido.status-Novo { animation: pulse-new 2.5s infinite; }

.pedido-mesa-badge {
  font-size: .92rem;
  font-weight: 800;
  padding: .28rem .65rem;
  border-radius: var(--radius-xs);
  background: var(--dark);
  color: #fff;
  letter-spacing: .3px;
}
.pedido-tempo {
  font-size: .75rem;
  color: var(--gray-500);
  font-weight: 500;
}
.pedido-produto {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.2;
  margin: .3rem 0;
}
.pedido-obs {
  background: #fffbeb;
  border-left: 3px solid var(--warning);
  padding: .4rem .6rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .82rem;
  color: var(--gray-700);
}
.pedido-atendente {
  font-size: .78rem;
  color: var(--gray-500);
}

/* Barra de progresso temporal (cozinha) */
.kcard-timer-bar {
  height: 3px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
  margin: 2px 0 6px;
}
.kcard-timer-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 5s linear;
}

/* ── Dashboard Cards (Admin) ─────────────────────────────── */
.stat-card {
  border-radius: var(--radius);
  padding: 1.3rem 1.2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.stat-card-body { flex: 1; min-width: 0; }
.stat-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .88;
  font-weight: 600;
  margin-bottom: .2rem;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.5px;
}
.stat-icon-wrap {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
}
/* mantém compatibilidade com stat-icon antigo */
.stat-icon { display: none; }

/* ── Atalhos Admin ───────────────────────────────────────── */
.shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none !important;
  padding: 1.4rem 1rem;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  color: var(--dark);
  height: 100%;
}
.shortcut-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  color: var(--dark);
}
.shortcut-card:active { transform: translateY(-1px) scale(.98); }
.shortcut-icon-wrap {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.45rem;
  margin-bottom: .75rem;
}
.shortcut-label { font-weight: 700; font-size: .9rem; }
.shortcut-desc  { font-size: .72rem; color: var(--gray-500); margin-top: .15rem; }

/* ── Login ───────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute;
  top: -30%; left: -20%;
  width: 60%; height: 70%;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}
.login-wrapper::after {
  content: '';
  position: absolute;
  bottom: -20%; right: -15%;
  width: 50%; height: 60%;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 2.2rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  animation: fadeSlideUp .45s cubic-bezier(.22,.68,0,1.1);
  position: relative;
  z-index: 1;
}
.login-logo {
  width: 60px; height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem;
  color: #fff;
  margin: 0 auto .8rem;
  box-shadow: 0 8px 20px rgba(37,99,235,.3);
}
.login-title  { font-size: 1.45rem; font-weight: 800; color: var(--dark); letter-spacing: -.3px; }
.login-sub    { font-size: .88rem; color: var(--gray-500); margin-bottom: 1.6rem; }

/* ── Forms ───────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-200);
  padding: .65rem .9rem;
  font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-label { font-weight: 600; font-size: .88rem; color: var(--gray-700); margin-bottom: .3rem; }

/* ── Botões ──────────────────────────────────────────────── */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: inherit;
  letter-spacing: .01em;
  transition: all var(--transition);
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-enviar {
  width: 100%;
  padding: .9rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .04em;
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  transition: all var(--transition);
}
.btn-enviar:hover { box-shadow: 0 6px 20px rgba(37,99,235,.45); transform: translateY(-1px); }

/* ── Listagem de itens do pedido ─────────────────────────── */
.item-pedido {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.item-pedido:last-child { border-bottom: none; }
.item-nome  { font-weight: 700; font-size: .95rem; }
.item-obs   { font-size: .78rem; color: var(--gray-500); }
.item-preco { font-weight: 700; color: var(--gray-700); white-space: nowrap; }

/* Badges de status */
.badge-novo     { background: #e0f2fe; color: #0369a1; }
.badge-preparo  { background: #dbeafe; color: var(--primary-dark); }
.badge-pronto   { background: #dcfce7; color: #166534; }
.badge-entregue { background: var(--gray-100); color: var(--gray-500); }

/* ── Caixa ───────────────────────────────────────────────── */
.total-destaque {
  font-size: 2rem;
  font-weight: 800;
  color: var(--success);
  letter-spacing: -.5px;
}

/* ── Tabelas Admin ───────────────────────────────────────── */
.table { font-size: .88rem; }
.table thead th {
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
  padding: .75rem 1rem;
  white-space: nowrap;
}
.table td { padding: .75rem 1rem; vertical-align: middle; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--gray-50); }

/* ── Flash messages ──────────────────────────────────────── */
#msg-flash {
  border-radius: var(--radius-sm);
  font-weight: 500;
  border: none;
  margin-bottom: 1rem;
}

/* ── Skeleton loader ─────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-line {
  background: linear-gradient(90deg, #f0f4f8 25%, #e2e8f0 50%, #f0f4f8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
  height: 14px;
}

/* ── Animação: borda pulsante (seção prontos) ────────────── */
@keyframes pulseBorder {
  0%, 100% { box-shadow: 0 0 0 0   rgba(22,163,74,.2); }
  50%       { box-shadow: 0 0 0 8px rgba(22,163,74,0);  }
}
.prontos-container { animation: pulseBorder 2.2s ease-in-out infinite; }

/* ── Scrollbar suave ─────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--gray-200) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }

/* ── Utilitários ─────────────────────────────────────────── */
.text-success-dark { color: #166534; }
.bg-success-soft   { background: #dcfce7; }
.bg-danger-soft    { background: #fee2e2; }
.bg-warning-soft   { background: #fef3c7; }
.bg-info-soft      { background: #e0f2fe; }
.rounded-xl        { border-radius: var(--radius) !important; }
.fw-800            { font-weight: 800 !important; }
.fw-700            { font-weight: 700 !important; }
.fw-600            { font-weight: 600 !important; }

/* ── Garçom: cabeçalho azul ──────────────────────────────── */
.garcom-page-header {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  margin: -1rem -0.75rem 0.75rem -0.75rem;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 2px 8px rgba(2,132,199,.2);
}
.garcom-page-header h1  { font-size: 1.1rem; font-weight: 700; margin: 0; flex: 1; letter-spacing: -.2px; }
.garcom-page-header .back-btn { color: #fff; font-size: 1.2rem; text-decoration: none; line-height: 1; opacity: .9; }
.garcom-page-header .back-btn:hover { opacity: 1; }
.garcom-page-header .prod-preco {
  font-size: .85rem;
  background: rgba(0,0,0,.18);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  font-weight: 600;
}

@media (min-width: 768px) {
  .garcom-page-header {
    margin: 0 0 1rem 0;
    border-radius: var(--radius-sm);
  }
}

/* ── Tabelas admin: scroll horizontal em mobile ──────────── */
.card-table { overflow-x: auto; }
@media (max-width: 767px) {
  .card-table .table { min-width: 520px; }
}

/* ── Conteúdo principal ──────────────────────────────────── */
.page-content {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Navbar desktop: links ───────────────────────────────── */
.nav-link-top {
  color: rgba(255,255,255,.82);
  padding: .32rem .65rem;
  border-radius: var(--radius-xs);
  font-size: .855rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .32rem;
  transition: background .14s, color .14s;
  white-space: nowrap;
}
.nav-link-top:hover  { background: rgba(255,255,255,.15); color: #fff; }
.nav-link-top.active { background: rgba(255,255,255,.22); color: #fff; }

/* ── Responsivo ──────────────────────────────────────────── */
@media (max-width: 576px) {
  .container-fluid { padding-left: .75rem; padding-right: .75rem; }
  .stat-value  { font-size: 1.45rem; }
  body { padding-bottom: 72px; }
}

@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none !important; }
}
