/* =====================================================================
   Voting Platform — Public Frontend Styles
   Design tokens are exposed as CSS custom properties so each event can
   override --brand-primary / --brand-secondary from the database.
   ===================================================================== */

:root {
  --brand-primary: #45202c;
  --brand-primary-dark: #3E1503;
  --brand-secondary: #d4af37;
  --brand-secondary-light: #f3e2a9;
  --ink: #1c1410;
  --ink-soft: #5b5048;
  --paper: #fffdf9;
  --paper-alt: #faf5ec;
  --line: #e8dfd0;
  --gold-1: #ffd700;
  --gold-2: #c9a227;
  --silver-1: #e8e8e8;
  --silver-2: #b8b8b8;
  --bronze-1: #d9a066;
  --bronze-2: #a9682f;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 4px 18px rgba(28, 20, 16, 0.08);
  --shadow-pop: 0 18px 50px rgba(28, 20, 16, 0.22);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-primary-dark); }

.text-brand { color: var(--paper) !important; }
.bg-brand { background-color: var(--brand-primary) !important; }
.text-gold { color: var(--brand-secondary) !important; }

.btn-brand {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.btn-brand:hover, .btn-brand:focus {
  background-color: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  color: #fff;
}

.btn-gold {
  background-color: var(--brand-secondary);
  border-color: var(--brand-secondary);
  color: var(--ink);
  font-weight: 700;
}
.btn-gold:hover {
  background-color: var(--gold-2);
  border-color: var(--gold-2);
  color: var(--ink);
}

.btn-outline-brand {
  border: 1.5px solid var(--brand-primary);
  color: var(--brand-primary);
  font-weight: 600;
  background: transparent;
}
.btn-outline-brand:hover {
  background: var(--brand-primary);
  color: #fff;
}

/* ---------------------------------------------------------------- */
/* Site chrome                                                       */
/* ---------------------------------------------------------------- */
.site-header {
  background: var(--paper);
  background: url(/public/assets/images/bg.jpg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1030;
}
.site-header .navbar-brand img { height: 40px; }
.site-header .nav-link {
  font-weight: 600;
  color: var(--paper);
  font-size: 0.92rem;
}
.site-header .nav-link:hover { color: var(--brand-primary); }

/* ---------------------------------------------------------------- */
/* Hero                                                               */
/* ---------------------------------------------------------------- */
.event-hero {
  background: linear-gradient(160deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
  background: url('/public/assets/images/bg.jpg');
  color: #fff;
  position: relative;
  overflow: hidden;
}
.event-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 20%, rgba(212, 175, 55, 0.25), transparent 55%);
  pointer-events: none;
}
.event-hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-secondary-light);
}
.event-hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
}
.event-hero p.lead { color: rgba(255,255,255,0.86); max-width: 60ch; }

.countdown {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.countdown .unit {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  min-width: 76px;
  text-align: center;
  backdrop-filter: blur(6px);
}
.countdown .unit .num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--brand-secondary);
}
.countdown .unit .lbl {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.75);
}

.hero-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.hero-stats .stat .v {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand-secondary);
}
.hero-stats .stat .l {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.7);
}

/* ---------------------------------------------------------------- */
/* Contestant grid                                                   */
/* ---------------------------------------------------------------- */

#contestants {
background: url(/public/assets/images/bg2.jpg);
}
#contestants h2 {
color:var(--brand-secondary-light);}

#contestants .text-body-secondary {
color:rgb(242 249 255 / 75%) !important;}

.section-title {
  font-weight: 700;
  position: relative;
  padding-bottom: 0.6rem;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 56px; height: 3px;
  background: var(--brand-secondary);
  border-radius: 2px;
}

.contestant-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.contestant-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}
.contestant-card .photo-wrap {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--paper-alt);
}
.contestant-card .photo-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s ease;
}
.contestant-card:hover .photo-wrap img { transform: scale(1.04); }

.rank-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
}
.rank-badge.r1 { background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); color: #4a3a00; }
.rank-badge.r2 { background: linear-gradient(135deg, #f4f4f4, var(--silver-2)); color: #3a3a3a; }
.rank-badge.r3 { background: linear-gradient(135deg, var(--bronze-1), var(--bronze-2)); color: #3a1f00; }

.contestant-card .body {
  padding: 0.9rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}
.contestant-card .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
}
.contestant-card .votes {
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.contestant-card .votes strong { color: var(--brand-primary); font-size: 0.95rem; }

/* ---------------------------------------------------------------- */
/* Leaderboard / podium                                              */
/* ---------------------------------------------------------------- */
.podium-section {
  background: var(--paper-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.podium-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding-top: 1rem;
}
.podium-card {
  text-align: center;
  width: 200px;
}
.podium-card .photo-wrap {
  position: relative;
  width: 110px; height: 110px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 0.6rem;
  border: 4px solid #fff;
  box-shadow: var(--shadow-card);
}
.podium-card.first .photo-wrap { width: 140px; height: 140px; border-color: var(--gold-1); }
.podium-card.second .photo-wrap { border-color: var(--silver-2); }
.podium-card.third .photo-wrap { border-color: var(--bronze-2); }
.podium-card .photo-wrap img { width: 100%; height: 100%; object-fit: cover; }

.podium-card .medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}
.podium-card.first .medal { background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); color: #4a3a00; }
.podium-card.second .medal { background: linear-gradient(135deg, #f4f4f4, var(--silver-2)); color: #3a3a3a; }
.podium-card.third .medal { background: linear-gradient(135deg, var(--bronze-1), var(--bronze-2)); color: #3a1f00; }

.podium-card .name { font-family: var(--font-display); font-weight: 700; margin-bottom: 0.15rem; }
.podium-card .votes { color: var(--brand-primary); font-weight: 700; font-size: 0.95rem; }
.podium-card .pedestal {
  margin-top: 0.75rem;
  background: linear-gradient(180deg, #fff, var(--paper-alt));
  border: 1px solid var(--line);
  border-bottom: 4px solid var(--brand-secondary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.podium-card.first .pedestal { height: 70px; border-bottom-color: var(--gold-2); }
.podium-card.second .pedestal { height: 48px; border-bottom-color: var(--silver-2); }
.podium-card.third .pedestal { height: 34px; border-bottom-color: var(--bronze-2); }
.podium-card.first { order: 2; }
.podium-card.second { order: 1; }
.podium-card.third { order: 3; }

.leaderboard-rest {
  list-style: none;
  margin: 0; padding: 0;
}
.leaderboard-rest li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  margin-bottom: 0.5rem;
}
.leaderboard-rest .pos {
  font-weight: 700;
  color: var(--ink-soft);
  width: 28px;
  text-align: center;
  font-family: var(--font-display);
}
.leaderboard-rest img {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
}
.leaderboard-rest .nm { font-weight: 600; flex: 1; }
.leaderboard-rest .vt { font-weight: 700; color: var(--brand-primary); font-size: 0.9rem; }

/* ---------------------------------------------------------------- */
/* Contestant profile page                                           */
/* ---------------------------------------------------------------- */
.profile-photo-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  aspect-ratio: 3/4;
  background: var(--paper-alt);
}
.profile-photo-wrap img { width: 100%; height: 100%; object-fit: cover; }

.profile-stat-card {
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
}
.profile-stat-card .label {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 700;
}
.profile-stat-card .value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.package-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem; }
.package-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  text-align: center;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.package-card:hover { border-color: var(--brand-secondary); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.package-card .votes-n {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-primary);
}
.package-card .votes-lbl { font-size: 0.72rem; text-transform: uppercase; color: var(--ink-soft); letter-spacing: 0.06em; }
.package-card .price { margin-top: 0.4rem; font-weight: 700; font-size: 1.05rem; }
.package-card .featured-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--brand-secondary);
  color: var(--ink);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
  white-space: nowrap;
}

.share-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  color: var(--ink);
  margin-right: 0.5rem;
}
.share-row a:hover { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }

.url-display {
  background: var(--paper-alt);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  word-break: break-all;
}

/* Voting history table */
.history-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border-bottom-width: 1px;
}
.history-table td { vertical-align: middle; font-size: 0.92rem; }
.history-table .donor-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.78rem;
}

/* ---------------------------------------------------------------- */
/* Vote purchase modal                                               */
/* ---------------------------------------------------------------- */
#voteModal .modal-content { border-radius: var(--radius-lg); border: none; overflow: hidden; }
#voteModal .modal-left {
  background: var(--paper-alt);
  padding: 1.75rem;
  border-right: 1px solid var(--line);
}
#voteModal .modal-right { padding: 1.75rem; }
#voteModal .mini-photo {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--brand-secondary);
}
#voteModal .summary-row {
  display: flex; justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
#voteModal .summary-row:last-child { border-bottom: none; }
#voteModal .summary-row .v { font-weight: 700; }
#voteModal .total-row { font-size: 1.15rem; font-weight: 700; color: var(--brand-primary); }
#voteModal .terms-box {
  max-height: 130px;
  overflow-y: auto;
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}
#stripe-card-element {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.9rem;
  background: #fff;
}
#stripe-card-element.StripeElement--focus { border-color: var(--brand-primary); }
#stripe-errors { color: #c0392b; font-size: 0.82rem; min-height: 1.2em; }

.payment-success-box {
  text-align: center;
  padding: 2rem 1rem;
}
.payment-success-box .check-circle {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #e8f7ee;
  color: #1f9d55;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* ---------------------------------------------------------------- */
/* Footer                                                             */
/* ---------------------------------------------------------------- */
.site-footer {
  background: var(--ink);
  background: url('/public/assets/images/bg.jpg');
  color: rgba(255,255,255,0.75);
  font-size: 0.88rem;
}
.site-footer h6 {
  color: #fff;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 0.9rem;
}
.site-footer a { color: rgba(255,255,255,0.75); }
.site-footer a:hover { color: var(--brand-secondary); }
.site-footer .socials a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  margin-right: 0.5rem;
}
.site-footer .socials a:hover { background: var(--brand-secondary); color: var(--ink); }

/* ---------------------------------------------------------------- */
/* Events landing page (multi-event index)                          */
/* ---------------------------------------------------------------- */
.event-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  height: 100%;
}
.event-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.event-card .banner { aspect-ratio: 16/9; background: var(--paper-alt); overflow: hidden; }
.event-card .banner img { width: 100%; height: 100%; object-fit: cover; }
.event-card .body { padding: 1.1rem 1.25rem; }
.event-card .cat-pill {
  display: inline-block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: var(--paper-alt);
  color: var(--brand-primary);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  margin-bottom: 0.5rem;
}

/* Responsive tweaks */
@media (max-width: 767px) {
  .podium-card { width: 30%; min-width: 100px; }
  .podium-card .photo-wrap { width: 80px; height: 80px; }
  .podium-card.first .photo-wrap { width: 96px; height: 96px; }
  #voteModal .modal-left { border-right: none; border-bottom: 1px solid var(--line); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .contestant-card, .contestant-card .photo-wrap img, .event-card { transition: none !important; }
}

/* Focus visibility */
a:focus-visible, button:focus-visible, .package-card:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
