/* ============================================================
   app.css - Estilos Globais - Cardápio Virtual
   ============================================================ */
:root {
  --primary: #f97316;
  --primary-dark: #ea6c0a;
  --primary-light: #fed7aa;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: .2s ease;
  --font-body: 'Inter', sans-serif;
  --font-heading: 'Poppins', sans-serif;
}
html.dark {
  --bg: #0f172a; --bg-card: #1e293b; --bg-nav: #1e293b;
  --text: #f1f5f9; --text-muted: #94a3b8; --border: #334155;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body); background: var(--bg); color: var(--text);
  min-height: 100vh; line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 100; background: var(--bg-nav);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 0 1.5rem; height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: var(--primary);
  display: flex; align-items: center; gap: .5rem;
}
.navbar-brand img { height: 40px; width: auto; object-fit: contain; }
.navbar-actions { display: flex; align-items: center; gap: .75rem; }

/* ---- Botões ---- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1.25rem;
  border-radius: var(--radius-sm); border: none; font-size: .9rem; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--text-muted); color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.75rem; font-size: 1rem; }
.btn-icon { padding: .5rem; border-radius: 50%; width: 36px; height: 36px; justify-content: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-body  { padding: 1.5rem; }
.card-footer{ padding: 1rem 1.5rem; border-top: 1px solid var(--border); }

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; padding: 4rem 1.5rem; text-align: center;
}
.hero h1 { font-family: var(--font-heading); font-size: 2.5rem; font-weight: 700; margin-bottom: 1rem; }
.hero p  { font-size: 1.1rem; opacity: .9; max-width: 560px; margin: 0 auto 2rem; }

/* ---- Menu público ---- */
.categories-bar {
  display: flex; gap: .5rem; overflow-x: auto; padding: 1rem 1.5rem;
  scrollbar-width: none; position: sticky; top: 64px; z-index: 90;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.categories-bar::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; padding: .45rem 1.1rem; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--bg-card);
  font-size: .88rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.cat-tab:hover, .cat-tab.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.products-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem; padding: 1.5rem;
}
.product-card {
  background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); transition: var(--transition); overflow: hidden;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.product-card-img {
  width: 100%; height: 180px; object-fit: cover; background: var(--border);
}
.product-card-img-placeholder {
  width: 100%; height: 180px; background: linear-gradient(135deg,#f1f5f9,#e2e8f0);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 2.5rem;
}
.product-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; }
.product-card-name { font-weight: 600; font-size: 1rem; margin-bottom: .35rem; }
.product-card-desc { font-size: .85rem; color: var(--text-muted); flex: 1; margin-bottom: .75rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-footer { display: flex; align-items: center; justify-content: space-between; }
.product-price { font-size: 1.15rem; font-weight: 700; color: var(--primary); }
.add-btn { background: var(--primary); color: #fff; border: none; border-radius: 50%; width: 36px; height: 36px; font-size: 1.1rem; cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.add-btn:hover { background: var(--primary-dark); transform: scale(1.1); }

/* ---- Carrinho ---- */
.cart-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200;
  width: 60px; height: 60px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 1.4rem; border: none; cursor: pointer; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.cart-fab:hover { transform: scale(1.1); background: var(--primary-dark); }
.cart-badge {
  position: absolute; top: -6px; right: -6px; background: #ef4444;
  color: #fff; border-radius: 50%; width: 22px; height: 22px;
  font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.cart-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 500; font-size: .9rem; }
.cart-item-price { font-size: .85rem; color: var(--text-muted); }
.qty-controls { display: flex; align-items: center; gap: .5rem; }
.qty-btn { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--bg); font-size: .9rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-value { min-width: 28px; text-align: center; font-weight: 600; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; }
.close-btn { background: none; border: none; font-size: 1.25rem; color: var(--text-muted); cursor: pointer; padding: .25rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: .4rem; color: var(--text); }
.form-control {
  width: 100%; padding: .6rem 1rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
  font-size: .95rem; font-family: inherit; transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,115,22,.15); }
.form-control::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* ---- Toast ---- */
.toast-container { position: fixed; bottom: 5rem; right: 1rem; z-index: 500; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  padding: .75rem 1.25rem; border-radius: var(--radius-sm); color: #fff;
  font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-md);
  animation: slideRight .3s ease; display: flex; align-items: center; gap: .5rem; min-width: 220px;
}
.toast-success { background: #22c55e; }
.toast-error   { background: #ef4444; }
.toast-warning { background: #f59e0b; }
.toast-info    { background: #3b82f6; }

/* ---- Status badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
}
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-preparing { background: #dbeafe; color: #1e40af; }
.badge-ready     { background: #d1fae5; color: #065f46; }
.badge-delivered { background: #e0e7ff; color: #3730a3; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-paid      { background: #dcfce7; color: #166534; }
.badge-unpaid    { background: #fef9c3; color: #854d0e; }

/* ---- Timeline de status ---- */
.status-timeline { display: flex; align-items: center; gap: 0; margin: 1rem 0; overflow-x: auto; }
.status-step {
  display: flex; flex-direction: column; align-items: center; flex: 1;
  position: relative; min-width: 70px;
}
.status-step::before {
  content: ''; position: absolute; top: 14px; left: calc(50% + 14px);
  right: calc(-50% + 14px); height: 2px; background: var(--border); z-index: 0;
}
.status-step:last-child::before { display: none; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg-card); display: flex; align-items: center; justify-content: center;
  font-size: .75rem; z-index: 1; margin-bottom: .35rem;
}
.status-step.done .step-dot   { background: var(--primary); border-color: var(--primary); color: #fff; }
.status-step.active .step-dot { background: var(--primary); border-color: var(--primary); color: #fff; animation: pulse 1.5s infinite; }
.step-label { font-size: .7rem; color: var(--text-muted); text-align: center; }
.status-step.done .step-label, .status-step.active .step-label { color: var(--primary); font-weight: 600; }

/* ---- Admin Layout ---- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--bg-card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  overflow-y: auto; transition: var(--transition);
}
.sidebar-brand {
  padding: 1.25rem 1.5rem; font-family: var(--font-heading); font-weight: 700;
  font-size: 1.1rem; color: var(--primary); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem;
}
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-item {
  display: flex; align-items: center; gap: .75rem; padding: .65rem 1.5rem;
  color: var(--text-muted); font-size: .9rem; cursor: pointer; transition: var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { color: var(--primary); border-left-color: var(--primary); background: rgba(249,115,22,.07); font-weight: 500; }
.nav-item i { width: 18px; text-align: center; }
.nav-divider { height: 1px; background: var(--border); margin: .5rem 1.5rem; }
.admin-main { margin-left: 240px; flex: 1; padding: 1.5rem; min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.admin-topbar h1 { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; }

/* ---- Stats cards ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 1.25rem;
  border: 1px solid var(--border); display: flex; align-items: flex-start; gap: 1rem; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-icon.orange { background: #fff7ed; color: var(--primary); }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-bottom: .2rem; }
.stat-value { font-size: 1.4rem; font-weight: 700; font-family: var(--font-heading); }

/* ---- Tabela ---- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  text-align: left; padding: .75rem 1rem; font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
  border-bottom: 2px solid var(--border); background: var(--bg);
}
td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--bg); }
tr:last-child td { border-bottom: none; }

/* ---- Kitchen Board ---- */
.kitchen-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 1rem; }
.kitchen-card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.kitchen-card.preparing { border-left: 4px solid #3b82f6; }
.kitchen-card.pending   { border-left: 4px solid #f59e0b; }
.kitchen-card.ready     { border-left: 4px solid #22c55e; }
.kitchen-card-header { padding: .85rem 1rem; background: var(--bg); display: flex; align-items: center; justify-content: space-between; }
.kitchen-card-body   { padding: 1rem; }
.kitchen-item        { display: flex; justify-content: space-between; padding: .35rem 0; font-size: .9rem; border-bottom: 1px dashed var(--border); }
.kitchen-item:last-child { border-bottom: none; }

/* ---- Página de Login ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); padding: 1rem;
}
.login-card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2.5rem; width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 2rem; font-family: var(--font-heading); font-size: 1.75rem; font-weight: 700; color: var(--primary); }

/* ---- Painel de abas ---- */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.tab-btn { padding: .65rem 1.25rem; border: none; background: none; font-size: .9rem; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); white-space: nowrap; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Paginação ---- */
.pagination { display: flex; align-items: center; gap: .35rem; margin-top: 1rem; justify-content: center; }
.page-btn { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--bg-card); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: .85rem; transition: var(--transition); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Upload de imagem ---- */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center;
  cursor: pointer; transition: var(--transition); color: var(--text-muted);
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--primary); background: rgba(249,115,22,.04); color: var(--primary); }
.upload-area i { font-size: 2rem; margin-bottom: .75rem; display: block; }
.image-preview-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(100px,1fr)); gap: .5rem; margin-top: .75rem; }
.image-preview-item { position: relative; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 1; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-remove { position: absolute; top: .25rem; right: .25rem; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: none; font-size: .7rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ---- PIX modal ---- */
.pix-qr { text-align: center; }
.pix-qr img { width: 200px; height: 200px; margin: 1rem auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.pix-payload { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem; font-size: .75rem; word-break: break-all; font-family: monospace; cursor: pointer; }
.pix-payload:hover { border-color: var(--primary); }

/* ---- Searchbar ---- */
.search-bar { position: relative; }
.search-bar i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-bar .form-control { padding-left: 2.5rem; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: block; }
.empty-state h3 { margin-bottom: .5rem; color: var(--text); }

/* ---- Loading ---- */
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 999; display: flex; align-items: center; justify-content: center; }

/* ---- Animações ---- */
@keyframes fadeIn  { from{opacity:0} to{opacity:1} }
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideRight { from{opacity:0;transform:translateX(50px)} to{opacity:1;transform:translateX(0)} }
@keyframes spin    { to{transform:rotate(360deg)} }
@keyframes pulse   { 0%,100%{box-shadow:0 0 0 0 rgba(249,115,22,.4)} 50%{box-shadow:0 0 0 8px rgba(249,115,22,0)} }

/* ---- Categorias colapsáveis (admin produtos) ---- */
.category-group {
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.category-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.25rem; cursor: pointer; user-select: none;
  background: var(--bg); transition: var(--transition);
  border-bottom: 1px solid var(--border);
}
.category-group-header:hover { background: rgba(249,115,22,.05); }
.toggle-icon {
  color: var(--text-muted); font-size: .85rem;
  transition: transform .25s ease;
}
.category-group-body { display: block; }

/* ---- Cards de endereço ---- */
.address-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1rem 1rem 1.1rem;
  margin-bottom: .75rem;
  position: relative;
  transition: var(--transition);
  background: var(--bg-card);
}
.address-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.address-card.address-default {
  border-color: var(--primary);
  background: rgba(249,115,22,.03);
}
.address-card .addr-main { font-weight: 600; margin-bottom: .2rem; }
.address-card .addr-sub  { font-size: .85rem; color: var(--text-muted); }
.address-card .addr-actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }

/* ---- Badge info ---- */
.badge-info { background: #dbeafe; color: #1e40af; }

/* ---- Botão warning ---- */
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }

/* ---- Responsivo ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; padding: 1rem; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .85rem; padding: 1rem; }
  .product-card-img, .product-card-img-placeholder { height: 140px; }
  .hero h1 { font-size: 1.75rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr 1fr; }
}
