/* Reset y variables */
* { box-sizing: border-box; }
:root {
  --bg: #0f172a;
  --surface: #111827;
  --surface-2: #0b1220;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #3b82f6;
  --primary-contrast: #ffffff;
  --accent: #22d3ee;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --ring: rgba(59,130,246,0.35);
}

html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--surface-2), var(--bg));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Shell */
.app-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(17,24,39,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #1f2937;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 1.4rem; }
.brand-logo { height: 90px; aspect-ratio: 1 / 1; border-radius: 6px; object-fit: contain; }
@media (max-width: 680px) { .brand-logo { width: 28px; height: 28px; } }
.brand-name { font-weight: 700; letter-spacing: 0.2px; }
.app-actions { display: flex; gap: 10px; }

.app-main { max-width: 1100px; margin: 24px auto; padding: 0 16px 40px; }
.app-footer { text-align: center; color: var(--muted); padding: 18px; border-top: 1px solid #1f2937; }
/* CTA Footer - llamativo e ingenioso */
.cta-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 8px auto 4px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(34,211,238,0.10) 0%, rgba(59,130,246,0.10) 100%);
  border: 1px solid rgba(59,130,246,0.25);
}

.btn-cta {
  background: linear-gradient(90deg, #2563eb 0%, #22d3ee 100%);
  color: #fff;
  border-color: rgba(37,99,235,0.8);
  background-size: 200% 200%;
  animation: gradientShift 6s ease infinite;
}

.btn-cta:hover {
  box-shadow: 0 0 0 6px var(--ring), 0 8px 24px rgba(34,211,238,0.25);
  filter: drop-shadow(0 0 6px rgba(34,211,238,0.35));
}

.cta-icon { font-size: 1.2rem; }

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Botones */
.btn {
  appearance: none;
  border: 1px solid #2b3545;
  background: #172034;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { box-shadow: 0 0 0 6px var(--ring); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); border-color: #2d64c6; }
.btn-primary:hover { background: #2f6ef1; }
.btn-secondary { background: #0f1a33; }

/* Tarjetas de selección (inicio) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 16px;
}
.card {
  background: linear-gradient(180deg, #0f1830 0%, #0b1220 100%);
  border: 1px solid #1f2a3e;
  border-radius: 16px;
  padding: 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon title" "icon desc" "footer footer";
  gap: 10px 16px;
}
.card .icon { grid-area: icon; font-size: 1.6rem; }
.card .title { grid-area: title; font-weight: 700; font-size: 1.1rem; }
.card .desc { grid-area: desc; color: var(--muted); font-size: 0.95rem; }
.card .footer { grid-area: footer; display: flex; justify-content: flex-end; }
.card:hover { border-color: #2d64c6; box-shadow: inset 0 1px 0 #152043, 0 0 0 6px var(--ring); }

/* Layouts */
.section {
  background: linear-gradient(180deg, #0f1830 0%, #0b1220 100%);
  border: 1px solid #1f2a3e;
  border-radius: 16px;
  padding: 18px;
}
.section-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 8px; }
.section-subtitle { color: var(--muted); margin: 0 0 12px; }
.section-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }

/* Cine/Teatro – Asientos */
.screen { text-align: center; color: var(--muted); padding: 8px; border: 1px dashed #283247; border-radius: 10px; margin-bottom: 14px; }
.seats-grid {
  display: grid;
  gap: 8px;
}
.walkway, .walkway-col { height: 34px; border-radius: 10px; border: 1px dashed #283247; background: #0b1220; }
.walkway-col { height: 24px; }
.col-labels { display: grid; gap: 8px; margin: 6px 0 10px; color: var(--muted); }
.col-label { height: 24px; display: flex; align-items: center; justify-content: center; }
.seating-container { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.row-labels { display: grid; gap: 8px; }
.row-label { height: 34px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.row-sides { display: flex; justify-content: space-between; align-items: center; color: var(--muted); margin: 8px 0; }
.side-entry, .side-exit { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px dashed #283247; border-radius: 10px; background: #0b1220; }

/* Formulario de checkout */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 0.9rem; color: var(--muted); }
.form-row input, .form-row select { height: 36px; border-radius: 10px; border: 1px solid #273249; background: #162038; color: var(--text); padding: 0 10px; }
.invoice { border: 1px solid #1f2a3e; background: #111827; border-radius: 12px; padding: 14px; }
.invoice .brand { font-weight: 800; letter-spacing: 0.5px; }
.invoice .line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #1f2937; }
.invoice .line:last-child { border-bottom: none; }
.invoice .items { margin-top: 8px; }

.seat {
  height: 34px; border-radius: 10px; border: 1px solid #273249; background: #162038; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; color: var(--text);
}
.seat.available:hover { box-shadow: 0 0 0 6px var(--ring); }
.seat.occupied { background: #162038; border-color: var(--danger); border-width: 2px; color: var(--text); cursor: not-allowed; }
.seat.selected { background: #2563eb; border-color: #1c4ab8; color: #fff; }
/* Teatro – Balcón (filas E–F) */
.seat.balcony { border-color: #8b5cf6; background: #131a2b; color: #c9b8ff; }
.seat.balcony.selected { background: #6d28d9; border-color: #8b5cf6; color: #fff; }
.row-label.balcony { color: #8b5cf6; font-weight: 700; }
.balcony-divider { height: 22px; border-top: 1px dashed #8b5cf6; border-bottom: 1px dashed #8b5cf6; display:flex; align-items:center; justify-content:center; color:#8b5cf6; background:#0f1430; border-radius:10px; margin: 4px 0; }

.legend { display: flex; gap: 14px; align-items: center; color: var(--muted); margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-swatch { width: 16px; height: 16px; border-radius: 6px; border: 1px solid #273249; }
.legend-swatch.available { background: #162038; }
.legend-swatch.selected { background: #2563eb; border-color: #1c4ab8; }
.legend-swatch.occupied { background: #162038; border-color: var(--danger); }
.legend-swatch.balcony { background: #1b1440; border-color: #8b5cf6; }

/* Restaurante – Mesas */
.controls { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.control { display: flex; flex-direction: column; gap: 6px; }
.control label { font-size: 0.9rem; color: var(--muted); }
.control input, .control select { height: 36px; border-radius: 10px; border: 1px solid #273249; background: #162038; color: var(--text); padding: 0 10px; }

.tables-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.table {
  border: 1px solid #273249; background: #162038; border-radius: 12px; padding: 10px; text-align: center; cursor: pointer;
}
.table .name { font-weight: 700; }
.table .capacity { color: var(--muted); font-size: 0.85rem; }
.table.available:hover { box-shadow: 0 0 0 6px var(--ring); }
.table.occupied { background: #1a243d; border-color: #3b455f; color: #63708b; cursor: not-allowed; }
.table.selected { background: #2563eb; border-color: #1c4ab8; color: #fff; }

/* Eventos */
.event-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.event-card { border: 1px solid #273249; background: #162038; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.event-card .name { font-weight: 700; }
.event-card .meta { color: var(--muted); font-size: 0.9rem; }
.event-card.selected { border-color: #2d64c6; box-shadow: 0 0 0 6px var(--ring); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty input { width: 64px; text-align: center; height: 36px; border-radius: 10px; border: 1px solid #273249; background: #162038; color: var(--text); }

/* Modal */
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.5); padding: 16px; }
.modal.hidden { display: none; }
.modal-content { width: min(640px, 96vw); background: #111827; border: 1px solid #1f2a3e; border-radius: 16px; overflow: hidden; }
.modal-header { padding: 16px; border-bottom: 1px solid #1f2937; }
.modal-body { padding: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px; border-top: 1px solid #1f2937; }
.success-badge { display: inline-flex; align-items: center; gap: 10px; background: #0c1e16; border: 1px solid #124a37; color: #9ef0c2; padding: 10px 12px; border-radius: 12px; }

/* Utilidades */
.row { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* Responsivo */
@media (max-width: 980px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .seats-grid { grid-template-columns: repeat(10, 1fr); }
  .tables-grid { grid-template-columns: repeat(4, 1fr); }
  .event-list { grid-template-columns: repeat(2, 1fr); }
}

/* Plano restaurante */
.floorplan {
  display: grid;
  grid-template-areas:
    "top top top"
    "left main right"
    "bottom bottom bottom";
  grid-template-columns: 0.7fr 2.6fr 0.7fr;
  gap: 10px;
  margin-top: 10px;
}
.zone {
  border: 1px dashed #283247; border-radius: 12px; padding: 8px; color: var(--muted);
  background: #0b1220;
}
.zone-top { grid-area: top; display: flex; align-items: center; justify-content: center; }
.zone-left { grid-area: left; display: flex; align-items: center; justify-content: center; }
.zone-right { grid-area: right; display: flex; align-items: center; justify-content: center; }
.zone-bottom { grid-area: bottom; display: flex; align-items: center; justify-content: center; }
.main-area { grid-area: main; border: 1px solid #1f2a3e; border-radius: 12px; padding: 16px; background: linear-gradient(180deg, #0f1830 0%, #0b1220 100%); display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); place-items: center; gap: 12px; }

.table-node {
  position: relative;
  overflow: visible;
  border: 1px solid #273249;
  background: #162038;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.table-round { width: 72px; height: 72px; border-radius: 50%; }
.table-oval { width: 160px; height: 96px; border-radius: 50% / 45%; }
.table-node .label { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 0.85rem; color: var(--muted); }
.chair { position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #273249; background: #0f1a33; }
.table-node.available:hover { box-shadow: 0 0 0 6px var(--ring); }
.table-node.selected { background: #2563eb; border-color: #1c4ab8; color: #fff; }
.table-node.occupied { background: #162038; border-color: var(--danger); border-width: 2px; color: var(--text); cursor: not-allowed; }

@media (max-width: 680px) {
  .table-oval { width: 132px; height: 84px; }
  .table-round { width: 64px; height: 64px; }
  .main-area { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .card-grid { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr; }
  .seats-grid { grid-template-columns: repeat(8, 1fr); }
  .tables-grid { grid-template-columns: repeat(2, 1fr); }
  .event-list { grid-template-columns: 1fr; }
}
/* Ajustes adicionales de responsive */
@media (max-width: 680px) {
  .form-grid { grid-template-columns: 1fr; }
  /* Cine/Teatro compactos */
  .seating-container { grid-template-columns: 30px 1fr; gap: 8px; }
  .row-label { height: 32px; font-size: 0.85rem; }
  .seats-grid { gap: 6px; }
  .seat { height: 28px; font-size: 0.8rem; }
  .walkway, .walkway-col { height: 28px; }
  .walkway-col { height: 20px; }
  .screen { margin-bottom: 10px; padding: 6px; }
  .section-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
  /* Restaurante: apilar zonas */
  .main-area { gap: 10px; }
  .floorplan {
    grid-template-areas:
      "top"
      "left"
      "main"
      "right"
      "bottom";
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
@media (max-width: 520px) {
  /* Ultra-compacto */
  .seat { height: 24px; font-size: 0.75rem; }
  .row-label { height: 28px; font-size: 0.8rem; }
  .seats-grid { gap: 5px; }
  .walkway, .walkway-col { height: 24px; }
  .seating-container { grid-template-columns: 28px 1fr; gap: 6px; }
  .invoice .line { gap: 8px; }
}