/* ============================================================================
   GC Events Showcase - IMPROVED Edition (v0.6.3)
   Full Merged File: Sticky Filters, Centered Layout, List View, Maps
   ============================================================================ */

: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;
}

/* ============================================================================
   STICKY FILTERS (CENTERED & GLASSMORPHISM)
   ============================================================================ */
.gc-filters--compact {
  position: sticky;
  top: 0;
  z-index: 1000; /* High z-index to stay above map elements */
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px); /* Modern glass effect */
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px -10px rgba(0,0,0,0.1);
}

/* WordPress Admin Bar Offset */
body.admin-bar .gc-filters--compact {
  top: 32px;
}

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

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

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

/* Search Field - Centered & Sized */
.gc-field--search {
  position: relative;
  width: 100%;
  max-width: 500px; /* Better width for addresses */
}

.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; /* Pill shape */
  font-size: 16px; /* Prevents zoom on mobile */
  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 Icon */
.search-status {
  position: absolute;
  right: 16px;
  top: 50%;
  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;
}

.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;
}

.gc-chip:hover {
  border-color: var(--primary);
  color: var(--primary) !important;
}

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

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

/* Taxonomy Row */
.gc-taxrow {
  display: flex;
  justify-content: 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 */
.gc-btn-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 44px;
  padding: 0 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  border: none;
  background: none;
  transition: color 0.2s;
}
.gc-btn-reset:hover { color: #ef4444; }

/* ============================================================================
   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);
}

.viewbtn {
  padding: 8px 24px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  transition: all 0.2s;
}

.viewbtn:hover { background: rgba(0,0,0,0.05); }
.viewbtn.is-active { background: var(--primary); color: white; }

.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 (Used for Tiles AND List view)
   ============================================================================ */
.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 */
.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); }

/* Badges */
.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 Content */
.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;
  /* Truncate text */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  margin-top: auto; /* Pushes footer to bottom */
  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); }

/* Save Heart Button */
.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 FORMATTING
   Applied when container has class .view-list
   ============================================================================ */
.grid.view-list {
  grid-template-columns: 1fr; /* Force single column */
  max-width: 900px;
  margin: 0 auto;
}

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

.grid.view-list .card-image {
  width: 260px; /* Fixed width for list image */
  height: auto; /* Full height */
  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; /* Fewer lines in list view */
  margin-bottom: 1rem;
}

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

.grid.view-list .btn-view-details {
  flex: 0 0 auto; /* Don't stretch button */
  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 Styling */
.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; }

/* Responsive Adjustments */
@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; }
  
  /* Stack List View on Mobile */
  .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; }
}