:root {
  --bg: #121212;
  --card: #1f1f1f;
  --accent: #e63946;
  --price: #f4a261; /* Color naranja principal */
  --text: #ffffff;
  --green: #25d366;
  --gray-border: rgba(255, 255, 255, 0.1);
  --site-credit-height: 52px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 230px; /* Fallback */
  padding-bottom: calc(230px + env(safe-area-inset-bottom)); /* Espacio para panel de pedido + franja final */
}

/* ================= NOTIFICACIONES TOAST ================= */
.toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--price);
  color: #000;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  font-weight: 700;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 250px;
}

.toast.success { background: var(--green); color: white; }
.toast.error { background: var(--accent); color: white; }

@keyframes slideIn {
  from { transform: translateX(400px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(400px); opacity: 0; }
}

/* ================= HEADER ================= */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 68px;
  padding: 0 16px;
  background: rgba(27, 27, 27, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-border);
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}

.logo { height: 44px; width: auto; }
.brand-name { display: block; font-weight: 900; font-size: 1.2rem; line-height: 1; }
.brand-tagline { font-size: 0.65rem; text-transform: uppercase; color: var(--price); letter-spacing: 1px; }

.floating-hours-alert {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 196px;
  z-index: 2600;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--accent);
  color: var(--text);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  animation: fadeIn 0.25s ease;
}

/* ================= PASOS Y HEADERS ================= */
.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 25px 16px 15px;
}

.step-badge {
  background: var(--accent);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
}

.step-text { font-size: 1.1rem; font-weight: 800; margin: 0; }

/* ================= SELECTOR TAMAÑOS ================= */
.tabs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 16px;
}

.tab-btn {
  background: var(--card);
  border: 1px solid var(--gray-border);
  padding: 16px 14px;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.tab-btn.active {
  border-color: var(--price) !important;
  background: rgba(244, 162, 97, 0.1) !important;
  box-shadow: 0 4px 15px rgba(244, 162, 97, 0.2);
}

.size-name { display: block; font-weight: 900; font-size: 1rem; margin-bottom: 4px; }
.tab-btn.active .size-name { color: var(--price); }
.size-info { font-size: 0.75rem; opacity: 0.6; }

.size-reco-label {
  margin: 15px 16px 0;
  padding: 12px;
  background: rgba(244, 162, 97, 0.15);
  border-left: 4px solid var(--price);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  animation: fadeIn 0.3s ease;
}

/* ================= MENÚ DE SABORES ================= */
.flavor-selection-container { padding: 10px 0; }

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}

.pizza-card {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.pizza-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(244, 162, 97, 0.2);
}

.pizza-card.selected {
  border-color: var(--price);
  box-shadow: 0 0 15px rgba(244, 162, 97, 0.3);
  transform: scale(0.98);
}

.pizza-image { 
  position: relative; 
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  background: var(--card);
}

.pizza-image img { 
  width: 100%; 
  height: auto;
  display: block;
}

.overlay { 
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px; 
  background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%); 
}
.overlay h3 { font-size: 0.85rem; margin: 0; }
.overlay span { color: var(--price); font-weight: 800; font-size: 0.9rem; }

/* ================= BOTONES DE ACCIÓN ================= */
.add-to-cart-btn {
  width: calc(100% - 32px);
  margin: 0 16px 20px;
  background: var(--price);
  color: #000;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-weight: 900;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(244, 162, 97, 0.3);
  transition: all 0.2s ease;
}

.add-to-cart-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 162, 97, 0.4);
}

.add-to-cart-btn:active:not(:disabled) { 
  transform: scale(0.97); 
}

.add-to-cart-btn:disabled {
  background: #444;
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ================= MODAL HORARIO ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 4000;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--gray-border);
  border-radius: 16px;
  padding: 20px 18px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.modal-card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 900;
}

.modal-card p {
  margin: 0 0 16px;
  font-size: 0.95rem;
  opacity: 0.9;
}

.modal-close-btn {
  border: none;
  background: var(--price);
  color: #000;
  font-weight: 900;
  padding: 12px 18px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
}

.modal-close-btn:active {
  transform: scale(0.98);
}

/* ================= CARRITO / RESUMEN ================= */
.cart-items-list {
  margin: 0 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 5px 15px;
}

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

.cart-item-row:last-child { border: none; }

.btn-remove {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

/* ================= FORMULARIO ================= */
.order-form { padding: 0 16px 20px; }

.input-field {
  width: 100%;
  background: #ffffff;
  color: #333;
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 4px;
  border: 2px solid var(--gray-border);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.input-field:focus { 
  border-color: var(--price); 
  outline: none;
  box-shadow: 0 0 0 3px rgba(244, 162, 97, 0.1);
}

.input-field.invalid {
  border-color: var(--accent);
}

.error-message {
  display: block;
  color: var(--accent);
  font-size: 0.75rem;
  margin: 4px 0 8px 4px;
  min-height: 18px;
  font-weight: 600;
}

.payment-note {
  margin-top: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--price);
  border-radius: 8px;
  font-size: 0.85rem;
  color: #ddd;
}

.site-credit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--site-credit-height);
  padding: 8px 16px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--price);
  border-top: 1px solid var(--price);
  border-bottom: 1px solid var(--price);
}

.site-credit-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
}

.site-credit-text {
  font-size: 0.78rem;
  letter-spacing: 0.2px;
  font-weight: 600;
  color: #000;
}

/* ================= FOOTER PANEL ================= */
.cart-panel {
  position: fixed;
  bottom: var(--site-credit-height);
  bottom: calc(var(--site-credit-height) + env(safe-area-inset-bottom)); left: 0; right: 0;
  background: #1b1b1b;
  padding: 16px;
  border-top: 1px solid var(--gray-border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 15px;
  z-index: 2000;
}

.summary { display: flex; flex-direction: column; }
#selection-text { font-size: 0.75rem; opacity: 0.7; margin-bottom: 4px; }
#total-price { font-size: 1.4rem; font-weight: 900; color: var(--price); }

.order-btn {
  background: var(--green);
  color: white;
  border: none;
  padding: 16px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.order-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.order-btn:disabled { 
  background: #444; 
  opacity: 0.6; 
  cursor: not-allowed; 
}

/* ================= ANIMACIONES Y MEDIA ================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
  .tabs-grid { grid-template-columns: repeat(4, 1fr); }
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 767px) {
  :root {
    --site-credit-height: 44px;
  }

  .site-credit {
    gap: 8px;
    padding: 6px 12px;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  }

  .site-credit-logo {
    height: 18px;
  }

  .site-credit-text {
    font-size: 0.68rem;
  }
}

.order-btn:disabled { 
  background: #444 !important; /* Gris oscuro */
  opacity: 0.8; 
  cursor: not-allowed;
  pointer-events: none; /* Evita cualquier interacción */
}