/* ============================================================
   Running System - Main Stylesheet
   ============================================================ */

:root {
  --primary:    #e63946;
  --primary-dk: #c1121f;
  --secondary:  #457b9d;
  --dark:       #1d3557;
  --light:      #f8f9fa;
  --success:    #2dc653;
  --warning:    #ffd60a;
}

/* ---- Base ---- */
body { font-family: 'Sarabun', 'Prompt', sans-serif; background: linear-gradient(180deg, #eef2fa 0%, #f8fbff 50%, #f4f6fb 100%); color: #333; }

/* ---- Navbar ---- */
.navbar-brand .brand-icon { font-size: 1.4rem; }
.navbar-running { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dk) 100%); }
.navbar-running .nav-link { color: rgba(255,255,255,.85) !important; transition: color .2s; }
.navbar-running .nav-link:hover { color: #fff !important; }

/* ---- Hero Section ---- */
.hero-section {
  background: linear-gradient(135deg, var(--dark) 0%, var(--primary-dk) 60%, var(--primary) 100%);
  color: #fff;
  padding: 80px 0;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '🏃';
  position: absolute;
  font-size: 15rem;
  right: -40px;
  top: -30px;
  opacity: .07;
}
.hero-section h1 { font-size: 2.8rem; font-weight: 700; }
.hero-section p  { font-size: 1.15rem; opacity: .9; }

/* ---- Event Cards ---- */
.event-card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  transition: transform .25s, box-shadow .25s;
  overflow: hidden;
}
.event-card:hover { transform: translateY(-5px); box-shadow: 0 12px 32px rgba(0,0,0,.14); }
.event-card .card-header {
  background: linear-gradient(135deg, var(--dark), var(--secondary));
  color: #fff;
  padding: 20px;
}
.event-card .event-date-badge {
  background: rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: .85rem;
  display: inline-block;
}
.event-card .status-badge-open  { background: #d1fae5; color: #065f46; }
.event-card .status-badge-closed { background: #fee2e2; color: #991b1b; }
.event-card .status-badge-full  { background: #fef3c7; color: #92400e; }

/* ---- Distance Tags (event card) ---- */
.dist-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid #e63946;
  border-radius: 50px;
  padding: 10px 22px;
  font-size: 1rem;
  font-weight: 700;
  color: #1d3557;
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(230,57,70,.15);
  letter-spacing: .01em;
}
.dist-tag .bi { color: #e63946; font-size: .95rem; }
.dist-tag:hover {
  background: #e63946;
  color: #fff;
  box-shadow: 0 4px 14px rgba(230,57,70,.35);
  transform: translateY(-1px);
}
.dist-tag:hover .bi { color: #fff; }
.dist-tag:hover .dist-tag-price,
.dist-tag:hover .dist-tag-free { color: rgba(255,255,255,.9); }
.dist-tag-price { color: #e63946; font-weight: 700; }
.dist-tag-free  { color: #059669; font-weight: 700; }
.dist-tag-full  { border-color: #adb5bd; color: #adb5bd; cursor: default; box-shadow: none; opacity: .7; }
.dist-tag-full .bi { color: #adb5bd; }
.dist-tag-sold  { background: #dc3545; color: #fff; border-radius: 20px; padding: 1px 7px; font-size: .7rem; margin-left: 2px; }

/* ---- Distance Buttons ---- */
.distance-btn {
  border: 1px solid rgba(32,41,76,.08);
  border-radius: 18px;
  padding: 22px 18px;
  cursor: pointer;
  transition: all .25s;
  background: rgba(255,255,255,.95);
  position: relative;
  text-align: center;
  box-shadow: 0 16px 40px rgba(15,20,60,.06);
}
.distance-btn .distance-check-icon {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 1.2rem;
  color: var(--dc, #dee2e6);
  opacity: 0;
  transition: opacity .2s;
}
.distance-btn:hover {
  border-color: var(--dc, #e63946);
  background: var(--db, #fff5f5);
  box-shadow: 0 18px 44px rgba(15,20,60,.12);
  transform: translateY(-2px);
}
.distance-btn.selected {
  border-color: var(--dc, #e63946);
  background: var(--db, #fff5f5);
  box-shadow: 0 20px 50px rgba(15,20,60,.16);
  transform: translateY(-3px);
}
.distance-btn.selected .distance-check-icon { opacity: 1; }
.distance-btn .distance-name { font-weight: 700; font-size: 1.05rem; color: #1d3557; }
.distance-btn .distance-price { color: var(--dc, var(--primary)); font-size: 1.3rem; font-weight: 800; margin-top: 6px; }
.distance-btn .distance-slots { font-size: .87rem; color: #667085; margin-top: 8px; min-height: 1.3em; }

/* Distance color themes */
.dist-red    { --dc: #e63946; --db: #fff5f5; --ds: rgba(230,57,70,.15); }
.dist-blue   { --dc: #2563eb; --db: #eff6ff; --ds: rgba(37,99,235,.15); }
.dist-green  { --dc: #059669; --db: #ecfdf5; --ds: rgba(5,150,105,.15); }
.dist-orange { --dc: #d97706; --db: #fffbeb; --ds: rgba(217,119,6,.15); }
.dist-purple { --dc: #7c3aed; --db: #f5f3ff; --ds: rgba(124,58,237,.15); }

/* Top accent bar per color */
.dist-red::before, .dist-blue::before, .dist-green::before,
.dist-orange::before, .dist-purple::before {
  content: '';
  display: block;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--dc);
  position: absolute;
  top: 0; left: 0; right: 0;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

/* ---- Registration Form ---- */
.form-section {
  background: rgba(255,255,255,0.95);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(20,30,77,.08);
  padding: 32px;
  margin-bottom: 30px;
  border: 1px solid rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.form-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255,255,255,.5), transparent 35%),
              linear-gradient(180deg, rgba(255,255,255,.15), transparent 45%);
  opacity: .6;
  pointer-events: none;
}
..form-section > * { position: relative; }
.form-section-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--dark);
  background: rgba(230,57,70,.08);
  border-radius: 999px;
  padding: 12px 18px;
  margin-bottom: 24px;
  border-left: none;
  box-shadow: inset 0 0 0 1px rgba(230,57,70,.08);
}
.form-section-title i {
  color: var(--primary);
}
.form-label { font-weight: 500; color: #444; }
input[type="date"].form-control {
  cursor: pointer;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230,57,70,.12);
}
.required-star { color: var(--primary); }

/* ---- Coupon ---- */
.coupon-box {
  border: 2px dashed #dee2e6;
  border-radius: 12px;
  padding: 16px;
  background: #fafafa;
}
.coupon-success { border-color: var(--success); background: #f0fff4; }
.coupon-error   { border-color: #e63946; background: #fff5f5; }

/* ---- Price Summary ---- */
.price-summary {
  background: linear-gradient(135deg, var(--dark), var(--secondary));
  color: #fff;
  border-radius: 12px;
  padding: 20px;
}
.price-summary .final-price { font-size: 2rem; font-weight: 700; color: #ffd60a; }

/* ---- Status Check ---- */
.status-card {
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
  overflow: hidden;
}
.status-card .status-header {
  padding: 24px;
  background: linear-gradient(135deg, var(--dark), var(--secondary));
  color: #fff;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 50px;
  font-weight: 600;
  font-size: .95rem;
}
.status-badge-pending   { background: #fef3c7; color: #92400e; }
.status-badge-confirmed { background: #d1fae5; color: #065f46; }
.status-badge-paid      { background: #d1fae5; color: #065f46; }
.status-badge-cancelled { background: #fee2e2; color: #991b1b; }

/* ---- BIB Preview ---- */
.bib-preview {
  background: linear-gradient(135deg, #fff, #f8f9fa);
  border: 4px solid var(--primary);
  border-radius: 16px;
  padding: 30px 20px;
  text-align: center;
  max-width: 200px;
  box-shadow: 0 8px 32px rgba(230,57,70,.18);
}
.bib-number { font-size: 3.5rem; font-weight: 900; color: var(--primary); line-height: 1; }
.bib-event  { font-size: .75rem; color: #666; margin-top: 4px; }

/* ---- Dashboard ---- */
.stat-card {
  border: none;
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .stat-icon { font-size: 2.5rem; margin-bottom: 8px; }
.stat-card .stat-number { font-size: 2.2rem; font-weight: 800; }
.stat-card .stat-label  { font-size: .9rem; color: #888; }
.stat-card-red    { background: linear-gradient(135deg, #ff6b6b, var(--primary)); color: #fff; }
.stat-card-blue   { background: linear-gradient(135deg, #74b9ff, var(--secondary)); color: #fff; }
.stat-card-green  { background: linear-gradient(135deg, #55efc4, #00b894); color: #fff; }
.stat-card-orange { background: linear-gradient(135deg, #fdcb6e, #e17055); color: #fff; }

/* ---- Progress Bar ---- */
.progress { border-radius: 20px; background: #e9ecef; }
.progress-bar { border-radius: 20px; transition: width 1s ease; }

/* ---- Landing Page ---- */
.landing-hero {
  background: radial-gradient(circle at top left, rgba(255,255,255,.18), transparent 35%),
              linear-gradient(135deg, var(--dark) 0%, var(--primary-dk) 55%, var(--primary) 100%);
  color: #fff;
  padding: 100px 0 60px;
  position: relative;
  overflow: hidden;
}
.landing-hero::after {
  content: '';
  position: absolute;
  right: -120px;
  top: 30px;
  width: 260px;
  height: 260px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.landing-hero .eyebrow {
  font-size: .95rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.85);
  margin-bottom: 1rem;
}
.landing-hero h1 {
  font-size: 3rem;
  line-height: 1.05;
  font-weight: 800;
}
.landing-hero .lead {
  color: rgba(255,255,255,.9);
  max-width: 520px;
}
.btn-register {
  background: #ffd60a;
  color: #1d3557;
  border: none;
}
.btn-register:hover {
  background: #ffca2c;
  color: #1d3557;
}
.hero-image-card {
  max-width: 540px;
}
.hero-image-card img {
  width: 100%;
  display: block;
}
.hero-cutout {
  width: 180px;
  position: absolute;
  bottom: -12px;
  right: -12px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 22px 48px rgba(0,0,0,.18);
}
.hero-cutout img {
  display: block;
}
.landing-highlights {
  background: #fff;
}
.feature-box {
  background: #f8f9ff;
  border-radius: 24px;
  padding: 30px;
  text-align: center;
  min-height: 240px;
  box-shadow: 0 18px 38px rgba(92,99,160,.08);
}
.feature-icon {
  font-size: 2.8rem;
  margin-bottom: 18px;
}
.feature-box h5 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.feature-box p {
  color: #5f6989;
}
.landing-banner-section {
  background: linear-gradient(135deg, rgba(230,57,70,.06), rgba(255,214,96,.12));
}
.landing-banner-card {
  background: linear-gradient(135deg, #ffffff, #fdf4e5);
  border: 1px solid rgba(229,57,70,.12);
}
.landing-banner-card h3 {
  font-weight: 700;
}
.landing-footer {
  background: #1d3557;
  color: rgba(255,255,255,.82);
}
.landing-footer p { margin-bottom: 0; }

/* ---- Upload Slip ---- */
.slip-preview { max-width: 200px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.upload-area {
  border: 2px dashed #adb5bd;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fafafa;
}
.upload-area:hover { border-color: var(--primary); background: #fff5f5; }

/* ---- Footer ---- */
.site-footer { background: var(--dark); color: rgba(255,255,255,.7); padding: 40px 0 24px; }
.site-footer a { color: rgba(255,255,255,.7); text-decoration: none; }
.site-footer a:hover { color: #fff; }

/* ---- Utilities ---- */
.text-primary-custom { color: var(--primary) !important; }
.bg-primary-custom   { background: var(--primary) !important; }
.btn-primary-custom  { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary-custom:hover { background: var(--primary-dk); border-color: var(--primary-dk); color: #fff; }
.rounded-xl { border-radius: 16px !important; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hero-section { padding: 50px 0; }
  .hero-section h1 { font-size: 1.8rem; }
  .form-section { padding: 20px 15px; }
  .bib-number { font-size: 2.5rem; }
}

/* ---- Loading Spinner ---- */
.spinner-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; display: none;
}
.spinner-overlay.show { display: flex; }

/* ---- Animate numbers ---- */
@keyframes countUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.count-animate { animation: countUp .5s ease forwards; }
