/* ==========================================================================
   SoccerNearMe — style.css
   Color scheme: Soccer Green (#1a7a3c) + White
   Mobile-first, system fonts, no CDN dependencies
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */

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

:root {
  --green-dark:   #145e2e;
  --green:        #1a7a3c;
  --green-light:  #22a050;
  --green-pale:   #e8f5ed;
  --white:        #ffffff;
  --grey-50:      #f8f9fa;
  --grey-100:     #f1f3f5;
  --grey-200:     #e9ecef;
  --grey-400:     #ced4da;
  --grey-600:     #6c757d;
  --grey-800:     #343a40;
  --text:         #212529;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 2px 8px rgba(0,0,0,.10);
  --shadow-card:  0 4px 16px rgba(0,0,0,.08);
  --transition:   0.2s ease;

  /* League badge colours */
  --badge-uslc:   #003087;
  --badge-usl1:   #e63946;
  --badge-uslsl:  #7209b7;
  --badge-mls:    #006cb5;
  --badge-nwsl:   #f72585;
  --badge-default:#555555;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  background: var(--grey-100);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  background: var(--green);
  color: var(--white);
  padding: 20px 16px 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.header-inner {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.logo-icon {
  font-size: 2rem;
  line-height: 1;
}

.logo-text {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.tagline {
  margin-top: 4px;
  font-size: 0.95rem;
  opacity: 0.85;
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   Search Panel
   -------------------------------------------------------------------------- */

.search-panel {
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  padding: 24px 16px;
}

.search-inner {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 2px 6px rgba(26,122,60,.3);
}

.btn-primary:hover {
  background: var(--green-dark);
  box-shadow: 0 4px 12px rgba(26,122,60,.4);
}

.btn-secondary {
  background: var(--grey-800);
  color: var(--white);
}

.btn-secondary:hover {
  background: #212529;
}

.btn-ghost {
  background: transparent;
  color: var(--green);
  padding: 6px 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-ghost:hover {
  background: var(--green-pale);
}

.btn-location {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.05rem;
}

.btn-icon {
  font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   OR Divider
   -------------------------------------------------------------------------- */

.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--grey-600);
  font-size: 0.85rem;
  font-weight: 500;
}

.or-line {
  flex: 1;
  height: 1px;
  background: var(--grey-200);
}

/* --------------------------------------------------------------------------
   City Search Row
   -------------------------------------------------------------------------- */

.city-search-row {
  display: flex;
  gap: 10px;
}

.input-city {
  flex: 1;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1.5px solid var(--grey-400);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
  min-width: 0;
}

.input-city:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,122,60,.12);
}

/* --------------------------------------------------------------------------
   More Options Panel
   -------------------------------------------------------------------------- */

.more-options-toggle {
  text-align: left;
}

.more-options-panel {
  padding: 16px;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
}

.more-options-panel[hidden] {
  display: none;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input-option {
  padding: 8px 10px;
  font-size: 0.9rem;
  border: 1.5px solid var(--grey-400);
  border-radius: var(--radius-sm);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.input-option:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,122,60,.12);
}

/* --------------------------------------------------------------------------
   Status Area (spinner + error)
   -------------------------------------------------------------------------- */

.status-area {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 16px;
}

.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
  gap: 14px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--grey-200);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-text {
  color: var(--grey-600);
  font-size: 0.95rem;
}

.error-box {
  margin-top: 24px;
  padding: 16px 20px;
  background: #fff5f5;
  border: 1px solid #ffc9c9;
  border-radius: var(--radius-sm);
  border-left: 4px solid #e63946;
}

.error-text {
  color: #c92a2a;
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   Results Section
   -------------------------------------------------------------------------- */

.results-section {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  flex: 1;
}

.results-section[hidden] {
  display: none;
}

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.results-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--grey-800);
}

.results-count {
  font-size: 0.88rem;
  color: var(--grey-600);
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 14px;
}

.empty-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--grey-800);
}

.empty-text {
  color: var(--grey-600);
  font-size: 0.95rem;
  max-width: 340px;
  margin: 0 auto;
}

#emptyActions {
  margin-top: 16px;
}

#emptyActions[hidden] {
  display: none;
}

#nearestSection {
  margin-top: 28px;
  text-align: left;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

#nearestSection[hidden] {
  display: none;
}

.nearest-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--grey-600);
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   Cards List
   -------------------------------------------------------------------------- */

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --------------------------------------------------------------------------
   Game Card
   -------------------------------------------------------------------------- */

.game-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.game-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  transform: translateY(-1px);
}

/* Card top row: league badge + distance badge */
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* League badge */
.league-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--badge-default);
}

.badge-usl-championship { background: var(--badge-uslc); }
.badge-usl-league-one   { background: var(--badge-usl1); }
.badge-usl-super-league { background: var(--badge-uslsl); }
.badge-mls              { background: var(--badge-mls); }
.badge-nwsl             { background: var(--badge-nwsl); }

/* Distance badge */
.distance-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-pale);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Match title */
.card-match {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

/* Date/time row */
.card-datetime {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--grey-600);
}

.card-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* Venue row */
.card-venue {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--grey-600);
}

/* Weather forecast row */
.card-weather {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--grey-600);
}

/* Directions button */
.card-actions {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-directions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  color: var(--green);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.btn-directions:hover {
  background: var(--green);
  color: var(--white);
}

.btn-tickets {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  color: var(--white);
  background: var(--green);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}

.btn-tickets:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.btn-tickets--fallback {
  background: transparent;
  color: var(--green);
}

.btn-tickets--fallback:hover {
  background: var(--green);
  color: var(--white);
}

/* --------------------------------------------------------------------------
   Promo Banner — hardcoded values for cross-browser compatibility
   -------------------------------------------------------------------------- */

.promo-banner {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: #1a6b2e;
  border-top: 2px solid rgba(0,0,0,.2);
  padding: 20px;
  margin-top: auto;
}

.promo-inner {
  max-width: 700px;
  margin: 0 auto;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 16px;
  box-sizing: border-box;
}

.promo-content {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
}

.promo-icon {
  font-size: 1.6rem;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  line-height: 1;
}

.promo-text {
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.45;
}

.promo-text strong {
  color: #ffffff;
  font-weight: 700;
}

.promo-btn {
  display: block;
  width: -webkit-fit-content;
  width: fit-content;
  box-sizing: border-box;
  min-height: 44px;
  padding: 12px 24px;
  background: #ffffff;
  color: #1a6b2e;
  font-size: 0.9rem;
  font-weight: bold;
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.promo-btn:hover {
  background: #e8f5ed;
}

.promo-btn:active {
  background: #d0ebd8;
}

/* Stack vertically on narrow mobile */
@media (max-width: 479px) {
  .promo-inner {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: stretch;
    align-items: stretch;
    gap: 12px;
  }

  .promo-btn {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 1rem;
    min-height: 48px;
    padding: 14px 24px;
    margin: 4px auto 0 auto;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  background: var(--grey-800);
  color: var(--grey-400);
  text-align: center;
  padding: 16px;
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Responsive — screens >= 480px
   -------------------------------------------------------------------------- */

@media (min-width: 480px) {
  .logo-text {
    font-size: 2rem;
  }

  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --------------------------------------------------------------------------
   Responsive — screens >= 600px (wider cards)
   -------------------------------------------------------------------------- */

@media (min-width: 600px) {
  .game-card {
    padding: 20px 24px;
  }

  .card-match {
    font-size: 1.18rem;
  }
}

/* --------------------------------------------------------------------------
   Narrow mobile (320px)
   -------------------------------------------------------------------------- */

@media (max-width: 360px) {
  .options-grid {
    grid-template-columns: 1fr;
  }

  .city-search-row {
    flex-direction: column;
  }

  .city-search-row .btn-secondary {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Location status line
   -------------------------------------------------------------------------- */

.location-status {
  font-size: 0.85rem;
  text-align: center;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.location-status[hidden] {
  display: none;
}

.location-status--detecting {
  color: var(--grey-600);
  background: var(--grey-100);
}

.location-status--success {
  color: var(--green-dark);
  background: var(--green-pale);
}

.location-status--hint {
  color: #7a4f00;
  background: #fff8e1;
}

.location-status--error {
  color: #842029;
  background: #f8d7da;
}

/* --------------------------------------------------------------------------
   Radius pills
   -------------------------------------------------------------------------- */

.radius-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.radius-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--grey-600);
  white-space: nowrap;
}

.radius-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.radius-pill {
  padding: 5px 14px;
  border: 2px solid var(--grey-400);
  border-radius: 20px;
  background: var(--white);
  color: var(--grey-800);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.radius-pill:hover {
  border-color: var(--green);
  color: var(--green);
}

.radius-pill--active {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
  font-weight: 600;
}

.radius-pill--active:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
}

/* Full-width league option in more-options grid */
.option-group--full {
  grid-column: 1 / -1;
}

/* --------------------------------------------------------------------------
   Feedback button (fixed, bottom-right)
   -------------------------------------------------------------------------- */

.feedback-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--green);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  opacity: 0.85;
  transition: opacity 0.15s, box-shadow 0.15s;
  z-index: 999;
}

.feedback-btn:hover {
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
