/* ========================================
   Feria de Abril @ Hangar — Brand System
   Mobile-first responsive design
   ======================================== */

:root {
  --coral: #ea7250;
  --coral-dark: #c45a3c;
  --coral-light: #f4a58e;
  --terra: #3b1a0a;
  --sand: #faf3e8;
  --sand-dark: #f0e2cc;
  --cream: #fffcf7;
  --olive: #5a7247;
  --olive-light: #e8f0e2;
  --gold: #d4a853;
  --gold-light: #fdf5e0;

  --bg: var(--sand);
  --card-bg: var(--cream);
  --card-border: #e8d8c4;
  --text: var(--terra);
  --text-muted: #8a6d55;
  --accent: var(--coral);
  --accent-hover: var(--coral-dark);
  --ok: #3a8a52;
  --ok-bg: var(--olive-light);
  --ok-border: #c2dbb5;
  --warn: #b8860b;
  --warn-bg: var(--gold-light);
  --warn-border: #ecd5a0;
  --danger: #c0392b;
  --danger-bg: #fde8e5;
  --danger-border: #f0b4ac;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 24px rgba(59, 26, 10, 0.08);
  --shadow-lg: 0 12px 48px rgba(59, 26, 10, 0.12);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; display: block; }

/* ---- Typography ---- */
h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  line-height: 1.15;
  margin-bottom: 0.5em;
  color: var(--terra);
}
h1 { font-size: 1.6rem; font-weight: 900; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin-bottom: 0.75em; color: var(--text-muted); }

/* ---- Page Shell ---- */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 720px; margin: 0 auto; flex: 1; }
.wide { width: 100%; max-width: 1080px; margin: 0 auto; flex: 1; }

/* ---- Topbar ---- */
.topbar {
  max-width: 1080px;
  margin: 0 auto 12px auto;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 6px;
  z-index: 10;
}

.brand { display: flex; align-items: center; }
.brand .logo-svg { height: 22px; width: auto; color: var(--coral); }

.topbar-actions { display: flex; gap: 4px; flex-wrap: nowrap; }

.nav-link {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--sand);
  border: 1px solid var(--card-border);
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral);
}

.nav-link--logout {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.nav-link--logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* ---- Hero ---- */
.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
  min-height: 260px;
  display: flex;
  align-items: flex-end;
}

.hero-bg { position: absolute; inset: 0; }

.hero-image { width: 100%; height: 100%; object-fit: cover; }

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(59,26,10,0.92) 0%, rgba(59,26,10,0.6) 40%, rgba(59,26,10,0.1) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 20px 16px;
  width: 100%;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.3em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.hero-subtitle {
  color: rgba(255,255,255,0.9);
  font-size: 0.95rem;
  font-weight: 500;
}

/* ---- Card ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

/* ---- Grid ---- */
.grid { display: grid; gap: 14px; }
.grid .card { margin-bottom: 0; }

/* ---- Pills ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
  background: rgba(255,255,255,0.25);
  color: #fff;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.2);
}

.pill--accent { background: var(--coral); color: #fff; border-color: var(--coral); }
.pill--ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.pill-icon { font-size: 13px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---- Forms ---- */
.form-grid { display: grid; gap: 14px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  background: var(--sand);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(234, 114, 80, 0.15);
}

textarea { min-height: 80px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.6; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s;
  background: var(--coral);
  color: #fff;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: var(--coral-dark); color: #fff; }
.btn:active { transform: scale(0.98); }

.btn--lg { padding: 14px 24px; font-size: 16px; border-radius: 14px; width: 100%; }
.btn--secondary { background: var(--sand); color: var(--text); border: 1px solid var(--card-border); }
.btn--secondary:hover { background: var(--sand-dark); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #a5281d; }

/* ---- Actions / Toolbar ---- */
.actions { display: grid; gap: 10px; margin-top: 12px; }
.toolbar { display: grid; gap: 10px; }

.search-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* ---- Alerts ---- */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid;
}

.alert--ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.alert--error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert--warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }

/* ---- Ticket ---- */
.ticket { text-align: center; }

.ticket-code {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-top: 4px;
  font-weight: 600;
}

.qr-box {
  display: inline-flex;
  padding: 12px;
  border-radius: var(--radius);
  margin: 16px auto;
  background: #fff;
  box-shadow: 0 4px 20px rgba(59, 26, 10, 0.1);
  border: 2px solid var(--sand-dark);
}

.qr-box img { width: 240px; height: 240px; }

.ticket-event-info {
  margin: 14px 0;
  padding: 12px;
  background: var(--sand);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

.muted { color: var(--text-muted); }

/* ---- Status boxes (Check-in results) ---- */
.status-box {
  padding: 20px 16px;
  border-radius: var(--radius);
  text-align: center;
  margin-top: 14px;
  border: 1px solid;
}

.status-box .big {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 8px;
}

.status-box p { color: inherit; opacity: 0.85; margin-bottom: 0; }
.result-name { font-size: 1.1rem; font-weight: 700; margin-top: 8px; opacity: 0.9; }
.status-box--ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.status-box--used { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.status-box--miss { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }

.result-detail {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}

/* ---- Stats ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.stat {
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  background: var(--sand);
  border: 1px solid var(--card-border);
  text-align: center;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.stat-num {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--terra);
}

.stat-num--ok { color: var(--ok); }
.stat-num--warn { color: var(--warn); }

/* ---- Desktop Table (hidden on mobile) ---- */
.table-desktop { display: none; }

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: var(--card-bg);
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  font-size: 13px;
}

th {
  background: var(--sand);
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
}

td code {
  font-size: 11px;
  background: var(--sand);
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

/* ---- Mobile User Cards ---- */
.mobile-cards {
  display: grid;
  gap: 10px;
}

.user-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.user-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
}

.user-card__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--terra);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card__rows {
  display: grid;
  gap: 6px;
}

.user-card__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.user-card__row span:last-child {
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.user-card__label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.user-card__row code {
  font-size: 11px;
  background: var(--sand);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.user-card__row a {
  color: var(--accent);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge--used { background: var(--ok-bg); color: var(--ok); }
.badge--pending { background: var(--sand); color: var(--text-muted); border: 1px solid var(--card-border); }

/* ---- Login ---- */
.login-card {
  max-width: 420px;
  margin: 40px auto;
}

.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo .logo-svg { height: 32px; width: auto; color: var(--coral); display: inline-block; }

/* ---- Video / Scanner ---- */
video {
  width: 100%;
  border-radius: var(--radius-sm);
  background: var(--terra);
  display: none;
  max-height: 50vh;
  object-fit: cover;
}

canvas { display: none; }

/* ---- Footer ---- */
.site-footer {
  margin-top: auto;
  padding: 24px 12px 12px;
  text-align: center;
}

.footer-inner { max-width: 720px; margin: 0 auto; }
.footer-logo .logo-svg { height: 20px; width: auto; color: var(--coral-light); display: inline-block; margin-bottom: 6px; opacity: 0.6; }
.site-footer p { font-size: 12px; color: var(--text-muted); opacity: 0.6; }

.footer-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ---- Print ---- */
@media print {
  .topbar, .site-footer, .footer-note, .btn, button { display: none !important; }
  .page { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .hero { display: none; }
}

/* ============================================
   TABLET (>=600px)
   ============================================ */
@media (min-width: 600px) {
  .page { padding: 14px; }
  h1 { font-size: 1.8rem; }
  .card { padding: 20px; }
  .hero { min-height: 300px; }
  .hero-title { font-size: 2.6rem; }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .search-row { grid-template-columns: 1fr auto auto; }
  .actions.inline { grid-template-columns: repeat(2, minmax(0, 200px)); justify-content: center; }
  .btn--lg { width: auto; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .topbar { padding: 12px 18px; border-radius: var(--radius); }
  .brand .logo-svg { height: 26px; }
  .nav-link { padding: 8px 14px; font-size: 14px; }
  .qr-box img { width: 280px; height: 280px; }
  .login-card { margin: 60px auto; }
  .stat { padding: 16px; }
  .stat-num { font-size: 2rem; }
}

/* ============================================
   DESKTOP (>=900px) — show table, hide cards
   ============================================ */
@media (min-width: 900px) {
  .page { padding: 16px; }
  h1 { font-size: 2.2rem; }
  .card { padding: 28px; }
  .hero { min-height: 400px; }
  .hero-title { font-size: 3.4rem; }
  .hero-content { padding: 28px 24px; }
  .topbar { padding: 14px 20px; margin-bottom: 20px; border-radius: 20px; }
  .brand .logo-svg { height: 28px; }
  .grid { gap: 20px; }

  /* Show table, hide mobile cards */
  .table-desktop { display: block; }
  .mobile-cards { display: none; }

  .status-box .big { font-size: 2rem; }
}
