/* ==========================================================================
   Calculadora de Comida y Bebida para Fiestas, Barbacoas y Cumpleaños
   Fijate Tools - fijate.com
   ========================================================================== */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta Tema Oscuro (por defecto) */
  --bg-page: #0b0f17;
  --bg-card: #131b26;
  --bg-card-subtle: #192433;
  --bg-input: #1b2637;
  --border-color: #243247;
  --border-focus: #3b82f6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #f97316; /* Naranja fuego / brasa */
  --accent-primary-hover: #ea580c;
  --accent-glow: rgba(249, 115, 22, 0.2);

  --accent-success: #10b981;
  --accent-success-hover: #059669;
  --accent-whatsapp: #25d366;
  --accent-whatsapp-hover: #20bd5a;

  --badge-bg: rgba(249, 115, 22, 0.12);
  --badge-text: #fdba74;
  --badge-border: rgba(249, 115, 22, 0.25);

  --kpi-bg: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(20, 27, 38, 0.95) 100%);
  --kpi-border: rgba(249, 115, 22, 0.2);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --accent-primary: #ea580c;
  --accent-primary-hover: #c2410c;
  --accent-glow: rgba(234, 88, 12, 0.15);

  --accent-success: #059669;
  --accent-success-hover: #047857;
  --accent-whatsapp: #1da851;
  --accent-whatsapp-hover: #168a42;

  --badge-bg: #fff7ed;
  --badge-text: #c2410c;
  --badge-border: #fed7aa;

  --kpi-bg: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  --kpi-border: #fed7aa;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Estructura Base
   ========================================================================== */

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6,
.section-title,
.hero-title,
.card-header-title {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--text-main);
}

.text-mono {
  font-family: var(--font-mono);
}

.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ==========================================================================
   Hero Intro
   ========================================================================== */

.hero-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f97316 0%, #eab308 50%, #10b981 100%);
}

.hero-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
}

.hero-title {
  font-size: 1.65rem;
  line-height: 1.25;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 900px;
  line-height: 1.55;
}

/* Presets rápidos */
.presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-color);
}

.presets-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-preset {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 34px;
}

.btn-preset:hover {
  background: var(--badge-bg);
  color: var(--badge-text);
  border-color: var(--badge-border);
  transform: translateY(-1px);
}

/* ==========================================================================
   Panel Principal de Configuración
   ========================================================================== */

.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-heading-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.section-title {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Selector visual de tipo de evento */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.event-card {
  position: relative;
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.event-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.event-card.active {
  border-color: var(--accent-primary);
  background: var(--badge-bg);
}

.event-radio-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.event-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.event-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.event-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.event-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Cuadrícula de Controles de Entrada */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  background: var(--bg-card-subtle);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-dim);
}

/* Stepper numérico táctil (+ / -) */
.stepper-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 44px;
}

.btn-stepper {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: none;
  color: var(--text-main);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.btn-stepper:hover {
  background: var(--badge-bg);
  color: var(--accent-primary);
}

.stepper-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 44px;
  background: transparent;
  border: none;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
}

/* Desplegables Select Canónicos */
select.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 40px 0 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  outline: none;
}

select.form-select:focus {
  border-color: var(--border-focus);
}

select.form-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Slider de duración */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.range-slider {
  width: 100%;
  height: 8px;
  accent-color: var(--accent-primary);
  background: var(--bg-input);
  border-radius: 4px;
  cursor: pointer;
}

/* Switch toggle */
.switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.4rem 0;
}

.switch-text {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
}

.switch-ui {
  position: relative;
  width: 48px;
  height: 26px;
  background-color: var(--border-color);
  border-radius: 9999px;
  transition: background-color 0.25s ease;
  flex-shrink: 0;
}

.switch-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s ease;
}

input[type="checkbox"]:checked + .switch-ui {
  background-color: var(--accent-primary);
}

input[type="checkbox"]:checked + .switch-ui::after {
  transform: translateX(22px);
}

/* ==========================================================================
   Panel KPI Ejecutivo (Resumen Superior)
   ========================================================================== */

.kpi-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}

.kpi-card {
  background: var(--kpi-bg);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.kpi-card.highlight {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.16) 0%, var(--bg-card) 100%);
}

.kpi-card.highlight .kpi-value {
  color: var(--accent-primary);
}

/* ==========================================================================
   Listado de Compra por Pasillos (Checklist)
   ========================================================================== */

.shopping-section {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.aisle-block {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.aisle-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.aisle-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.checklist-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-input);
}

.item-check-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.item-check-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-input);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s ease;
}

.item-check-input:checked + .item-check-box {
  background: var(--accent-success);
  border-color: var(--accent-success);
}

.item-check-input:checked + .item-check-box::after {
  content: '✓';
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.item-check-input:checked ~ .item-info .item-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

.item-check-input:checked ~ .item-info .item-badge-qty {
  opacity: 0.6;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1 1 0%;
  min-width: 0;
}

.item-line-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  transition: color 0.15s ease;
}

.item-badge-qty {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  white-space: nowrap;
}

.item-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.empty-alc-msg {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 0.5rem 0;
}

/* ==========================================================================
   Botonera de Exportación WhatsApp
   ========================================================================== */

.whatsapp-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.btn-whatsapp-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent-whatsapp);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  text-decoration: none;
  flex: 1 1 200px;
}

.btn-whatsapp-primary:hover {
  background: var(--accent-whatsapp-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.btn-copy-list {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  flex: 1 1 200px;
}

.btn-copy-list:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-preview-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s ease;
}

.btn-preview-subtle:hover {
  background: var(--bg-input);
}

/* Toast feedback flotante */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
}

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

/* ==========================================================================
   Modal Accesible de Vista Previa WhatsApp
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-backdrop.active .modal-window {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.15rem;
}

.modal-close-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  line-height: 1;
}

.modal-close-icon:hover {
  color: var(--text-main);
  background: var(--bg-input);
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
}

.pre-whatsapp-text {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Adaptabilidad Móvil (< 768px)
   ========================================================================== */

@media (max-width: 768px) {
  .tool-layout {
    margin: 1rem auto 2rem;
    padding: 0 0.75rem;
  }

  .hero-banner {
    padding: 1.25rem 1rem;
  }

  .hero-title {
    font-size: 1.35rem;
  }

  .card-main {
    padding: 1.15rem 0.85rem;
    gap: 1.2rem;
  }

  .controls-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .events-grid {
    grid-template-columns: 1fr;
  }

  .kpi-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .kpi-card {
    padding: 0.75rem;
  }

  .kpi-value {
    font-size: 1.25rem;
  }

  .btn-whatsapp-primary,
  .btn-copy-list,
  .btn-preview-subtle {
    width: 100%;
    flex: 1 1 100%;
  }

  .presets-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.4rem;
  }

  .btn-preset {
    flex-shrink: 0;
  }
}
