/* CCS Trivia - Brand tokens y overrides sobre Bootstrap 5 */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --t-primary:       #1A56A4;
  --t-primary-dark:  #134088;
  --t-accent:        #E87722;
  --t-bg:            #F1F5F9;
  --t-surface:       #FFFFFF;
  --t-text:          #1E293B;
  --t-muted:         #64748B;
  --t-border:        #E2E8F0;
  --t-success:       #16A34A;
  --t-shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --t-shadow-md:     0 4px 12px rgba(26,86,164,.12);
  --t-radius:        .75rem;
}

/* ── Base ────────────────────────────────────────────────── */
body {
  background-color: var(--t-bg);
  color: var(--t-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* ── Bootstrap primary overrides ────────────────────────── */
.btn-primary {
  background-color: var(--t-primary);
  border-color: var(--t-primary);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--t-primary-dark);
  border-color: var(--t-primary-dark);
}
.text-primary  { color: var(--t-primary) !important; }
.bg-primary    { background-color: var(--t-primary) !important; }
.border-primary{ border-color: var(--t-primary) !important; }

a { color: var(--t-primary); }
a:hover { color: var(--t-primary-dark); }

/* ── Header / Navbar ─────────────────────────────────────── */
.site-header {
  background: var(--t-surface);
  border-bottom: 3px solid var(--t-primary);
  box-shadow: var(--t-shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .navbar { padding: .5rem 0; }
.site-header .navbar-brand img { height: 48px; }

/* ── Banner ──────────────────────────────────────────────── */
.site-banner {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  display: block;
}

/* ── Section title ───────────────────────────────────────── */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--t-primary);
  margin-bottom: 2rem;
  margin-top: 2rem;
}

/* ── Sponsor grid (home) ─────────────────────────────────── */
.sponsor-card {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius);
  overflow: hidden;
  box-shadow: var(--t-shadow-sm);
  transition: box-shadow 200ms ease-out;
}
.sponsor-card:hover { box-shadow: var(--t-shadow-md); }
.sponsor-card img {
  width: 100%;
  height: 110px;
  object-fit: contain;
  padding: .75rem;
}

/* ── Expositores slider (home) ───────────────────────────── */
.expositores-slider {
  position: relative;
  margin-bottom: 2rem;
}
.expositores-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;          /* Firefox */
  padding-bottom: .25rem;
}
.expositores-track::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.expositores-track:focus-visible {
  outline: 2px solid var(--t-primary);
  outline-offset: 2px;
}
.expositores-track .sponsor-card {
  flex: 0 0 auto;
  width: 160px;
  scroll-snap-align: start;
}
.expositores-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--t-border);
  border-radius: 50%;
  background: var(--t-surface);
  color: var(--t-primary);
  box-shadow: var(--t-shadow-md);
  cursor: pointer;
  transition: opacity 200ms ease-out, background 200ms ease-out;
}
.expositores-arrow:hover { background: var(--t-bg, #f5f5f5); }
.expositores-arrow--prev { left: -8px; }
.expositores-arrow--next { right: -8px; }
.expositores-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}
.expositores-slider--static .expositores-arrow { display: none; }

@media (max-width: 575.98px) {
  .expositores-arrow { display: none; } /* en móvil se usa swipe */
}

/* ── Category cards (patrocinadores) ─────────────────────── */
.category-card {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius);
  overflow: hidden;
  box-shadow: var(--t-shadow-sm);
  text-decoration: none;
  color: var(--t-text);
  display: block;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--t-shadow-md);
  color: var(--t-text);
}
.category-card.answered {
  opacity: .55;
  pointer-events: none;
  cursor: default;
}
.category-card .card-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background-color: var(--t-primary);
}
.category-card .card-footer-area {
  padding: .875rem 1rem;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.3;
  min-height: 56px;
  display: flex;
  align-items: center;
}
.category-card .answered-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  color: var(--t-success);
  font-weight: 500;
  margin-top: .25rem;
}

/* ── Pregunta / Answer options ───────────────────────────── */
.question-card {
  background: var(--t-surface);
  border-radius: var(--t-radius);
  box-shadow: var(--t-shadow-sm);
  padding: 1.75rem;
}
.question-text {
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.answer-option {
  border: 2px solid var(--t-border);
  border-radius: .625rem;
  padding: .875rem 1.125rem;
  margin-bottom: .625rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .875rem;
  min-height: 52px; /* touch target */
  transition: border-color 150ms ease-out, background-color 150ms ease-out;
  user-select: none;
}
.answer-option:hover {
  border-color: var(--t-primary);
  background-color: #EFF6FF;
}
.answer-option.active {
  border-color: var(--t-primary);
  background-color: #DBEAFE;
  font-weight: 500;
}
.answer-option .option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--t-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.answer-option.active .option-letter {
  background-color: var(--t-primary);
  color: #fff;
}

/* ── Trivia ended message ────────────────────────────────── */
.trivia-ended {
  text-align: center;
  padding: 3rem 1rem;
}
.trivia-ended h2 {
  color: var(--t-primary);
  font-weight: 700;
}

/* ── Admin table ─────────────────────────────────────────── */
.table-trivia thead th {
  background-color: var(--t-primary);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  border-color: var(--t-primary-dark);
}
.table-trivia tbody tr:hover { background-color: #EFF6FF; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  background-color: #1E293B;
  color: #94A3B8;
  border-top: 3px solid var(--t-primary);
  padding: 2rem 0 1.25rem;
}
.site-footer a { color: #CBD5E1; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .footer-divider { border-color: #334155; }

/* ── Alert feedback ──────────────────────────────────────── */
.alert-success-trivia {
  background-color: #F0FDF4;
  border-left: 4px solid var(--t-success);
  color: #166534;
  border-radius: .5rem;
}

/* ── Leaderboard ─────────────────────────────────────────── */
.tabular { font-variant-numeric: tabular-nums; }

/* Podio */
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.podium-spot { width: 11rem; max-width: 42vw; }
.podium--1 { order: 2; }
.podium--2 { order: 1; }
.podium--3 { order: 3; }
.podium-card {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius) var(--t-radius) 0 0;
  box-shadow: var(--t-shadow-sm);
  padding: 1.25rem 1rem .9rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  border-bottom: none;
}
.podium--1 .podium-card { box-shadow: var(--t-shadow-md); transform: translateY(-.25rem); }
.podium-medal {
  width: 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 1.1rem; color: #fff;
  box-shadow: var(--t-shadow-sm);
}
.podium-avatar {
  width: 3rem; height: 3rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--t-bg); color: var(--t-primary);
  font-weight: 700; font-size: 1rem; letter-spacing: .03em;
  border: 2px solid var(--t-border);
}
.podium-name {
  font-weight: 600; color: var(--t-text); font-size: .9rem; line-height: 1.2;
  max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.podium-meta { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; font-size: .8rem; }
.podium-score { color: var(--t-success); font-weight: 700; }
.podium-time  { color: var(--t-muted); }
.podium-score i, .podium-time i { margin-right: .2rem; }
.podium-bar {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: .5rem; border-radius: 0 0 .35rem .35rem; color: #fff;
}
.podium--1 .podium-bar { height: 4.5rem; background: linear-gradient(180deg, #F5B301, #D99700); }
.podium--2 .podium-bar { height: 3.25rem; background: linear-gradient(180deg, #AEB8C2, #8B97A3); }
.podium--3 .podium-bar { height: 2.25rem; background: linear-gradient(180deg, #D08B45, #B06B2C); }
.podium-rank { font-weight: 800; font-size: 1.5rem; line-height: 1; }

/* Colores de medalla (podio y tabla) */
.rank--gold   { background: linear-gradient(135deg, #F5B301, #D99700); }
.rank--silver { background: linear-gradient(135deg, #AEB8C2, #8B97A3); }
.rank--bronze { background: linear-gradient(135deg, #D08B45, #B06B2C); }

/* Tabla leaderboard */
.table-leaderboard tbody td { vertical-align: middle; }
.rank-medal {
  position: relative;
  width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-size: .8rem;
}
.rank-medal .rank-num {
  position: absolute; right: -.35rem; bottom: -.35rem;
  background: var(--t-surface); color: var(--t-text);
  border: 1px solid var(--t-border); border-radius: 50%;
  width: 1.1rem; height: 1.1rem; font-size: .65rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.rank-plain { font-weight: 700; color: var(--t-muted); }
.lb-avatar {
  flex-shrink: 0;
  width: 2.25rem; height: 2.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--t-bg); color: var(--t-primary);
  font-weight: 700; font-size: .8rem; border: 1px solid var(--t-border);
}
.lb-identity { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.lb-name  { font-weight: 600; color: var(--t-text); }
.lb-email { font-size: .8rem; color: var(--t-muted); }
.badge-aciertos {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #F0FDF4; color: var(--t-success);
  border: 1px solid #BBF7D0; border-radius: 999px;
  padding: .15rem .6rem; font-weight: 700; font-size: .85rem;
}
.lb-top1 td { background-color: #FFFBEB !important; }
.lb-top2 td { background-color: #F8FAFC !important; }
.lb-top3 td { background-color: #FEF6EF !important; }

@media (max-width: 575.98px) {
  .podium { flex-direction: column; align-items: stretch; }
  .podium-spot { width: 100%; max-width: 100%; order: 0 !important; }
  .podium--1 .podium-card { transform: none; }
  .podium-bar { height: 1.75rem !important; }
}

/* ── Cuestionario: progreso en tarjetas ──────────────────── */
.category-card .card-footer-area { min-height: 84px; align-items: flex-start; }
.cat-name { font-weight: 600; line-height: 1.25; }
.category-card.is-done { border-color: #BBF7D0; }
.category-card.is-done .card-img { opacity: .6; }

.quiz-progress {
  width: 100%; height: 6px; border-radius: 999px;
  background: var(--t-border); overflow: hidden;
}
.quiz-progress-bar {
  height: 100%; border-radius: 999px;
  background: var(--t-primary);
  transition: width 250ms ease-out;
}
.quiz-progress-bar.is-done { background: var(--t-success); }

.quiz-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: .4rem; font-size: .72rem; font-weight: 600;
}
.quiz-state { display: inline-flex; align-items: center; gap: .25rem; }
.quiz-count { color: var(--t-muted); font-variant-numeric: tabular-nums; }
.quiz-link { color: var(--t-primary); white-space: nowrap; }

/* ── Cuestionario: paso k de N en la pregunta ────────────── */
.quiz-step-badge {
  flex-shrink: 0;
  background: var(--t-bg); color: var(--t-primary);
  border: 1px solid var(--t-border); border-radius: 999px;
  padding: .2rem .7rem; font-size: .78rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Resultado del cuestionario ──────────────────────────── */
.result-hero {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-left: 4px solid var(--t-primary);
  border-radius: var(--t-radius);
  box-shadow: var(--t-shadow-sm);
  padding: 1.25rem 1.5rem;
}
.result-score { display: flex; align-items: baseline; gap: .35rem; }
.result-score-num { font-size: 2.75rem; font-weight: 800; color: var(--t-primary); line-height: 1; }
.result-score-den { font-size: 1.25rem; font-weight: 700; color: var(--t-muted); }
.result-score-label { font-size: .85rem; color: var(--t-muted); margin-left: .15rem; }
.result-stats { display: flex; gap: 1.75rem; margin-left: auto; }
.result-stat { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.result-stat i { color: var(--t-accent); margin-bottom: .15rem; }
.result-stat span { font-size: 1.15rem; font-weight: 700; color: var(--t-text); }
.result-stat small { font-size: .72rem; color: var(--t-muted); }
.lb-me td { background-color: #EFF6FF !important; box-shadow: inset 3px 0 0 var(--t-primary); }

@media (max-width: 575.98px) {
  .result-stats { margin-left: 0; width: 100%; justify-content: flex-start; gap: 1.25rem; }
}

/* ── Admin subnav (pills) ────────────────────────────────── */
.admin-nav .nav-link {
  color: var(--t-primary);
  font-weight: 600;
  border: 1px solid var(--t-border);
  background: var(--t-surface);
  margin-right: .5rem;
}
.admin-nav .nav-link:hover { background: #EFF6FF; }
.admin-nav .nav-link.active {
  background-color: var(--t-primary);
  border-color: var(--t-primary);
  color: #fff;
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .category-card,
  .answer-option,
  .sponsor-card,
  .quiz-progress-bar { transition: none; }
  .expositores-track { scroll-behavior: auto; }
}
