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

/* ============================================
   DESIGN TOKENS
   All colors, shadows and radii in one place.
   Change a value here and it updates everywhere.
   ============================================ */
:root {
  --green-dark:  #1a4a2e;
  --green-main:  #2d6a4f;
  --green-light: #52b788;
  --green-pale:  #d8f3dc;
  --red-light:   #ffe0e0;
  --red-text:    #7f1d1d;
  --gray-bg:     #f4f6f4;
  --gray-card:   #ffffff;
  --gray-border: #e5e9e6;
  --gray-text:   #4a5568;
  --gray-muted:  #8a9ba8;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --radius-sm:   8px;
  --radius-md:   12px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-bg);
  color: #2d3748;
  min-height: 100vh;
}

/* Form elements don't inherit font by default */
input, select, button {
  font-family: inherit;
}

/* ============================================
   HEADER
   ============================================ */
header {
  background: var(--green-dark);
  color: white;
  text-align: center;
  padding: 48px 20px 40px;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

header p {
  font-size: 1rem;
  opacity: 0.75;
}

/* ============================================
   PAGE LAYOUT
   ============================================ */
.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* ============================================
   SEARCH BAR
   White box containing the text search and
   the postcode + distance distance inputs.
   ============================================ */
#search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f0f4f1;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}

#search-input {
  width: 100%;
  padding: 7px 14px;
  font-size: 14px;
  color: #374151;
  background: #f9fafb;
  border: 1.5px solid #d1d5db;
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

#search-input:focus {
  border-color: var(--green-main);
  background: white;
}

#search-input::placeholder {
  color: #9ca3af;
}

/* Postcode and distance dropdown sit side by side */
#distance-filter {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

#postnummer-input {
  width: 120px;
  padding: 7px 14px;
  font-size: 14px;
  color: #374151;
  background: #f9fafb;
  border: 1.5px solid #d1d5db;
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

#postnummer-input:focus {
  border-color: var(--green-main);
  background: white;
}

#postnummer-input::placeholder {
  color: #9ca3af;
}

/* Custom arrow replaces the native select arrow */
#distance-select {
  padding: 7px 30px 7px 14px;
  font-size: 14px;
  color: #374151;
  background: #f9fafb;
  border: 1.5px solid #d1d5db;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s;
}

#distance-select:focus {
  border-color: var(--green-main);
}

/* ============================================
   FILTER BAR
   Tinted box with status and county filters.
   Filter buttons injected here by app.js.
   ============================================ */
#filter-bar {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  background: #f0f4f1;
  border-radius: var(--radius-md);
  border: 1px solid #d8e4db;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

/* Each filter section: a label above a row of buttons */
.filter-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green-main);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Scrollable pill row — no wrapping on mobile */
.filter-group {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.filter-group::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  padding: 5px 13px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-text);
  background: white;
  border: 1.5px solid var(--gray-border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--green-light);
  color: var(--green-main);
}

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

/* ============================================
   COURSE GRID
   ============================================ */
#course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* ============================================
   COURSE CARD
   ============================================ */
.course-card {
  background: var(--gray-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

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

/* Dark green header strip with logo and course name */
.course-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--green-dark);
  padding: 16px 20px;
}

.course-card-header a {
  flex-shrink: 0;
}

.course-logo {
  height: 40px;
  width: auto;
  background: white;
  border-radius: 6px;
  padding: 4px;
  object-fit: contain;
}

.course-card-header h2 {
  color: white;
  font-size: 1rem;
  font-weight: 600;
}

.course-card-body {
  padding: 16px 20px;
}

/* ============================================
   STATUS ROWS
   ============================================ */
.status-section {
  margin-bottom: 16px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-border);
  font-size: 0.9rem;
}

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

.status-label {
  color: var(--gray-text);
  font-weight: 500;
}

/* Colored dot in the top-right of each card header */
.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}

.status-dot.green  { background: #38a169; box-shadow: 0 0 6px rgba(56, 161, 105, 0.5); }
.status-dot.yellow { background: #d69e2e; box-shadow: 0 0 6px rgba(214, 158, 46, 0.5); }
.status-dot.red    { background: #e53e3e; box-shadow: 0 0 6px rgba(229, 62, 62, 0.5); }

/* Free-text status message from the club, with a link to their site */
.status-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 12px 0;
  font-size: 0.85rem;
  color: #78350f;
  line-height: 1.5;
}

.status-note-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.status-note-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-note-content p {
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.status-note-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: #92400e;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.status-note-link:hover {
  color: #78350f;
  text-decoration: underline;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge.open    { background: var(--green-pale); color: var(--green-dark); }
.badge.closed  { background: var(--red-light);  color: var(--red-text); }
.badge.unknown { background: #f0f0f0;            color: #666; }

/* ============================================
   WEATHER SECTION
   ============================================ */
.weather-section {
  border-top: 1px solid var(--gray-border);
  padding: 12px 0 16px;
}

.weather-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gray-muted);
  margin-bottom: 2px;
}

.weather-day {
  margin-bottom: 10px;
}

.weather-day:last-child {
  margin-bottom: 0;
}

.weather-date {
  font-size: 0.68rem;
  color: var(--gray-muted);
  margin-bottom: 6px;
}

/* Four equal columns, one per time slot */
.weather-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.weather-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f8faf8;
  border: 0.5px solid #e5ebe5;
  border-radius: 8px;
  padding: 8px 6px;
}

.weather-cell-time {
  font-size: 10px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-cell-main {
  display: flex;
  align-items: center;
  gap: 4px;
}

.weather-cell-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.weather-cell-temp {
  font-size: 18px;
  font-weight: 500;
  color: #111827;
}

.weather-cell-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.weather-cell-wind,
.weather-cell-rain {
  font-size: 10px;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */
.hidden {
  display: none;
}

#loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-muted);
  font-size: 0.95rem;
}

#error {
  text-align: center;
  padding: 40px 20px;
  color: var(--red-text);
  background: var(--red-light);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

/* ============================================
   MOBILE — max 640px
   Search inputs stack vertically and fill
   the full width. Filter buttons scroll
   horizontally so they never wrap.
   ============================================ */
@media (max-width: 640px) {
  .page-content {
    padding: 16px 12px;
  }

  #search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  /* Postcode and distance sit side by side, each taking half the width */
  #distance-filter {
    gap: 6px;
  }

  #postnummer-input,
  #distance-select {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .filter-btn {
    font-size: 0.8rem;
    padding: 5px 12px;
  }
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  margin-top: 48px;
  padding: 24px 16px;
  border-top: 1px solid var(--gray-border);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-meta {
  font-size: 0.8rem;
  color: var(--gray-muted);
}

.footer-disclaimer {
  font-size: 0.78rem;
  color: var(--gray-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}
