/* ══════════════════════════════════════════
   Cozinha do Norte — Estilos Globais
   ══════════════════════════════════════════ */

:root {
  --green-dark:  #1a4a1f;
  --green-main:  #2d6a35;
  --green-light: #4a8c52;
  --green-pale:  #e8f5e9;
  --gold:        #c8a951;
  --gold-light:  #f5e6b0;
  --red:         #c0392b;
  --orange:      #e67e22;
  --blue:        #2980b9;
  --bg:          #f4f1ec;
  --white:       #ffffff;
  --text:        #1a1a1a;
  --text-muted:  #666666;
  --border:      #ddd;
  --shadow:      0 2px 12px rgba(0,0,0,0.12);
  --radius:      12px;
  --radius-sm:   8px;
  --sidebar-w:   240px;
  --header-h:    60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all .2s; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--green-main); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f5f5f5; }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-gold      { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #b8943d; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { padding: 8px; border-radius: 50%; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-control {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); font-size: 14px; background: #fff;
  transition: border-color .2s; outline: none;
}
.form-control:focus { border-color: var(--green-main); }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Cards ── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 15px;
}
.card-body { padding: 20px; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.badge-green  { background: var(--green-pale); color: var(--green-dark); }
.badge-red    { background: #fde8e6; color: var(--red); }
.badge-orange { background: #fef0e0; color: var(--orange); }
.badge-blue   { background: #e0f0ff; color: var(--blue); }
.badge-gray   { background: #f0f0f0; color: #666; }
.badge-gold   { background: var(--gold-light); color: #8a6c1a; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn .15s;
}
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: slideUp .2s;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #999; line-height: 1; }

/* ── Toast notifications ── */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 12px 18px; border-radius: var(--radius-sm); color: #fff;
  font-size: 14px; font-weight: 500; min-width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,.2); animation: slideIn .3s;
  display: flex; align-items: center; gap: 10px;
}
.toast-success { background: var(--green-main); }
.toast-error   { background: var(--red); }
.toast-info    { background: var(--blue); }
.toast-warning { background: var(--orange); }

/* ── Loading ── */
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--green-pale); border-top-color: var(--green-main);
  animation: spin 0.8s linear infinite;
}
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.8);
  z-index: 5000; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
}

/* ── Tables ── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th {
  text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 700;
  color: var(--text-muted); background: var(--bg); border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .5px;
}
table.data-table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #fafafa; }

/* ── Layout SPA ── */
.layout {
  display: flex; min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: var(--green-dark);
  display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100; transition: transform .3s;
}
.sidebar-logo {
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo img { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; }
.sidebar-logo-text { color: #fff; }
.sidebar-logo-text .brand { font-size: 13px; font-weight: 800; line-height: 1.2; }
.sidebar-logo-text .sub { font-size: 10px; color: rgba(255,255,255,.6); }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 4px 16px 4px; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: 1px; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; color: rgba(255,255,255,.75); cursor: pointer;
  font-size: 14px; font-weight: 500; border-left: 3px solid transparent;
  transition: all .15s; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--gold); }
.nav-item .icon { width: 18px; text-align: center; font-size: 16px; }
.sidebar-footer {
  padding: 16px; border-top: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.5); font-size: 12px;
}
.sidebar-user { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.sidebar-user .info .name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user .info .role { font-size: 11px; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}
.topbar {
  height: var(--header-h); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.page-content { padding: 24px; flex: 1; }

/* Mobile sidebar toggle */
.menu-toggle {
  display: none; background: none; border: none; font-size: 22px; cursor: pointer;
  padding: 4px; color: var(--text);
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99;
}

/* ── Stats Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.stat-card .stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--green-dark); }
.stat-card .stat-icon { font-size: 24px; }
.stat-card.gold .stat-value { color: var(--gold); }
.stat-card.red .stat-value  { color: var(--red); }
.stat-card.blue .stat-value { color: var(--blue); }

/* ── Tables Grid (mesas) ── */
.tables-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px;
}
.table-card {
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  text-align: center; transition: all .2s; border: 2px solid transparent;
  background: #fff; box-shadow: var(--shadow);
}
.table-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.table-card.livre   { border-color: var(--green-main); }
.table-card.ocupada { border-color: var(--orange); background: #fff8f0; }
.table-card.conta   { border-color: var(--red); background: #fff0ee; }
.table-card .t-num  { font-size: 28px; font-weight: 800; color: var(--green-dark); }
.table-card .t-name { font-size: 11px; color: var(--text-muted); }
.table-card .t-status { font-size: 12px; margin-top: 4px; }
.table-card .t-total { font-size: 16px; font-weight: 700; color: var(--orange); margin-top: 4px; }

/* ── Menu Cardápio ── */
.menu-categories { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.cat-btn {
  padding: 8px 16px; border-radius: 20px; border: 2px solid var(--border);
  background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.cat-btn.active { background: var(--green-main); color: #fff; border-color: var(--green-main); }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-card {
  background: #fff; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: transform .2s;
}
.product-card:hover { transform: translateY(-2px); }
.product-card img { width: 100%; height: 140px; object-fit: cover; background: var(--bg); }
.product-card .p-body { padding: 14px; }
.product-card .p-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.product-card .p-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.4; }
.product-card .p-footer { display: flex; justify-content: space-between; align-items: center; }
.product-card .p-price { font-size: 18px; font-weight: 800; color: var(--green-main); }
.product-card .p-time  { font-size: 11px; color: var(--text-muted); }

/* ── KDS (Kitchen Display) ── */
.kds-header {
  background: var(--green-dark); color: #fff; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 16px; }
.kds-card {
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  background: #fff; display: flex; flex-direction: column;
}
.kds-card.urgente { border: 2px solid var(--red); animation: pulse-red 1.5s infinite; }
.kds-card.atrasado { border: 2px solid var(--orange); }
.kds-card-header {
  padding: 12px 16px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
.kds-card-header.pendente  { background: var(--green-pale); color: var(--green-dark); }
.kds-card-header.cozinha   { background: #fff3cd; color: #856404; }
.kds-card-header.pronta    { background: #d1ecf1; color: #0c5460; }
.kds-items { flex: 1; padding: 12px 16px; }
.kds-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px;
}
.kds-item:last-child { border-bottom: none; }
.kds-item .qty { font-weight: 800; min-width: 24px; font-size: 16px; color: var(--green-dark); }
.kds-item .item-name { flex: 1; }
.kds-item .item-notes { font-size: 11px; color: var(--orange); font-style: italic; }
.kds-item .item-check { cursor: pointer; font-size: 20px; }
.kds-timer { font-size: 24px; font-weight: 800; }
.kds-timer.normal  { color: var(--green-main); }
.kds-timer.warn    { color: var(--orange); }
.kds-timer.danger  { color: var(--red); }
.kds-card-footer { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* ── Cliente tablet menu ── */
.customer-header {
  background: var(--green-dark); padding: 16px 20px;
  color: #fff; position: sticky; top: 0; z-index: 10;
}
.customer-cart-badge {
  position: relative; display: inline-block;
}
.customer-cart-badge .count {
  position: absolute; top: -8px; right: -8px;
  background: var(--gold); color: #fff; width: 20px; height: 20px;
  border-radius: 50%; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cart-drawer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,.15);
  z-index: 200; transform: translateY(100%); transition: transform .3s;
  max-height: 70vh; overflow-y: auto; padding: 20px;
}
.cart-drawer.open { transform: translateY(0); }

/* ── Animações ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 0 0 rgba(192,57,43,.4); } 50% { box-shadow: 0 0 0 8px rgba(192,57,43,0); } }

/* ── Login page ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-main) 60%, var(--green-light) 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 40px 36px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: slideUp .4s;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { width: 120px; height: auto; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--green-dark); margin-top: 12px; }
.login-logo p { color: var(--text-muted); font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sidebar-overlay.open { opacity: 1; pointer-events: all; }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .kds-grid { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .tables-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .tables-grid { grid-template-columns: repeat(2, 1fr); }
  .products-grid { grid-template-columns: 1fr; }
}

/* ── Misc ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
.online-dot { width:8px; height:8px; border-radius:50%; background:var(--green-light); display:inline-block; }
.offline-dot { width:8px; height:8px; border-radius:50%; background:var(--red); display:inline-block; }

.section { display: none; }
.section.active { display: block; }

.order-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 16px;
}
.order-card-header {
  padding: 14px 16px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--border);
}
.order-items-list { padding: 12px 16px; }
.order-item-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 14px; border-bottom: 1px dashed #f0f0f0;
}
.order-item-row:last-child { border-bottom: none; }
.order-total { padding: 12px 16px; background: var(--bg); font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; }

.payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.pm-btn {
  padding: 14px 8px; border-radius: var(--radius-sm); border: 2px solid var(--border);
  background: #fff; cursor: pointer; text-align: center; transition: all .2s;
  font-size: 12px; font-weight: 600;
}
.pm-btn .pm-icon { font-size: 22px; display: block; margin-bottom: 4px; }
.pm-btn.selected { border-color: var(--green-main); background: var(--green-pale); }
.pm-btn:hover { border-color: var(--green-light); }

.report-chart { display: flex; flex-direction: column; gap: 8px; }
.chart-bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.chart-bar-label { width: 120px; text-align: right; color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-wrap { flex: 1; background: var(--bg); border-radius: 4px; overflow: hidden; height: 22px; }
.chart-bar { height: 100%; background: var(--green-main); border-radius: 4px; transition: width .5s; display: flex; align-items: center; padding: 0 8px; }
.chart-bar-val { font-size: 11px; color: #fff; font-weight: 700; }

.notification-bell { position: relative; cursor: pointer; }
.notification-bell .badge-count {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: #fff; width: 18px; height: 18px;
  border-radius: 50%; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.summary-box {
  background: var(--green-pale); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 16px;
}
.summary-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.summary-row.total { font-weight: 800; font-size: 18px; border-top: 1px solid #ccc; margin-top: 8px; padding-top: 8px; }

/* tab pills */
.tab-pills { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.tab-pill { flex: 1; padding: 8px 4px; text-align: center; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-muted); }
.tab-pill.active { background: #fff; color: var(--green-dark); box-shadow: 0 1px 6px rgba(0,0,0,.1); }
