/* ============================================================================
   GC Events Showcase - IMPROVED Edition (v0.7.5-FINAL)
   Full Merged File: Static Filters, Fixed Search Layout, Nuclear Reset Button
   ============================================================================ */

:root {
  --primary: #8d2303;
  --primary-dark: #6b1a02;
  --secondary: #6b7280;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --bg-light: #f9fafb;
  --bg-white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

/* ============================================================================
   CONTAINER & HEADER
   ============================================================================ */
.gc-es {
  max-width: 1400px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.discovery-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 0;
}

.discovery-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

.discovery-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================================
   FILTERS CONTAINER (STATIC / NON-STICKY)
   ============================================================================ */
.gc-filters--compact {
  position: relative; 
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.gc-filters__row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.gc-filters__row:last-child {
  margin-bottom: 0;
}

/* ============================================================================
   SEARCH FIELDS & INPUTS (Layout Fix)
   ============================================================================ */
.gc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* SEARCH: Grow to fill space, but share with Sort */
.gc-field--search {
  position: relative;
  flex: 2 1 300px; /* Grow: 2, Shrink: 1, Min: 300px */
  max-width: 600px;
  width: auto;
}

/* SORT: Smaller, fixed size */
.gc-field--sort {
  flex: 1 1 200px; /* Grow: 1, Shrink: 1, Min: 200px */
  max-width: 250px; 
  width: auto;
}

.gc-field input[type="search"],
.gc-field input[type="date"],
.gc-field select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 16px;
  background: var(--bg-white);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.gc-field input[type="search"]:focus,
.gc-field input[type="date"]:focus,
.gc-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(141, 35, 3, 0.1);
}

.search-status {
  position: absolute;
  right: 16px;
  top: 50%;
  margin-top: 2px; /* Slight visual adjustment */
  transform: translateY(-50%);
  font-size: 0.875rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-light);
  color: var(--text-secondary);
  display: none;
}
.search-status--loading { display: block; }
.search-status--location { display: block; color: var(--primary); background: rgba(141, 35, 3, 0.1); }

/* ============================================================================
   CHIPS, TAXONOMY BUTTONS & RESET
   ============================================================================ */
.gc-chips {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- DATE CHIP STYLING --- */
.gc-chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--bg-white);
  color: var(--text-secondary) !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

/* Hover disabled on Active Button */
.gc-chip:not(.is-active):hover {
  background: #ffffff; 
  color: var(--primary-dark) !important; 
  border-color: var(--primary-dark);
  transform: scale(1.1); 
  z-index: 10; 
  box-shadow: var(--shadow-sm);
}

.gc-chip.is-active {
  background: var(--primary);
  color: #fff !important;
  border-color: var(--primary);
  transform: scale(1);
  z-index: 1;
}

.gc-customdates {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gc-customdates[hidden] { display: none !important; }

/* Taxonomy Row */
.gc-taxrow {
  display: flex;
  justify-content: center;
  align-items: center; 
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.gc-taxbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px;
  min-width: 90px;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-white);
  color: var(--text-primary) !important;
  text-decoration: none;
  transition: all 0.2s;
}

.gc-taxbtn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.gc-taxbtn.is-active {
  background: var(--bg-white);
  color: var(--primary) !important;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(141, 35, 3, 0.1);
}

.gc-taxbtn .emoji { font-size: 24px; margin-bottom: 4px; line-height: 1; }
.gc-taxbtn .tlabel { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }

/* ============================================================================
   RESET BUTTON - THE NUCLEAR OPTION (Fixes Safari/Chrome Styling)
   ============================================================================ */
/* We target the ID (#gc-es-form) to override any generic theme buttons */
#gc-es-form .gc-taxrow button.gc-btn-reset,
#gc-es-form .gc-taxrow a.gc-btn-reset {
  /* Layout */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: auto !important;
  height: auto !important;
  min-height: 44px !important;
  padding: 0 20px !important;
  margin: 0 0 0 12px !important;
  
  /* Reset Browser Defaults */
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
  background-image: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  text-shadow: none !important;
  outline: none !important;
  
  /* The "Red Alert" Style */
  border: 2px solid #d32f2f !important;
  border-radius: 8px !important;
  color: #d32f2f !important;
  
  /* Typography */
  font-family: inherit !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
  text-transform: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

/* Hover / Focus / Active States */
#gc-es-form .gc-taxrow button.gc-btn-reset:hover,
#gc-es-form .gc-taxrow a.gc-btn-reset:hover,
#gc-es-form .gc-taxrow button.gc-btn-reset:focus,
#gc-es-form .gc-taxrow a.gc-btn-reset:focus,
#gc-es-form .gc-taxrow button.gc-btn-reset:active {
  background-color: #d32f2f !important; /* Red Fill */
  background-image: none !important;
  color: #ffffff !important;            /* White Text */
  border-color: #d32f2f !important;
  box-shadow: 0 4px 6px -1px rgba(211, 47, 47, 0.3) !important;
  transform: translateY(-1px) !important;
  text-decoration: none !important;
}

/* ============================================================================
   VIEW CONTROLS & RESULTS BAR
   ============================================================================ */
.view-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.view-toggle {
  background: var(--bg-white);
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

/* --- VIEW BUTTON STYLING --- */
.viewbtn {
  padding: 8px 24px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent; 
  background: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Hover disabled on Active Button */
.viewbtn:not(.is-active):hover {
  background: #ffffff; 
  color: var(--primary-dark) !important; 
  border-color: var(--primary-dark);
  transform: scale(1.1); 
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.viewbtn.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.results-bar {
  text-align: center;
  padding: 1rem;
  margin-bottom: 1.5rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.results-bar strong { color: var(--text-primary); }

/* ============================================================================
   DATE SECTIONS & GRID
   ============================================================================ */
.date-section { margin-bottom: 2.5rem; }
.section-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-heading .count { font-size: 1rem; font-weight: 500; color: var(--text-muted); }

.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ============================================================================
   EVENT CARDS
   ============================================================================ */
.event-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.event-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--primary);
}

.event-card.is-highlighted {
  box-shadow: 0 0 0 3px rgba(141, 35, 3, 0.3);
  border-color: var(--primary);
}

.card-image {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--bg-light);
  flex-shrink: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.event-card:hover .card-image img { transform: scale(1.05); }

.event-badge, .online-badge {
  position: absolute;
  top: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
}
.event-badge { left: 12px; }
.online-badge { right: 12px; }

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  line-height: 1.3;
}
.card-title a { color: var(--text-primary); text-decoration: none; }
.card-title a:hover { color: var(--primary); }

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.meta-distance { color: var(--primary); font-weight: 600; }

.card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.btn-view-details {
  flex: 1;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
}
.btn-view-details:hover { background: var(--primary-dark); }

.btn-save-event {
  padding: 8px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.btn-save-event:hover { border-color: var(--primary); }
.btn-save-event.is-saved { color: #ef4444; border-color: #ef4444; background: #fff0f0; }

/* ============================================================================
   HORIZONTAL LIST VIEW
   ============================================================================ */
.grid.view-list {
  grid-template-columns: 1fr;
  max-width: 900px;
  margin: 0 auto;
}

.grid.view-list .event-card {
  flex-direction: row;
  min-height: 180px;
}

.grid.view-list .card-image {
  width: 260px;
  height: auto;
  border-right: 1px solid var(--border);
}

.grid.view-list .card-body {
  padding: 1.5rem;
  justify-content: center;
}

.grid.view-list .card-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.grid.view-list .card-description {
  -webkit-line-clamp: 2;
  margin-bottom: 1rem;
}

.grid.view-list .card-footer {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  justify-content: flex-start;
}

.grid.view-list .btn-view-details {
  flex: 0 0 auto;
  padding: 8px 24px;
}

/* ============================================================================
   MAP VIEW
   ============================================================================ */
.gc-map-wrap {
  height: 600px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}

.gc-es-map {
  width: 100%;
  height: 100%;
}

.leaflet-popup-content-wrapper { border-radius: 8px; overflow: hidden; padding: 0; }
.leaflet-popup-content { margin: 0 !important; width: 280px !important; }

.map-popup { display: flex; flex-direction: column; }
.map-popup-image { width: 100%; height: 120px; object-fit: cover; background: var(--bg-light); }
.map-popup-body { padding: 12px; }
.map-popup-title { font-size: 1rem; font-weight: 700; margin: 0 0 8px; color: var(--primary); line-height: 1.3; }
.map-popup-meta { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.4; }
.map-popup-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: var(--primary);
  color: white !important;
  text-align: center;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
}
.map-popup-btn:hover { background: var(--primary-dark); }

/* ============================================================================
   UTILITY & RESPONSIVE
   ============================================================================ */
.no-results {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.no-results p { font-size: 1.2rem; margin-bottom: 1rem; }

@media (max-width: 768px) {
  .discovery-title { font-size: 1.875rem; }
  
  .gc-filters__row { gap: 8px; }
  .gc-taxbtn { width: 90px; padding: 8px; }
  .gc-taxbtn .emoji { font-size: 20px; }
  .gc-taxbtn .tlabel { font-size: 11px; }
  
  .grid.view-list .event-card { flex-direction: column; }
  .grid.view-list .card-image { width: 100%; height: 200px; border-right: none; }
  .grid.view-list .card-footer { padding-top: 1rem; border-top: 1px solid var(--border); }
  .grid.view-list .btn-view-details { width: 100%; flex: 1; }
  
  .gc-map-wrap { height: 400px; }
}
/* ==========================================================================
   Series-aware tile date display  (bs-tile-when)
   ========================================================================== */

.meta-date .meta-date-rich {
  display: block;
  line-height: 1.28;
}
.meta-date .meta-date-rich .bs-tile-when {
  display: block;
}
.meta-date .meta-date-rich .bs-tile-when__line {
  display: block;
  margin: 0;
}
.meta-date .meta-date-rich .bs-tile-when__line + .bs-tile-when__line {
  margin-top: 2px;
}
.meta-date .meta-date-rich .bs-tile-when__line--series {
  font-weight: 600;
}
.meta-date .meta-date-rich .bs-tile-when__line--next {
  font-size: 0.95em;
  opacity: 0.9;
}
.meta-date .meta-date-rich .bs-tile-when__label {
  font-weight: 600;
}
