/* ================================================
   events.css - Events Page Specific Styles
   KOD Müzik Website

   Contents:
   1. Events Header
   2. Filters Section
   3. Events Grid & Cards
   4. Loading & Error States
   5. Responsive Overrides
   ================================================ */

/* 1. Events Header
   ================================================ */
.events-header {
  /* Top padding is now handled by .main-content for alignment with logo */
  padding: 0 0 2rem;
  border-bottom: 1px solid var(--color-border-light);
}

.events-title {
  /* Match About/Contact title typography */
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.events-subtitle {
  color: var(--color-muted);
  font-weight: 300;
}

/* 2. Filters Section
   ================================================ */
.filters-section {
  padding: 1.25rem 0 0.5rem; /* tighter bottom spacing */
  background: transparent; /* panel itself gets the style */
  border-bottom: none;
  /* Ensure dropdowns overlay the events grid/cards below */
  position: relative;
  z-index: 2;
}

.filters-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 1.25rem 2rem; /* internal padding for the glass panel */

  /* Glassmorphism panel to match cards */
  background: var(--glass-gradient), var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-medium);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Specific widths for each filter - percentage based with shrink allowed */
.filter-group:nth-child(1) {
  /* Genre: 25% */
  flex: 0 1 25%;
  min-width: 0;
}

.filter-group:nth-child(2) {
  /* Year: 20% */
  flex: 0 1 20%;
  min-width: 0;
}

.filter-group:nth-child(3) {
  /* Venue: 30% */
  flex: 0 1 30%;
  min-width: 0;
}

.filter-group:nth-child(4) {
  /* Artist: 25% */
  flex: 0 1 25%;
  min-width: 0;
}

.filter-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.filter-input {
  background: var(--color-background); /* match Genre/Year/Venue triggers */
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: var(--spacing-input);
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  transition: var(--transition-speed);
  font-family: var(--font-primary);
  width: 100%;
}

/* Placeholder color to match the rest of the filters */
.filter-input::placeholder {
  color: var(--color-muted);
  opacity: 1; /* ensure consistent tone across browsers */
}

.filter-input:focus {
  outline: none;
  border-color: var(--color-muted);
}

/* Native select styling to align with inputs */
.filter-select {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: var(--spacing-input);
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  transition: var(--transition-speed);
  font-family: var(--font-primary);
  width: 100%;
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-muted);
}

/* Custom Select Dropdown */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: var(--spacing-input);
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  font-family: var(--font-primary);
  transition: var(--transition-speed);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.custom-select-trigger:focus,
.custom-select.is-open .custom-select-trigger {
  outline: none;
  border-color: var(--color-muted);
}

.custom-select-arrow {
  width: 10px;
  height: 10px;
  transition: transform var(--transition-speed);
}

.custom-select.is-open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
  z-index: 999;
  max-height: 200px;
  overflow-y: auto;
}

.custom-select-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color var(--transition-speed);
}

.custom-select-option:hover,
.custom-select-option.is-focused {
  background-color: rgba(255, 255, 255, 0.05);
}

.custom-select-option[aria-selected="true"] {
  background-color: rgba(255, 255, 255, 0.1);
  font-weight: 500;
}

.custom-select-option.is-disabled {
  color: var(--color-text);
  opacity: 0.4;
  cursor: not-allowed;
  background-color: transparent;
}
/* Year filter: let grid control width, reduced by 15% via percentage in grid */
.year-filter {
  width: 100%; /* fill grid column */
  align-self: stretch; /* use full grid column width */
}

/* Keep search input consistent with others */
.artist-filter.filter-input {
  background-color: var(--color-background);
}

.filter-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  flex: 0 0 auto;
  margin-left: auto;
}

.clear-filters {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition-speed);
  white-space: nowrap;
  font-family: var(--font-primary);
}

.clear-filters:hover {
  border-color: var(--color-text);
  color: var(--color-text);
}

.results-count {
  display: none !important; /* Hide total/results count everywhere */
}

/* 3. Events Grid & Cards
   ================================================ */
.events-section {
  /* Bring results even closer to the search panel */
  padding: 0.5rem 0 3rem;
  min-height: 400px;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  /* Squares derive height from width via aspect-ratio */
  align-items: start; /* let cards keep square aspect; no stretching */
  /* Constrain the grid to a max of ~4 columns and center it */
  max-width: 1340px;
  margin-left: auto;
  margin-right: auto;
}

.event-card {
  background: var(--glass-gradient), var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-medium);
  padding: 3rem 1.5rem;
  transition: var(--transition-speed);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

.event-card:hover {
  background:
    linear-gradient(
      to bottom right,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.02)
    ),
    rgba(18, 18, 18, 0.52);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.6);
}

/* Preview overrides removed: glass now applied to all cards */

/* Rollback preset — SOLID style (previous look)
   Apply per-card via: class="event-card event-card--solid" */
.event-card--solid {
  background-color: var(--color-black);
  border: 1px solid var(--color-border);
}
.event-card--solid:hover {
  background-color: #0a0a0a;
  border-color: #555;
}

.event-artist {
  font-size: 24px; /* Desktop reference */
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-accent);
  margin: 0; /* remove default heading margins to eliminate extra spacing */
  /* Show full titles without truncation */
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere; /* prevent horizontal overflow on very long words */
}

/* Inline series prefix placed before the title */
.event-series-inline {
  color: var(--color-muted);
  font-size: 18px; /* base desktop/mobile default aligns with .event-details */
  font-weight: 400;
  display: block; /* place series on its own line */
  white-space: nowrap; /* keep series on a single line */
  margin-bottom: 4px; /* no extra spacing before artist name line */
}

.event-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--color-muted);
  /* Desktop reference size for labels + values */
  font-size: 16px;
  line-height: 1.4;
  margin: 0; /* ensure no extra spacing around details */
}

.event-detail {
  display: flex;
  gap: 0.5rem;
}

.event-detail-label {
  font-weight: 500;
  min-width: 60px;
}

/* 4. Loading & Error States
   ================================================ */
.loading,
.error,
.no-results {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--color-muted);
  font-size: 1.1rem;
}

.error {
  color: #ff6b6b;
}

/* 5. Responsive Overrides */

/* Mobile: < 768px */
@media (max-width: 767px) {
  .filters-container {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
  }

  .filter-group:nth-child(1) {
    flex: 0 0 60%;
  }

  .filter-group:nth-child(2) {
    flex: 0 0 35%;
  }

  .filter-group:nth-child(3) {
    flex: 0 0 100%;
  }

  .filter-group:nth-child(4) {
    flex: 0 0 100%;
  }

  .filter-actions {
    flex: 0 0 100%;
    justify-content: center;
    margin-top: 0.5rem;
    margin-left: 0;
  }

  .filter-group {
    gap: 0.2rem;
  }

  .custom-select-trigger,
  .filter-input {
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  .filter-group:nth-child(1) .custom-select-trigger,
  .filter-group:nth-child(3) .custom-select-trigger {
    font-size: 0.8rem;
    padding: 0.4rem;
  }

  .filter-group:nth-child(1) .custom-select-options,
  .filter-group:nth-child(3) .custom-select-options {
    font-size: 0.7rem;
  }

  .custom-select-trigger {
    overflow: hidden;
  }

  .custom-select-trigger .custom-select-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .filter-label {
    font-size: 0.7rem;
    margin-bottom: 0;
  }

  .filter-group:nth-child(2) .custom-select-trigger {
    font-size: 0.8rem;
    padding: 0.4rem;
    min-width: 0;
  }

  .filter-group:nth-child(2) .custom-select-options {
    font-size: 0.7rem;
  }

  .events-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .event-card {
    padding: 2.5rem 1.5rem;
  }

  .events-header {
    margin-top: calc(2.5rem - 38px);
  }

  .event-artist {
    font-size: 24px;
  }

  .event-details {
    font-size: 16px;
  }

  .event-series-inline {
    font-size: 16px;
  }
}

/* Tablet: 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .events-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .event-artist {
    font-size: 20px;
  }

  .event-details {
    font-size: 14px;
  }

  .event-series-inline {
    font-size: 14px;
  }
}

/* Tablet Landscape / Small Desktop: 1024px - 1199px */
@media (min-width: 1024px) and (max-width: 1199px) {
  .events-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .event-artist {
    font-size: 18px;
  }

  .event-details {
    font-size: 12px;
  }

  .event-series-inline {
    font-size: 12px;
  }
}

/* Standard Desktop: 1200px - 1439px */
@media (min-width: 1200px) and (max-width: 1439px) {
  .events-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .event-artist {
    font-size: 20px;
  }

  .event-details {
    font-size: 14px;
  }

  .event-series-inline {
    font-size: 14px;
  }
}

/* Large Desktop: >= 1440px */
@media (min-width: 1440px) {
  .events-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .event-artist {
    font-size: 24px;
  }

  .event-details {
    font-size: 16px;
  }

  .event-series-inline {
    font-size: 16px;
  }
}

/* Card animation on load */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#events-grid.js-rendered .event-card {
  animation: fadeIn 0.35s ease-out both;
  animation-delay: calc(var(--i, 0) * 0.04s);
}
