/* --- Variables y Estilos Base --- */
:root {
  --primary: #e65100;
  --primary-hover: #bf360c;
  --primary-light: #fff3e0;
  --secondary: #2e7d32;
  --secondary-hover: #1b5e20;
  --whatsapp: #25d366;
  --whatsapp-hover: #1ebd5a;
  --dark: #212121;
  --muted: #666666;
  --light: #f9f9f9;
  --white: #ffffff;
  --border: #e0e0e0;
  --danger: #d32f2f;
  --warning: #ffa000;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: #f4f6f8;
  color: var(--dark);
  line-height: 1.5;
  padding-bottom: 70px;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

/* --- Banner Superior --- */
.top-banner {
  background-color: #fff8e1;
  border-bottom: 1px solid #ffe082;
  font-size: 0.88rem;
  padding: 8px 0;
  color: #5d4037;
  text-align: center;
}

/* --- Cabecera --- */
.main-header {
  background-color: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-cart {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--primary-light);
  border: 1px solid #ffcc80;
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cart:hover {
  background-color: #ffe0b2;
}

.cart-badge {
  background-color: var(--primary);
  color: var(--white);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: bold;
}

/* --- Controles: Búsqueda y Categorías --- */
.controls-section {
  margin: 20px 0 16px 0;
}

.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.1rem;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background-color: var(--white);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.category-tab {
  background-color: var(--white);
  border: 1px solid var(--border);
  color: var(--dark);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.category-tab.active,
.category-tab:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* --- Sección Menú --- */
.menu-section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.items-count {
  font-size: 0.88rem;
  color: var(--muted);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* --- Tarjeta de Plato --- */
.dish-card {
  background-color: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

.dish-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dish-card.sold-out {
  opacity: 0.7;
  filter: grayscale(0.2);
}

.dish-body {
  padding: 16px;
}

.dish-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-primary {
  background-color: #ffe0b2;
  color: #e65100;
}

.badge-danger {
  background-color: #ffcdd2;
  color: #c62828;
}

.badge-info {
  background-color: #e1f5fe;
  color: #0277bd;
}

.dish-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}

.dish-description {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.dish-footer {
  padding: 12px 16px;
  background-color: #fafafa;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dish-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

/* --- Botones --- */
.btn-primary {
  background-color: var(--primary);
  color: var(--white);
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-primary:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--light);
  color: var(--dark);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-whatsapp {
  background-color: var(--whatsapp);
  color: var(--white);
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
  background-color: var(--whatsapp-hover);
  transform: scale(1.01);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
}

.btn-close:hover {
  color: var(--dark);
}

/* --- Barra de Carrito Flotante Móvil --- */
.mobile-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--white);
  border-top: 2px solid var(--primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  z-index: 99;
}

.mobile-cart-info {
  display: flex;
  flex-direction: column;
}

.mobile-cart-qty {
  font-size: 0.85rem;
  color: var(--muted);
}

.mobile-cart-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

/* --- Modales --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background-color: var(--white);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease-out;
}

.cart-modal-card {
  max-width: 600px;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
  background-color: #fafafa;
}

/* Selector de Cantidad */
.qty-selector {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--white);
  overflow: hidden;
}

.btn-qty {
  background: none;
  border: none;
  padding: 8px 14px;
  font-size: 1.1rem;
  cursor: pointer;
  user-select: none;
}

.btn-qty:hover {
  background-color: var(--light);
}

.qty-value {
  font-weight: 700;
  padding: 0 8px;
  min-width: 32px;
  text-align: center;
}

/* --- Grupos de Opciones de Personalización --- */
.option-group {
  margin-bottom: 20px;
  background-color: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.option-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.option-group-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.option-item:last-child {
  border-bottom: none;
}

.option-item label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  cursor: pointer;
  flex: 1;
}

.option-price {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

/* --- Carrito y Checkout Modal --- */
.cart-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.cart-items-section {
  margin-bottom: 24px;
}

.cart-items-section h4,
.checkout-section h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 4px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item-info {
  flex: 1;
  padding-right: 12px;
}

.cart-item-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.cart-item-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cart-item-price {
  font-weight: 700;
  font-size: 1rem;
  color: var(--dark);
}

.cart-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--muted);
}

.cart-empty button {
  margin-top: 10px;
}

/* Formulario */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.required {
  color: var(--danger);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.radio-toggle-group {
  display: flex;
  gap: 12px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--light);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.radio-label:has(input:checked) {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary-hover);
  font-weight: 600;
}

/* Caja de Banco */
.bank-box {
  background-color: #f1f8e9;
  border: 1px solid #c5e1a5;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 16px;
}

.bank-box-header {
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: #33691e;
}

.bank-box-body {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #2e7d32;
}

.bank-note {
  font-size: 0.8rem;
  color: #558b2f;
  margin-top: 8px;
}

/* Footer de Carrito y Totales */
.cart-modal-footer {
  padding: 16px 20px;
  background-color: #fafafa;
  border-top: 1px solid var(--border);
}

.cost-breakdown {
  margin-bottom: 14px;
}

.cost-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  margin-bottom: 4px;
  color: var(--muted);
}

.cost-line.total-line {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 8px;
}

.cost-line.total-line span:last-child {
  color: var(--primary);
}

/* --- Footer --- */
.main-footer {
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background-color: var(--white);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.security-badge {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #388e3c;
}

/* Utilidades */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
  .header-container {
    padding: 10px 12px;
  }
  .brand-title {
    font-size: 1.1rem;
  }
  .cart-label {
    display: none;
  }
  .radio-toggle-group {
    flex-direction: column;
    gap: 8px;
  }
}

/* Notificación Toast Flotante */
.app-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: #212121;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1500;
  white-space: nowrap;
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Soporte para Fotos de Platos */
.dish-image-wrap {
  width: 100%;
  height: 180px;
  overflow: hidden;
  position: relative;
  background-color: #f0f0f0;
}

.dish-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.dish-card:hover .dish-image {
  transform: scale(1.04);
}

.modal-dish-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  display: block;
}

/* --- Agrupación por Categorías en la Web Pública --- */
.category-group-block {
  margin-bottom: 36px;
}

.category-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #f0e6dc;
  padding-bottom: 8px;
  margin-bottom: 18px;
}

.category-group-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-group-badge {
  font-size: 0.8rem;
  color: var(--muted);
  background-color: var(--bg-alt);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.menu-grouped-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
}

/* --- Campo de Instrucciones y Notas por Plato --- */
.dish-notes-box {
  padding: 14px 20px 18px 20px;
  border-top: 1px solid var(--border);
  background-color: #fbfbfb;
}

.dish-notes-label {
  display: block;
  font-size: 0.88rem;
  color: var(--dark);
  margin-bottom: 6px;
  font-weight: 700;
}

.dish-notes-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #ccd0d5;
  font-size: 0.9rem;
  background-color: #ffffff;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.dish-notes-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

.cart-item-note {
  font-size: 0.82rem;
  color: #b45309;
  background-color: #fffbeb;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
  border: 1px solid #fef3c7;
  font-weight: 500;
}
