/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Refined Color Palette */
  --primary-blue: #003C71;
  --primary-red: #B91C1C;
  --deep-navy: #0A1628;
  --warm-gray: #F5F3F0;
  --medium-gray: #D1CCC7;
  --charcoal: #2C3E50;
  --gold-accent: #D4AF37;
  --wheelchair-accent: #5B21B6;
  
  /* Text Colors */
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  
  /* UI Colors */
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);
}

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--warm-gray);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Roboto', 'Arial', sans-serif;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--deep-navy);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* Top Navigation */
.top-nav {
  background-color: var(--deep-navy);
  border-bottom: 1px solid var(--gold-accent);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  display: flex;
  align-items: center;
}

.logo-text {
  font-family: 'Roboto', sans-serif;
  font-weight: 900;
  font-size: 1.125rem;
  color: white;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-link {
  color: var(--warm-gray);
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

/* Hero Section */
.hero-section {
  position: relative;
  height: 280px;
  overflow: hidden;
  background: var(--deep-navy);
}

.hero-image-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-pattern {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0.1;
  background-image: 
    repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,255,255,.1) 35px, rgba(255,255,255,.1) 70px),
    repeating-linear-gradient(-45deg, transparent, transparent 35px, rgba(255,255,255,.05) 35px, rgba(255,255,255,.05) 70px);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(10,22,40,0.9) 0%, rgba(0,60,113,0.8) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  color: white;
  text-align: center;
  padding: 60px 20px;
  max-width: 800px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  background-color: var(--gold-accent);
  color: var(--deep-navy);
  padding: 0.375rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  font-family: 'Roboto', sans-serif;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 300;
  margin-bottom: 0.75rem;
  color: white;
  letter-spacing: -0.5px;
  font-family: 'Georgia', serif;
}

.hero-subtitle {
  font-size: 1.125rem;
  font-weight: 400;
  opacity: 0.9;
  font-style: italic;
  color: var(--warm-gray);
}

/* Main Content */
.main-content {
  background-color: var(--warm-gray);
  min-height: calc(100vh - 280px);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Search Section */
.search-section {
  background-color: white;
  border-radius: 8px;
  padding: 0;
  margin: -3rem auto 2rem;
  position: relative;
  z-index: 10;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  overflow: hidden;
}

.section-header {
  background: linear-gradient(135deg, var(--charcoal) 0%, var(--deep-navy) 100%);
  color: white;
  padding: 2rem;
  border-bottom: 3px solid var(--gold-accent);
}

.section-title {
  color: white;
  margin-bottom: 0.5rem;
  font-size: 2rem;
  font-weight: 600;
}

.section-description {
  color: rgba(255,255,255,0.9);
  font-size: 1.125rem;
  opacity: 0.95;
}

/* Search Tabs */
.search-tabs {
  display: flex;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 1.5rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  position: relative;
  transition: all 0.3s ease;
  font-family: 'Roboto', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.75px;
}

.tab-btn i {
  font-size: 1.125rem;
}

.tab-btn:hover {
  background-color: rgba(0,60,113,0.05);
  color: var(--primary-blue);
}

.tab-btn.active {
  background-color: white;
  color: var(--primary-red);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 3px;
  background-color: var(--primary-red);
  border-radius: 3px 3px 0 0;
}

.tab-panel {
  display: none;
  padding: 3rem 2rem;
  background-color: white;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

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

/* Unified Search Container */
.unified-search-container {
  max-width: 800px;
  margin: 0 auto;
}

.search-section-card {
  padding: 2rem;
  background-color: #fafafa;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.search-section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.search-section-header i {
  font-size: 1.75rem;
  color: var(--primary-red);
}

.search-section-header h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--deep-navy);
  font-weight: 600;
}

.search-description {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.6;
  padding-left: 2.75rem;
}

.search-row {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  padding-left: 2.75rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.9375rem;
  transition: all 0.3s ease;
  font-family: 'Georgia', serif;
}

.search-input.large {
  padding: 1rem 1.25rem;
  font-size: 1.0625rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0,60,113,0.1);
}

.divider-line {
  height: 1px;
  background: linear-gradient(to right, transparent, #d0d0d0, transparent);
  margin: 2rem 0;
}

/* Buttons */
.btn {
  padding: 1rem 2rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-family: 'Roboto', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  border: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn i {
  font-size: 0.875rem;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.2);
  transition: left 0.3s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-red), #a01818);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #a01818, var(--primary-red));
}

.btn.large {
  padding: 1.125rem 2.5rem;
  font-size: 1.0625rem;
}

/* Filter Buttons */
.filter-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 2rem 0;
  padding-left: 2.75rem;
}

.filter-btn {
  padding: 0.5rem 1.5rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Roboto', sans-serif;
}

.filter-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.filter-btn.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

/* Year Results Table */
#yearResultsDisplay {
  margin-top: 2rem;
}

.year-results-table {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.results-table-header,
.results-table-row {
  display: grid;
  grid-template-columns: 80px 2fr 100px 80px 60px 2fr 80px;
  padding: 1rem;
  align-items: center;
  gap: 1rem;
}

.results-table-header {
  background: var(--primary-blue);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-table-row {
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.results-table-row:hover {
  background-color: #fafafa;
}

.results-table-row:last-child {
  border-bottom: none;
}

/* Column specific styles */
.col-place {
  text-align: center;
}

.col-name {
  font-weight: 500;
}

.col-time {
  text-align: center;
  font-family: monospace;
}

.col-gender,
.col-age,
.col-bib {
  text-align: center;
}

.col-town {
  color: var(--text-secondary);
}

/* Pagination */
.pagination-info {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
}

.page-indicator {
  font-weight: 500;
  color: var(--text-secondary);
}

.btn-secondary {
  background: #f8f9fa;
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover:not(:disabled) {
  background: #e0e0e0;
  border-color: var(--primary-blue);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* FRR Counter */
.frr-counter-container {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem;
}

.frr-counter-header {
  margin-bottom: 3rem;
}

.frr-counter-header i {
  font-size: 3rem;
  color: var(--gold-accent);
  margin-bottom: 1.5rem;
}

.frr-counter-header h2 {
  color: var(--deep-navy);
  margin-bottom: 0.75rem;
  font-size: 2.25rem;
}

.frr-counter-header p {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 1.125rem;
}

.frr-counter-search {
  display: flex;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Results Section */
.results-section {
  background-color: white;
  border-radius: 8px;
  padding: 3rem;
  min-height: 400px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.welcome-message {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.welcome-message i {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  opacity: 0.3;
  color: var(--primary-blue);
}

.welcome-message h3 {
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-size: 1.75rem;
}

.welcome-message p {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Result Items */
.result-item {
  background-color: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 1rem;
  overflow: hidden;
  transition: all 0.3s ease;
}

.result-item:hover {
  border-color: var(--primary-red);
  box-shadow: 0 4px 12px rgba(185,28,28,0.1);
}

.result-header {
  padding: 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fafafa;
  border-bottom: 1px solid #e0e0e0;
}

.result-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 600;
  color: var(--deep-navy);
  font-family: 'Roboto', sans-serif;
  font-size: 1.125rem;
}

.result-count {
  background-color: var(--primary-red);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wheelchair-badge {
  background: linear-gradient(135deg, var(--primary-blue), var(--wheelchair-accent));
  color: white;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.wheelchair-badge i {
  font-size: 0.8125rem;
}

.details {
  display: none;
  padding: 0;
  background-color: white;
}

.details.show {
  display: block;
}

.result-entry {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f0f0f0;
  display: grid;
  grid-template-columns: 90px 1fr auto auto auto auto auto;
  gap: 1rem;
  align-items: center;
  font-size: 0.9375rem;
  transition: background-color 0.2s ease;
}

.result-entry:last-child {
  border-bottom: none;
}

.result-entry:hover {
  background-color: #fafafa;
}

.year-badge {
  background-color: var(--deep-navy);
  color: white;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.875rem;
  text-align: center;
  font-family: 'Roboto', sans-serif;
}

.time-display {
  font-family: 'Monaco', 'Courier New', monospace;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--primary-red);
}

.place-display {
  background-color: var(--gold-accent);
  color: var(--deep-navy);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.875rem;
}

.gender-place-display {
  background-color: var(--primary-blue);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
}

/* Streak Results */
.streak-result {
  background: linear-gradient(135deg, var(--deep-navy) 0%, var(--primary-blue) 100%);
  color: white;
  padding: 3rem;
  border-radius: 8px;
  margin-top: 2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}

.streak-result::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(212,175,55,0.1) 0%, transparent 70%);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(30%) translateY(30%); }
}

.streak-result h2 {
  font-size: 2.5rem;
  margin-bottom: 2.5rem;
  text-align: center;
  color: white;
  font-weight: 300;
  position: relative;
  z-index: 1;
}

.streak-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2.5rem;
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 1;
}

.streak-stat {
  text-align: center;
}

.streak-stat-number {
  display: block;
  font-size: 3rem;
  font-weight: 900;
  color: var(--gold-accent);
  font-family: 'Roboto', sans-serif;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.streak-stat-label {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.9;
}

.streak-years {
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 2.5rem;
  position: relative;
  z-index: 1;
}

.streak-years h4 {
  color: white;
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  text-align: center;
}

.year-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.year-tag {
  background-color: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9375rem;
  font-family: 'Roboto', sans-serif;
  transition: all 0.2s ease;
}

.year-tag:hover {
  background-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem;
  color: var(--text-secondary);
}

.loading i {
  font-size: 3rem;
  color: var(--primary-red);
  animation: pulse 1.5s ease-in-out infinite;
  margin-bottom: 1.5rem;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.loading span {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Footer */
.footer {
  background-color: var(--deep-navy);
  color: var(--warm-gray);
  padding: 2rem 0;
  margin-top: 4rem;
  border-top: 2px solid var(--gold-accent);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
  font-size: 0.9375rem;
  opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .search-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tab-btn {
    padding: 1.25rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .tab-btn i {
    font-size: 1rem;
  }
  
  .search-row {
    flex-direction: column;
    padding-left: 0;
  }
  
  .search-description {
    padding-left: 0;
  }
  
  .frr-counter-search {
    flex-direction: column;
  }
  
  .result-entry {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .result-entry span {
    display: inline-block;
    margin-right: 0.75rem;
  }
  
  .streak-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .filter-buttons {
    flex-wrap: wrap;
    padding-left: 0;
  }
  
  .filter-btn {
    flex: 1;
    min-width: 100px;
  }

  .results-table-header,
  .results-table-row {
    grid-template-columns: 60px 1fr 80px;
    font-size: 0.875rem;
  }

  .col-gender,
  .col-age,
  .col-town,
  .col-bib {
    display: none;
  }

  .pagination-controls {
    flex-direction: column;
    gap: 1rem;
  }

  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* Print Styles */
@media print {
  .top-nav, .hero-section, .search-section, .footer {
    display: none;
  }
  
  .main-content {
    background: white;
  }
  
  .results-section {
    box-shadow: none;
    border: none;
  }
}
