/* ============================================================
   Mobay City Run - Registration System Styles
   Premium Edition
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --primary-dark: #0e2f44;
  --accent: #e67e22;
  --accent-dark: #d35400;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --gray-50: #f8f9fa;
  --gray-100: #ecf0f1;
  --gray-200: #dce1e3;
  --gray-300: #bdc3c7;
  --gray-400: #95a5a6;
  --gray-600: #7f8c8d;
  --gray-700: #5a6c7d;
  --gray-800: #2c3e50;
  --gray-900: #1a252f;
  --white: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.15);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ---- Accessibility: focus-visible ---- */
:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Layout ---- */
.container { max-width: 900px; margin: 0 auto; padding: 20px; }
.container-wide { max-width: 1280px; margin: 0 auto; padding: 20px 28px; }

/* ---- Header (Public Registration) ---- */
.header {
  background: #2980b9;
  color: white;
  padding: 40px 20px 36px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.header h1 {
  font-size: 2.2em;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.header .subtitle {
  font-size: 1.1em;
  opacity: 0.9;
  font-weight: 300;
  letter-spacing: 1px;
}
.header .badge {
  display: inline-block;
  background: var(--accent);
  padding: 6px 20px;
  border-radius: 24px;
  font-size: 0.88em;
  font-weight: 700;
  margin-top: 14px;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 14px rgba(230, 126, 34, 0.35);
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
  border: 1px solid rgba(0,0,0,0.04);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(0,0,0,0.06);
}
.card h2 {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-100);
  letter-spacing: -0.3px;
}
.card h3 {
  font-size: 1.05em;
  color: var(--gray-700);
  margin: 18px 0 12px;
  font-weight: 600;
}

/* ---- Section Titles ---- */
.section-title {
  font-size: 1.5em;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
  min-height: 1.5em;
  transition: color 0.3s ease;
}

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.88em;
  color: var(--gray-700);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.form-group label .required { color: var(--danger); font-weight: 700; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  /* Prevent iOS Safari from zooming into inputs on focus (triggers when font-size < 16px) */
  input, select, textarea { font-size: 16px; padding: 13px 14px; }
  /* Scale oversized landing hero on phones */
  .landing-hero-content { padding: 36px 16px; }
  .landing-hero-content h1 { font-size: 1.9em; letter-spacing: -0.5px; }
  .landing-hero-content .subtitle { font-size: 1em; letter-spacing: 1px; }
  .landing-hero { min-height: 260px; }
  .landing-hero.has-banner { min-height: 320px; }
  .landing-body { padding: 28px 16px 44px; }
  .landing-intro { font-size: 1em; line-height: 1.7; }
  .landing-cta { padding: 16px 32px; font-size: 1.05em; width: 100%; justify-content: center; }
  .landing-disclaimer { padding: 18px 18px; }
  .header h1 { font-size: 1.5em; }
  .header { padding: 26px 16px; }
  /* Bigger tap targets for registration controls */
  .flag-select-btn { min-height: 48px; padding: 10px 12px; }
  .flag-option { min-height: 44px; }
  #addGuestBtn { width: 100%; padding: 14px; }
  .remove-guest { width: 36px; height: 36px; font-size: 1.4em; }
  .medical-checkboxes { grid-template-columns: 1fr; }
  .checkbox-label { padding: 10px 0; min-height: 44px; }
}

input, select, textarea {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.95em;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  background: var(--white);
  color: var(--gray-800);
}
input::placeholder, textarea::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}
input:hover, select:hover, textarea:hover {
  border-color: var(--gray-300);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(41,128,185,0.12);
}
input.error, select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}
input.phone-valid {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(39,174,96,0.1);
}
.field-error {
  color: var(--danger);
  font-size: 0.82em;
  margin-top: 3px;
}
textarea { resize: vertical; min-height: 70px; }

/* Medical Condition Checkboxes */
.medical-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 16px;
  margin-bottom: 8px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 0.92em;
  color: var(--gray-800);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}
.checkbox-label:hover {
  background: var(--gray-50);
}
.checkbox-label input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary-light);
  cursor: pointer;
}

/* ---- Phone Input Group ---- */
.phone-input-group {
  display: flex;
  gap: 8px;
}
.phone-input-group input {
  flex: 1;
}

/* Flag Country Selector */
.flag-select-wrap {
  position: relative;
  flex-shrink: 0;
}
.flag-select-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  white-space: nowrap;
  transition: var(--transition);
  height: 100%;
  min-width: 120px;
}
.flag-select-btn:hover {
  border-color: var(--primary-light);
}
.flag-select-btn .fi {
  font-size: 1.2em;
  border-radius: 2px;
}
.flag-dial {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.88em;
}
.flag-caret {
  font-size: 0.7em;
  color: var(--gray-400);
  margin-left: auto;
}
.flag-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 260px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  display: none;
}
.flag-dropdown.open {
  display: block;
}
.flag-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.15s;
}
.flag-option:hover {
  background: var(--gray-50);
}
.flag-option .fi {
  font-size: 1.3em;
  border-radius: 2px;
}
.flag-option-name {
  flex: 1;
  color: var(--gray-800);
  font-weight: 500;
}
.flag-option-dial {
  color: var(--gray-600);
  font-size: 0.88em;
  font-weight: 600;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
  letter-spacing: 0.2px;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; filter: grayscale(0.3); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: white; }
.btn-accent:hover { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.82em; border-radius: 8px; }
.btn-sm.icon-btn { padding: 4px 6px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.btn-sm.icon-btn svg { display: block; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Rate input with $ prefix */
.rate-input-wrap {
  display: flex;
  align-items: stretch;
}
.rate-prefix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-weight: 700;
  color: var(--gray-600);
  font-size: 0.95em;
}
.rate-input-wrap input {
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---- Export Button Group ---- */
.export-btn-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ---- Report Cards ---- */
.report-card {
  position: relative;
  padding-top: 32px;
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}
.report-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.report-icon {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
}

/* ---- Guest Section ---- */
.guest-block {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  transition: var(--transition);
}
.guest-block:hover {
  border-color: var(--primary-light);
}
.guest-block .guest-number {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  font-size: 0.95em;
}
.guest-block .remove-guest {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.3em;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
}
.guest-block .remove-guest:hover { background: rgba(231,76,60,0.1); }

/* ---- Summary ---- */
.summary-box {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
  color: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  margin: 24px 0;
  box-shadow: 0 8px 28px rgba(26, 82, 118, 0.3);
}
.summary-box .total-label { font-size: 0.95em; opacity: 0.9; font-weight: 500; }
.summary-box .total-amount { font-size: 2.4em; font-weight: 800; margin: 8px 0; letter-spacing: -1px; }
.summary-box .total-note { font-size: 0.85em; opacity: 0.8; }

/* ---- Alerts ---- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.92em;
  border-left: 4px solid;
  line-height: 1.5;
  animation: sectionFadeIn 0.3s ease;
}
.alert-success { background: #d5f5e3; border-color: var(--success); color: #1e7e34; }
.alert-error { background: #fadbd8; border-color: var(--danger); color: #c0392b; }
.alert-warning { background: #fef9e7; border-color: var(--warning); color: #9a7b0a; }
.alert-info { background: #d6eaf8; border-color: var(--primary-light); color: var(--primary); }

/* ---- Confirmation Screen ---- */
.confirmation-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.confirm-section h3 {
  font-size: 1em;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}
.confirm-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-50);
  font-size: 0.93em;
}
.confirm-row.highlight {
  background: var(--gray-50);
  padding: 10px 12px;
  border-radius: 8px;
  border-bottom: none;
  margin-top: 4px;
}
.confirm-label {
  color: var(--gray-600);
  font-weight: 500;
}
.confirm-value {
  font-weight: 600;
  color: var(--gray-800);
  text-align: right;
}

/* ---- Login Page ---- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2980b9;
  padding: 20px;
}
.login-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 48px;
  width: 100%;
  max-width: 440px;
  animation: loginSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-box h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 6px;
  font-weight: 800;
  font-size: 1.6em;
  line-height: 1.3;
}
.login-box .login-subtitle {
  text-align: center;
  color: var(--gray-600);
  margin-bottom: 28px;
  font-size: 0.92em;
  letter-spacing: 0.3px;
}

/* ---- Admin Dashboard ---- */
.admin-header {
  background: linear-gradient(135deg, var(--primary-dark), #132b3e);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.15);
  transition: background 0.3s ease;
}
.admin-header .logo {
  font-weight: 800;
  font-size: 1.15em;
  letter-spacing: -0.3px;
}
.admin-header .logo .logo-divider {
  opacity: 0.4;
  margin: 0 4px;
  font-weight: 300;
}
.admin-header nav { display: flex; gap: 2px; flex-shrink: 0; }
.admin-header nav button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.65);
  padding: 8px 18px;
  cursor: pointer;
  font-size: 0.88em;
  font-family: inherit;
  font-weight: 500;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
  position: relative;
}
.admin-header nav button:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}
.admin-header nav button.active {
  background: rgba(255,255,255,0.15);
  color: white;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 rgba(255,255,255,0.6);
}
.admin-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9em;
}
.admin-header .user-info .role-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  padding: 3px 12px;
  border-radius: 14px;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.04);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-light);
}
.stat-card.accent::before { background: var(--accent); }
.stat-card.premium::before { background: linear-gradient(90deg, var(--accent), var(--success)); }
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.stat-card .stat-value {
  font-size: 2.2em;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.82em;
  color: var(--gray-600);
  margin-top: 6px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.premium .stat-value {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Chart Bars ---- */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chart-bar-label {
  width: 120px;
  font-size: 0.83em;
  font-weight: 500;
  color: var(--gray-700);
  text-align: right;
  flex-shrink: 0;
}
.chart-bar-track {
  flex: 1;
  background: var(--gray-50);
  border-radius: 6px;
  overflow: hidden;
  height: 28px;
}
.chart-bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding-left: 10px;
  color: white;
  font-size: 0.78em;
  font-weight: 700;
  min-width: 28px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Metric Cards (Gender etc.) ---- */
.metric-cards {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.metric-card {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 24px 16px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
}
.metric-pct {
  font-size: 2em;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.metric-count {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--gray-700);
  margin: 4px 0;
}
.metric-label {
  font-size: 0.82em;
  color: var(--gray-600);
  font-weight: 500;
}

/* ---- Filters Bar ---- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 18px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.04);
}
.filters-bar select, .filters-bar input {
  width: auto;
  min-width: 150px;
  padding: 8px 12px;
  font-size: 0.88em;
}
.filters-bar .filter-label {
  font-size: 0.78em;
  color: var(--gray-600);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- Registrants Toolbar (compact) ---- */
.registrants-toolbar {
  margin-bottom: 20px;
}
.registrants-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.registrants-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.04);
}
.registrants-filters select,
.registrants-filters input {
  padding: 8px 12px;
  font-size: 0.86em;
  min-width: 0;
  width: auto;
}
.registrants-filters select {
  max-width: 150px;
}
.registrants-filters input {
  width: 160px;
}

/* ---- Table ---- */
.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.04);
  transition: background 0.3s ease, border-color 0.3s ease;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}
th {
  background: var(--gray-50);
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
  color: var(--gray-700);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
th.sortable:hover {
  color: var(--primary);
  background: var(--gray-100);
}
th.sortable.sorted {
  color: var(--primary);
}

/* Masterlist table: scrollable container with sticky header row.
   Scoped by id so other tables keep their existing behavior. */
#masterlistTableWrap {
  max-height: 650px;
  overflow-y: auto;
}
#masterlistTableWrap table {
  border-collapse: separate;
  border-spacing: 0;
}
#masterlistTableWrap thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: inset 0 -2px 0 var(--gray-200);
  border-bottom: none;
}
.sort-icon {
  font-size: 0.85em;
  opacity: 0.7;
}
td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  font-size: 0.85em;
}
tbody tr { transition: background 0.2s ease; }
tbody tr:nth-child(even) { background: var(--gray-50); }
tbody tr:hover { background: rgba(41, 128, 185, 0.07); }
tbody tr:last-child td { border-bottom: none; }

#registrantsMainTable td {
  padding: 10px 12px;
  font-size: 0.86em;
  line-height: 1.4;
}
#registrantsMainTable th {
  padding: 10px 12px;
}
#registrantsMainTable .icon-btn svg {
  width: 14px;
  height: 14px;
}
#registrantsMainTable .icon-btn {
  padding: 5px 6px;
}

.badge-event {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.badge-10k { background: #1a5276; color: #fff; }
.badge-5k { background: #2e86c1; color: #fff; }
.badge-run { background: #d4ac0d; color: #1a1a1a; }
.badge-walk { background: #7d3c98; color: #fff; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 95%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}
.modal h2 {
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-100);
  font-weight: 700;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 24px;
  gap: 4px;
}
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 0.92em;
  font-family: inherit;
  cursor: pointer;
  color: var(--gray-600);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  font-weight: 500;
  border-radius: 8px 8px 0 0;
}
.tab-btn:hover { color: var(--primary); background: var(--gray-50); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
  background: rgba(41, 128, 185, 0.04);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Settings Tabs (enhanced) ---- */
.settings-tabs.tabs {
  border-bottom: none;
  gap: 6px;
  background: var(--gray-50);
  padding: 6px;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  border: 1px solid var(--gray-200);
}
.settings-tabs .tab-btn {
  border-bottom: none;
  margin-bottom: 0;
  border-radius: var(--radius);
  padding: 10px 22px;
  font-size: 0.9em;
  color: var(--gray-600);
  background: transparent;
  border: 1.5px solid transparent;
  letter-spacing: 0.2px;
}
.settings-tabs .tab-btn:hover {
  background: var(--white);
  color: var(--primary);
  border-color: var(--gray-200);
}
.settings-tabs .tab-btn.active {
  background: var(--white);
  color: var(--primary);
  font-weight: 700;
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(41, 128, 185, 0.12);
}

/* ---- Chips / Tags ---- */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-size: 0.88em;
  font-weight: 500;
  color: var(--gray-800);
  transition: var(--transition);
  cursor: default;
}
.chip:hover {
  border-color: var(--primary-light);
  background: rgba(41, 128, 185, 0.04);
}
.chip-edit, .chip-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  transition: var(--transition);
}
.chip-edit {
  color: var(--gray-400);
}
.chip-edit:hover {
  color: var(--primary);
}
.chip-delete {
  color: var(--gray-400);
  width: 18px;
  height: 18px;
}
.chip-delete:hover {
  color: var(--danger);
  background: rgba(231, 76, 60, 0.1);
}
.chip-add-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip-add-form input {
  width: 180px;
  padding: 7px 12px;
  font-size: 0.88em;
  border-radius: 20px;
}

/* ---- Section toggles ---- */
.section-toggle { display: none; }
.section-toggle.active { display: block; animation: sectionFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes sectionFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---- Misc ---- */
.text-center { text-align: center; }
.text-muted { color: var(--gray-600); }
.text-sm { font-size: 0.85em; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 16px; }

/* ---- Success Screen ---- */
.success-screen {
  text-align: center;
  padding: 50px 20px;
}

/* Animated Check */
.animated-check {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
}
.check-svg {
  width: 100%;
  height: 100%;
}
.check-circle {
  stroke: var(--success);
  stroke-width: 2;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  fill: none;
}
.check-path {
  stroke: var(--success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
}
.animated-check.animate .check-circle {
  animation: checkCircle 0.6s ease forwards;
}
.animated-check.animate .check-path {
  animation: checkMark 0.4s 0.4s ease forwards;
}

@keyframes checkCircle {
  to { stroke-dashoffset: 0; }
}
@keyframes checkMark {
  to { stroke-dashoffset: 0; }
}

/* Legacy check icon fallback */
.success-screen .check-icon {
  width: 80px;
  height: 80px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 2.5em;
  color: white;
}

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--gray-400);
  font-size: 0.95em;
  font-style: italic;
}

/* ---- Dashboard Views ---- */
.dashboard-views {
  margin-top: 8px;
}

/* ---- Dashboard Filter Bar (prominent viewing scope indicator) ---- */
.dash-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 16px;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 14px rgba(41, 128, 185, 0.3);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}
.dash-filter-bar.filter-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 4px 18px rgba(230, 126, 34, 0.45);
}
.dash-filter-label {
  font-size: 0.78em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255,255,255,0.85);
  margin: 0;
}
.dash-filter-select {
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.35);
  color: white;
  font-weight: 700;
  font-size: 0.92em;
  padding: 6px 32px 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  width: auto;
  min-width: 200px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  letter-spacing: 0.2px;
}
.dash-filter-select:hover {
  background-color: rgba(255,255,255,0.28);
  border-color: rgba(255,255,255,0.5);
}
.dash-filter-select:focus {
  outline: none;
  border-color: white;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25);
  background-color: rgba(255,255,255,0.28);
}
.dash-filter-select option,
.dash-filter-select optgroup {
  background: var(--white);
  color: var(--gray-800);
  font-weight: 500;
}

/* Dark mode tweaks */
html.dark .dash-filter-bar {
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

/* ---- Scrollbar Styling ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-50); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ---- Selection ---- */
::selection { background: rgba(41, 128, 185, 0.2); color: inherit; }
html.dark ::selection { background: rgba(93, 173, 226, 0.3); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .header h1 { font-size: 1.5em; }
  .header { padding: 28px 16px; }
  .admin-header { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
  .admin-header nav { flex-wrap: wrap; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-bar select, .filters-bar input { width: 100%; }
  .registrants-toolbar-top { flex-wrap: wrap; gap: 8px; }
  .registrants-filters { gap: 6px; }
  .registrants-filters select, .registrants-filters input { flex: 1; min-width: 100px; max-width: none; }
  .modal { padding: 20px; }
  .container-wide { padding: 16px; }
  .chart-bar-label { width: 80px; font-size: 0.78em; }
  .metric-cards { gap: 10px; }
  .metric-card { min-width: 100px; padding: 16px 10px; }
  .phone-input-group { flex-direction: column; }
  .phone-country-select { width: 100% !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .export-btn-group { flex-direction: column; }
}

/* ============================================================
   DARK MODE
   ============================================================ */
html.dark {
  --primary: #5dade2;
  --primary-light: #85c1e9;
  --primary-dark: #1b2631;
  --accent: #f0a944;
  --accent-dark: #d68910;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warning: #f4d03f;
  --gray-50: #1c2333;
  --gray-100: #232b3e;
  --gray-200: #2c3651;
  --gray-300: #3d4b66;
  --gray-400: #6b7fa0;
  --gray-600: #a0aec0;
  --gray-700: #c4cdd9;
  --gray-800: #e2e8f0;
  --gray-900: #f1f5f9;
  --white: #1a2234;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.45);
  color-scheme: dark;
}

html.dark body {
  background: #111827;
  color: var(--gray-800);
  transition: background 0.3s ease, color 0.3s ease;
}

html.dark .admin-header {
  background: linear-gradient(135deg, #0d1520, #162032);
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

html.dark .card,
html.dark .table-wrap,
html.dark .filters-bar,
html.dark .registrants-filters {
  background: var(--white);
  border-color: var(--gray-200);
}

html.dark .card:hover {
  box-shadow: var(--shadow-md);
}

html.dark .card h2 {
  color: var(--primary);
  border-bottom-color: var(--gray-200);
}

html.dark input,
html.dark select,
html.dark textarea {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-800);
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(93, 173, 226, 0.15);
}

html.dark th {
  background: var(--gray-100);
  color: var(--gray-600);
  border-bottom-color: var(--gray-200);
}

html.dark td {
  border-bottom-color: var(--gray-200);
}

html.dark tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

html.dark tbody tr:hover {
  background: rgba(93, 173, 226, 0.08);
}

html.dark .stat-card {
  background: var(--white);
  border-color: var(--gray-200);
}

html.dark .stat-card .stat-value {
  color: var(--primary);
}

html.dark .stat-card.accent .stat-value { color: var(--accent); }
html.dark .stat-card.success .stat-value { color: var(--success); }
html.dark .stat-card.premium .stat-value {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html.dark .stat-card::before {
  background: var(--primary);
}
html.dark .stat-card.accent::before { background: var(--accent); }
html.dark .stat-card.premium::before { background: linear-gradient(90deg, var(--accent), var(--success)); }

/* Dark mode badges */
html.dark .badge-10k { background: #2471a3; color: #fff; }
html.dark .badge-5k { background: #3498db; color: #fff; }
html.dark .badge-run { background: #f1c40f; color: #1a1a1a; }
html.dark .badge-walk { background: #9b59b6; color: #fff; }

/* Dark mode alerts */
html.dark .alert-success { background: rgba(46,204,113,0.12); border-color: var(--success); color: #2ecc71; }
html.dark .alert-error { background: rgba(231,76,60,0.12); border-color: var(--danger); color: #e74c3c; }
html.dark .alert-warning { background: rgba(244,208,63,0.12); border-color: var(--warning); color: #f4d03f; }
html.dark .alert-info { background: rgba(93,173,226,0.12); border-color: var(--primary); color: var(--primary); }

/* Dark mode modals */
html.dark .modal-overlay {
  background: rgba(0,0,0,0.7);
}
html.dark .modal {
  background: #1a2234;
  box-shadow: var(--shadow-xl);
}
html.dark .modal h2 {
  color: var(--primary);
  border-bottom-color: var(--gray-200);
}
html.dark .modal-actions {
  border-top-color: var(--gray-200);
}

/* Dark mode buttons */
html.dark .btn-outline {
  color: var(--primary);
  border-color: var(--primary);
}
html.dark .btn-outline:hover {
  background: var(--primary);
  color: #fff;
}
html.dark .btn-primary {
  background: var(--primary);
}

/* Dark mode chart bars */
html.dark .chart-bar-track {
  background: var(--gray-100);
}

/* Dark mode guest block */
html.dark .guest-block {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

/* Dark mode settings tabs */
html.dark .settings-tabs.tabs {
  background: var(--gray-100);
  border-color: var(--gray-200);
}
html.dark .settings-tabs .tab-btn {
  color: var(--gray-600);
}
html.dark .settings-tabs .tab-btn:hover {
  background: var(--white);
  border-color: var(--gray-200);
}
html.dark .settings-tabs .tab-btn.active {
  background: var(--white);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(93,173,226,0.15);
}

/* Dark mode dashboard tabs */
html.dark .tabs {
  border-bottom-color: var(--gray-200);
}
html.dark .tab-btn {
  color: var(--gray-600);
}
html.dark .tab-btn:hover {
  color: var(--primary);
  background: var(--gray-100);
}
html.dark .tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(93,173,226,0.06);
}

/* Dark mode report icons */
html.dark .report-icon {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

/* Dark mode confirm row */
html.dark .confirm-row {
  border-bottom-color: var(--gray-200);
}
html.dark .confirm-row.highlight {
  background: var(--gray-100);
}

/* Dark mode scrollbar */
html.dark ::-webkit-scrollbar-track { background: var(--gray-100); }
html.dark ::-webkit-scrollbar-thumb { background: var(--gray-300); }
html.dark ::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Dark mode summary box */
html.dark .summary-box {
  background: linear-gradient(135deg, #1b2631, #1a3c5e, #2471a3);
}

/* Dark mode metric cards */
html.dark .metric-card {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

/* Dark mode rate input */
html.dark .rate-prefix {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-600);
}

/* Dark mode login */
html.dark .login-container {
  background: linear-gradient(135deg, #0d1520, #1a2a3e);
}
html.dark .login-box {
  background: var(--white);
  box-shadow: var(--shadow-xl);
}

/* Dark mode landing */
html.dark .landing-body {
  color: var(--gray-800);
}
html.dark .landing-disclaimer {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-600);
}
html.dark .landing-footer {
  color: var(--gray-400);
}

/* Dark mode registration form */
html.dark .header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

/* Dark mode phone selector */
html.dark .flag-select-btn {
  background: var(--gray-100);
  border-color: var(--gray-200);
}
html.dark .flag-dropdown {
  background: var(--white);
  border-color: var(--gray-200);
  box-shadow: var(--shadow-lg);
}
html.dark .flag-option:hover {
  background: var(--gray-100);
}

/* Dark mode registrants toolbar */
html.dark .registrants-filters {
  background: var(--white);
  border-color: var(--gray-200);
}

/* Dark mode transition for all themed elements */
html.dark .card,
html.dark .table-wrap,
html.dark .stat-card,
html.dark .login-box,
html.dark .modal,
html.dark input,
html.dark select,
html.dark textarea {
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
