/* ===========================================
   MESAS - lista de mesas, carrinho, grupos e secoes do cardapio.
   Veio de pages/mesas.css, mesas-itens.css e grupos.css do D2Mesas; os
   seletores de DataTables (#tabelaMesas tbody...) viraram classes.
   =========================================== */

/* ================= MESAS ================= */
.mesas-grid { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.mesa-row {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,.3);
  color: var(--text-primary);
  display: flex; flex-direction: column;
}
.mesa-row::before {
  content: attr(data-status);
  display: block;
  background: var(--color-mesa-fechamento);
  color: #fff; font-weight: bold; text-align: center;
  padding: 12px; font-size: 18px; letter-spacing: 1px;
}
.mesa-row[data-status="Livre"]::before { background: var(--color-mesa-livre); }
.mesa-row[data-status="Ocupada"]::before { background: var(--color-mesa-ocupada); }
.mesa-row[data-status="Fechamento"]::before { background: var(--color-mesa-fechamento); }

.mesa-content { display: flex; align-items: flex-start; justify-content: space-between; padding: 12px; }
.mesa-info { display: flex; flex-direction: column; gap: 6px; }
.mesa-nome { font-weight: 700; }
.mesa-icon { width: 80px; height: 80px; position: relative; flex-shrink: 0; cursor: pointer; }
.mesa-icon img { width: 100%; height: 100%; }
.mesa-numero {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 30px; font-weight: 700; color: var(--text-primary);
  pointer-events: none;
}
.mesa-icon:active { transform: scale(.95); }

@media (min-width: 769px) {
  .mesas-grid { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .mesa-row { width: 280px; min-height: 220px; transition: transform .2s ease, box-shadow .2s ease; }
  .mesa-row:hover { transform: translateY(-4px); box-shadow: 0 8px 12px rgba(0,0,0,.4); }
  .mesa-content { flex: 1; align-items: center; }
}

[data-theme="light"] .mesa-row { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.1); }

/* ================= CABECALHO DO PEDIDO ================= */
.mesa-cabecalho {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 16px 12px; font-weight: 700; color: var(--text-primary);
}
.mesa-cabecalho > div { display: flex; flex-direction: column; }
.mesa-cabecalho .dir { align-items: flex-end; }

/* ================= CARRINHO ================= */
.carrinho { padding: 0 16px; }
.cart-item { color: var(--text-primary); }
.cart-linha { display: flex; justify-content: space-between; gap: 12px; }
.cart-info { flex: 1; min-width: 0; }
.cart-item .title { font-weight: bold; font-size: 16px; }
.cart-item .line { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }
.cart-item .cart-qty { color: var(--text-primary); font-weight: bold; }
.cart-item .cart-total-item { color: var(--color-accent); font-weight: bold; }
.cart-taxa .title { color: #22c55e; font-style: italic; }

.cart-acoes { width: 84px; display: flex; flex-direction: column; align-items: center; padding-top: 16px; }
.cart-remove { color: #ff8b5c; font-size: 20px; margin-bottom: 14px; padding: 2px 8px; }
.cart-qtd { display: flex; align-items: center; gap: 10px; }
.cart-qtd .cart-qty { font-size: 18px; }
.btn-cart-minus { color: #ff4d4d; font-size: 26px; line-height: 1; padding: 0 6px; }
.btn-cart-plus { color: #00ff7f; font-size: 26px; line-height: 1; padding: 0 6px; }
.btn-cart-minus:active, .btn-cart-plus:active, .cart-remove:active { opacity: .6; }

.subitens { margin-left: 8px; }
.subitem { font-size: 15px; color: var(--text-secondary); margin-top: 4px; padding-left: 8px; }
.cart-obs { margin: 14px 0 6px 4px; }
.cart-add-note { color: var(--text-primary); text-decoration: underline; font-size: 14px; }
.cart-separator { border-top: 1px solid var(--border-color); margin: 12px 0; }

[data-theme="light"] .btn-cart-minus { color: #cc3333; }
[data-theme="light"] .btn-cart-plus { color: #0a8a3a; }
[data-theme="light"] .cart-remove { color: #cc5533; }

/* ================= GRUPOS ================= */
.grupos-grid { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: center; padding: 0 16px; }
.group-card {
  background: #000; border-radius: 12px; overflow: hidden; position: relative; cursor: pointer;
  width: 260px; height: 180px; transition: transform var(--transition-fast);
}
.group-card:hover { transform: scale(1.03); }
.group-card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.group-card-title {
  position: absolute; top: 12px; left: 0; right: 0; text-align: center;
  font-weight: 700; font-size: 1.4rem; color: #fff; white-space: nowrap;
  text-shadow: 0 0 6px rgba(0,0,0,.7); pointer-events: none;
}
@media (max-width: 767px) {
  .grupos-grid { display: block; padding: 0; }
  .group-card { width: 100%; height: auto; border-radius: 0; }
  .group-card img { height: auto; }
  .group-card + .group-card { border-top: 3px solid var(--color-primary); }
  .group-card-title { top: auto; bottom: 15px; font-size: 2rem; font-weight: 800; text-shadow: 0 0 10px #000; }
}

/* ================= SECOES (itens do grupo) ================= */
.secao { scroll-margin-top: 56px; }
.secao-header { background: var(--border-light); color: var(--text-primary); padding: 12px; font-size: 20px; font-weight: bold; }
.secao + .secao .secao-header { margin-top: 25px; }
.secao-sub { background: #555; padding: 12px; color: #ccc; font-size: 13px; margin-bottom: 5px; }
.secao-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  color: var(--text-primary);
}
.secao-item-info { display: flex; flex-direction: column; font-size: 14px; min-width: 0; }
.secao-item-nome { font-weight: bold; font-size: 16px; }
.secao-item-preco { margin-top: 2px; }
.secao-item-ingr { margin-top: 4px; font-size: 13px; color: #ccc; }
.secao-item-qtd { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.secao-item-qtd .qtd { font-size: 18px; min-width: 1.2em; text-align: center; }
.btnQtd { font-size: 26px; line-height: 1; padding: 4px 8px; }
.btnQtd.diminuir { color: #ff4d4d; }
.btnQtd.somar { color: #00ff7f; }
.btnQtd:active { opacity: .6; }

[data-theme="light"] .secao-header { background: #e2e8f0; color: #1a202c; }
[data-theme="light"] .secao-sub { background: #edf2f7; color: #4a5568; }
[data-theme="light"] .secao-item-ingr { color: #4a5568; }
[data-theme="light"] .secao-item { border-bottom-color: rgba(0,0,0,.06); }
