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

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  min-height: 100dvh;
}

h1 {
  color: white;
  text-align: center;
  font-weight: 700;
  font-size: 2.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

h1 .title-icon {
  width: 1.2em;
  height: 1.2em;
  vertical-align: middle;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

#auth {
  text-align: center;
  margin-bottom: 2rem;
}

.strava-connect-btn {
  display: inline-block;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.strava-connect-img {
  max-height: 80px;
  width: auto;
  max-width: 100%;
  border-radius: 4px;
  transition: transform 0.2s ease;
  display: block;
}

.strava-connect-btn:hover .strava-connect-img {
  transform: translateY(-3px);
}

.strava-connect-btn:active .strava-connect-img {
  transform: translateY(0);
}

#preloader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  padding: 60px 20px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

#preloader.hidden {
  display: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#preloader p {
  color: #4a5568;
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
}

#calendar {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: opacity 0.2s ease;
}

#calendar.calendar-loading {
  opacity: 0.45;
  pointer-events: none;
}

/* Weekend day styling */
.fc .weekend-day {
  background-color: rgba(208, 208, 219, 0.25);
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* FullCalendar overrides */
.fc .fc-toolbar.fc-header-toolbar {
  margin-bottom: 0 !important;
}

.fc {
  font-family: 'Inter', sans-serif;
}

/* Shared JS-driven tooltip (position: fixed escapes all overflow:hidden ancestors) */
#fc-tooltip {
  display: none;
  position: fixed;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75em;
  white-space: pre-line;
  z-index: 9999;
  min-width: 200px;
  max-width: 300px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  line-height: 1.5;
}

#fc-tooltip.visible {
  display: block;
}

/* Arrow pointing down (tooltip is above the event) — default */
#fc-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.85) transparent transparent;
}

/* Arrow pointing up (tooltip is below the event, flipped) */
#fc-tooltip.flipped::after {
  top: auto;
  bottom: 100%;
  border-width: 0 6px 6px;
  border-color: transparent transparent rgba(0, 0, 0, 0.85);
}

.fc-event[data-tooltip] {
  cursor: help;
}

/* Club logo styling */
.fc-event {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  margin: 2px 0;
  font-size: 0.9em;
  line-height: 1.3;
}

.club-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.fc-event-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  width: 100%;
}

/* Hover effect for events */
.fc-event:hover {
  opacity: 0.9;
  transform: translateX(2px);
  transition: all 0.2s ease;
}

.fc-toolbar {
  padding: 15px 20px 10px 20px;
  background: white;
  margin: 0;
  border-bottom: 1px solid #e2e8f0;
}

/* View switching buttons */
.fc-button {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  color: #4a5568;
  font-weight: 500;
  padding: 6px 12px;
  margin: 0 2px;
  border-radius: 6px;
  transition: all 0.2s ease;
  text-transform: capitalize;
}

.fc-button:first-of-type {
  margin-left: 0;
}

.fc-button:last-of-type {
  margin-right: 0;
}

.fc-button:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

.fc-button:active, 
.fc-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.fc-button-active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.fc-button-active:hover {
  background: #5a67d8;
  border-color: #5a67d8;
}

.fc-toolbar-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: #2d3748;
}

.fc-button {
  background: #667eea !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  padding: 8px 16px !important;
  transition: all 0.2s ease !important;
}

.fc-button:hover {
  background: #5a67d8 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

/* Calendar Event Styles */
/* Base event styles */
#calendar .fc-event {
  border: none;
  border-left: 3px solid #4338ca;
  border-radius: 6px;
  padding: 4px 8px;
  margin: 1px 0;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Month view events */
#calendar .fc-daygrid-event {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* Week/Day view events */
#calendar .fc-timegrid-event {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2px 6px;
}

/* Clip event content to the block bounds without affecting the tooltip pseudo-element */
#calendar .fc-timegrid-event .fc-event-main {
  overflow: hidden;
}

/* List view events */
#calendar .fc-list-event {
  border-left-color: #4f46e5;
  margin: 4px 0;
}

/* Joined events */
#calendar .fc-event-joined,
#calendar .fc-event-joined:hover {
  background: #15803d;
  border-left-color: #14532d;
  color: white;
}

/* Event hover effect */
#calendar .fc-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Event title */
#calendar .fc-event-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Club logo in events */
#calendar .club-logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.3);
}

/* Hide event dot in month view */
#calendar .fc-daygrid-event-dot {
  display: none;
}

/* Hover effects */
#calendar .fc-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Event title */
#calendar .fc-event-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Club logo in events */
#calendar .club-logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.3);
}

/* Event dot in month view */
#calendar .fc-daygrid-event-dot {
  display: none;
}

/* Event time */
#calendar .fc-event-time {
  font-weight: 600;
}

/* Footer Styles */
.app-footer {
  margin-top: 2rem;
  padding: 1rem 0;
  text-align: center;
  color: #ffffff;
  font-size: 0.9rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
}

.strava-logo {
  height: 20px;
  margin-left: 1rem;
  transition: opacity 0.2s ease;
}

.strava-logo:hover {
  opacity: 0.8;
}

.footer-content a {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-content a:hover {
  text-decoration: underline;
  color: #ffffff;
}

.fc-button:focus {
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2) !important;
}

.fc-daygrid-day {
  border-color: #e2e8f0 !important;
}

.fc-daygrid-day-number {
  color: #4a5568 !important;
  font-weight: 500 !important;
  padding: 8px !important;
}

.fc-day-today {
  background-color: rgba(40, 130, 255, 0.14) !important;
}

.fc-day-today .fc-daygrid-day-number {
  background: #667eea !important;
  color: white !important;
  border-radius: 50% !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 4px !important;
}

/* Base event styles */
.fc-event {
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 4px 8px;
  margin: 1px 0;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fc-event:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
  text-decoration: none !important;
}

/* Event title styling */
#calendar .fc-event-title {
  font-weight: 500;
}

/* Adjust day grid event margins */
#calendar .fc-daygrid-event {
  margin: 1px 2px;
}

.fc-col-header-cell {
  background: #f7fafc !important;
  color: #4a5568 !important;
  font-weight: 600 !important;
  padding: 12px 8px !important;
  border-color: #e2e8f0 !important;
}

.fc-scrollgrid {
  border: none !important;
}

.fc-scrollgrid-sync-table {
  border: none !important;
}

.fc-daygrid-body {
  border: none !important;
}

/* Equalize month-view row heights so they don't jump when events change.
   FullCalendar sets the table to a fixed height (via inline style), so percentage
   heights on tr resolve correctly. fixedWeekCount:true (default) = always 6 rows. */
.fc-daygrid-body tr {
  height: 16.6667%;
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
  }
  
  .fc-toolbar {
    padding: 15px 15px 0 15px;
  }
  
  .fc-toolbar-title {
    font-size: 1.5rem;
  }
  
  .fc-button {
    padding: 6px 12px !important;
    font-size: 0.9rem !important;
  }
}

/* Base button styles */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: white;
  border: 1px solid #e2e8f0;
  color: #4a5568;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  line-height: 1.25;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #1e3a8a;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Icon styles */
.btn-icon {
  width: 14px;
  height: 14px;
  color: currentColor;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

/* Logout button specific styles to match filter button */
.logout-link {
  font-size: 0.85rem;
  padding: 6px 10px;
  color: #4a5568;
  margin: 0;
}

/* Navigation Bar */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 20px;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-item {
  position: relative;
}

/* Filter button */
.filter-button {
  color: #1e40af;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background-color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  margin: 0;
}

.filter-button:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #1e3a8a;
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Filter icon */
.filter-icon {
  flex-shrink: 0;
  margin-right: 2px;
}

/* Filter count */
.filter-count {
  background-color: #1e40af;
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0 4px;
  border-radius: 8px;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  margin-left: 2px;
}

.filter-button:hover .filter-count {
  background-color: #1e3a8a;
  transform: scale(1.05);
}

/* Event Filters */
.event-filters {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 16px;
  margin: 0 0 16px 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease; /* avoid height animations — they shift the calendar */
  display: none;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  border: 1px solid #e2e8f0;
}

.event-filters.is-open {
  display: flex;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.filter-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  user-select: none;
  font-size: 0.95rem;
  color: #2d3748;
}

.filter-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.filter-slider {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  background-color: #e2e8f0;
  border-radius: 20px;
  margin-right: 8px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.filter-slider:before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  left: 2px;
  top: 2px;
  background-color: white;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.filter-checkbox:checked + .filter-slider {
  background-color: #667eea;
}

.filter-checkbox:checked + .filter-slider:before {
  transform: translateX(20px);
  background-color: white;
}

.filter-checkbox:focus + .filter-slider {
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.filter-label {
  font-weight: 500;
  white-space: nowrap;
}

.clear-filters-btn {
  background: none;
  border: 1px solid #e2e8f0;
  color: #4a5568;
  border-radius: 4px;
  font-size: 0.85rem;
  padding: 5px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.clear-filters-btn:hover {
  background-color: #f7fafc;
  border-color: #cbd5e0;
}

.clear-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* Responsive adjustments for filters */
@media (max-width: 768px) {
  .event-filters {
    padding: 10px 12px;
    margin: 0 0 12px 0;
  }

  .filter-group {
    width: 100%;
    justify-content: space-between;
  }

  /* Both filter groups: label + trigger must stay together on the left */
  .filter-group-clubs,
  .filter-group-sport-type {
    justify-content: flex-start;
  }

  .filter-label {
    font-size: 0.9rem;
  }

  .clear-filters-btn {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
}

/* Club filter */
.filter-group-clubs,
.filter-group-sport-type {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.filter-group-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #4a5568;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
}

.club-filter-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 5px 10px;
  background: white;
  min-width: 110px;
  min-height: 34px; /* stays the same height whether showing text or club avatars */
  transition: border-color 0.2s ease, background 0.2s ease;
  user-select: none;
}

.club-filter-trigger:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.club-filter-avatars {
  display: flex;
  align-items: center;
}

.club-avatar-img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  margin-left: -5px;
  flex-shrink: 0;
}

.club-avatar-img:first-child {
  margin-left: 0;
}

.club-avatar-initial {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #667eea;
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  margin-left: -5px;
  flex-shrink: 0;
}

.club-avatar-initial:first-child {
  margin-left: 0;
}

.club-avatar-overflow {
  font-size: 0.72rem;
  color: #4a5568;
  font-weight: 500;
  margin-left: 4px;
  white-space: nowrap;
}

.club-filter-placeholder {
  font-size: 0.85rem;
  color: #718096;
  white-space: nowrap;
}

.club-filter-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #718096;
  transition: color 0.15s, background 0.15s;
  margin-left: auto;
}

.club-filter-clear:hover {
  color: #2d3748;
  background: #e2e8f0;
}

.club-filter-chevron {
  color: #718096;
  flex-shrink: 0;
}

.club-filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1000;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 280px;
  max-width: 360px;
  overflow: hidden;
}

.club-filter-search-wrap {
  padding: 10px 10px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.club-filter-search {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.club-filter-search:focus {
  border-color: #667eea;
}

.club-filter-list {
  max-height: 280px;
  overflow-y: auto;
}

.club-filter-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 0.875rem;
  color: #2d3748;
  user-select: none;
}

.club-filter-list-item:hover:not(.disabled):not(.incompatible) {
  background: #f7fafc;
}

.club-filter-list-item.selected {
  background: #f0f4ff;
}

.club-filter-list-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.club-filter-list-item.incompatible {
  opacity: 0.38;
}

.club-filter-list-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #667eea;
}

.club-filter-list-item.disabled input[type="checkbox"] {
  cursor: not-allowed;
}

.club-list-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.club-list-initial {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.club-list-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.club-filter-empty {
  padding: 16px 12px;
  text-align: center;
  color: #718096;
  font-size: 0.85rem;
}

.club-filter-footer {
  padding: 7px 12px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.75rem;
  color: #718096;
  text-align: center;
}

/* Sport type filter — text chips shown in the trigger when selections are active */
.club-filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #667eea;
  color: white;
  font-size: 0.73rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.6;
}

.club-filter-chip-more {
  background: #e2e8f0;
  color: #718096;
}

/* About Page Styles */
.about-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 24px 16px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.about-container h2 {
  margin-top: 0;
  color: #2d3748;
  text-align: left;
}

.notice {
  border: 1px solid #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  background: #f9fafb;
}

/* User Profile */
.user-profile {
  display: flex;
  align-items: center;
  position: relative;
  height: 40px;
  min-width: 40px;
  overflow: hidden;
  transition: all 0.3s ease;
  border-radius: 20px;
  padding: 0;
  background: transparent;
  border: none;
}

.user-avatar {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  border: 2px solid white;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #2d3748;
  white-space: nowrap;
  padding: 0 12px 0 8px;
  opacity: 0;
  position: relative;
  z-index: 1;
  max-width: 0;
  overflow: hidden;
}

/* Hover states */
.user-profile:hover {
  min-width: 200px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  padding: 4px 8px 4px 40px;
  margin-right: 0;
}

.user-profile:hover .user-avatar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-profile:hover .user-name {
  opacity: 1;
  transform: translateX(0);
  max-width: 200px;
}

/* User name */
.user-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0 12px 0 8px;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
  height: 32px;
  line-height: 32px;
  margin: 0;
  flex-shrink: 0;
}

/* Profile link styles */
.user-name a {
  color: #fc5200; /* Strava orange */
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.user-name a:hover {
  color: #d14600dd; /* Darker orange on hover */
  text-decoration: underline;
}

/* Logout button */
.logout-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  font-size: 0.85rem;
  color: #4a5568;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

/* Hover states */
.user-profile:hover {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  padding: 4px 4px 4px 40px;
}

.user-profile:hover .user-avatar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-profile:hover .user-name {
  opacity: 1;
  max-width: 200px;
  padding: 0 8px;
  margin-right: 4px;
}

.user-profile:hover .logout-link {
  opacity: 1;
  max-width: 120px;
  padding: 0 10px;
  margin: 0 4px;
}

.logout-link:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e3a8a;
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: #1a202c;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* Auth Styling */
#auth {
  text-align: center;
  margin: 1.5rem 0;
  display: none; /* Hidden by default, shown when not authenticated */
}

.strava-connect-btn {
  display: inline-block;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.strava-connect-btn:hover {
  transform: scale(1.02);
  opacity: 0.95;
}

.strava-connect-img {
  height: 44px; /* Default height for standard DPI */
  width: auto;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Events stats in nav bar */
.events-stats {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  padding: 0 4px;
}

/* Limits warning strip */
.limits-warning {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  background: rgba(255, 251, 235, 0.97);
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #92400e;
}

.limits-warning-icon {
  flex-shrink: 0;
  line-height: 1.5;
}

.limits-warning-messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.limits-learn-more {
  color: #92400e;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}

.limits-learn-more:hover {
  color: #78350f;
}

/* Error Message Styling */
.error-message {
  position: relative;
  margin: 1rem auto 0;
  max-width: 1200px;
  width: calc(100% - 2rem);
  background-color: #fef2f2;
  color: #b91c1c;
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #dc2626;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.3s ease-out;
  opacity: 0.95;
}

.error-message::before {
  content: '⚠️';
  margin-right: 6px;
  font-size: 16px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 0.95;
    transform: translateY(0);
  }
}

/* ===================================================
   View Mode Switcher
   =================================================== */
.view-mode-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 3px;
}

.view-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.view-mode-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.view-mode-btn--active {
  background: rgba(255, 255, 255, 0.9);
  color: #4a5568;
}

.view-mode-btn--active:hover {
  background: white;
  color: #2d3748;
}

/* ===================================================
   List View — Container
   =================================================== */
#list-view {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  overflow: clip;
  padding-bottom: 20px;
}

/* ===================================================
   List View — Date Group Headers
   =================================================== */
.lv-date-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px 8px;
  background: white;
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.lv-date-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #f1f5f9;
}

.lv-date-header.lv-today {
  color: #fc5200;
}

.lv-today-pill {
  background: #fc5200;
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* ===================================================
   List View — Event Cards (collapsed)
   =================================================== */
.lv-group {
  padding: 0 12px 8px;
}

.lv-event-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  margin-bottom: 2px;
}

.lv-event-card:hover {
  background: #f8faff;
  border-color: #e0e7ff;
}

.lv-event-card.lv-expanded {
  background: #f8faff;
  border-color: #c7d2fe;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.lv-time {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.82rem;
  font-weight: 400;
  color: #475569;
  padding-top: 2px;
  white-space: nowrap;
}

.lv-club-name {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lv-club-logo-sm {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.lv-joined-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #15803d;
  background: #dcfce7;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 2px;
  white-space: nowrap;
}

.lv-event-title {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.35;
  margin: 2px 0;
}

.lv-stats-row {
  grid-column: 2;
  grid-row: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.lv-stat {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

/* ===================================================
   List View — Expanded Detail Panel
   =================================================== */
.lv-detail-panel {
  margin: 0 12px 2px;
  border: 1px solid #c7d2fe;
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: #f8faff;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: lv-expand 0.15s ease;
}

@keyframes lv-expand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lv-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  margin-bottom: 6px;
}

.lv-detail-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.lv-club-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lv-club-logo-md {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #94a3b8;
  overflow: hidden;
}

.lv-club-logo-md img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lv-detail-link {
  color: #1e40af;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
}

.lv-detail-link:hover {
  text-decoration: underline;
}

.lv-detail-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.5;
}

.lv-detail-row-label {
  font-size: 0.72rem;
  color: #94a3b8;
  min-width: 56px;
  flex-shrink: 0;
}

.lv-detail-joined {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: #15803d;
  font-weight: 500;
}

.lv-detail-divider {
  height: 1px;
  background: #e0e7ff;
  margin: 0 -16px;
}

/* ===================================================
   List View — Empty State
   =================================================== */
.lv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: #94a3b8;
  font-size: 0.95rem;
  gap: 12px;
  text-align: center;
}

.lv-empty-icon {
  font-size: 2.5rem;
  line-height: 1;
}

/* ===================================================
   List View — Responsive
   =================================================== */
@media (max-width: 768px) {
  .lv-event-card {
    grid-template-columns: 58px 1fr;
    column-gap: 8px;
    padding: 8px;
  }
}

/* ===================================================
   Mobile — Global UX Improvements
   =================================================== */
@media (max-width: 768px) {
  /* Nav bar */
  .nav-bar {
    padding: 0 8px;
  }

  .nav-left,
  .nav-right {
    gap: 8px;
  }

  /* Hide the "N events · M clubs" stat on narrow screens to prevent overflow */
  .events-stats {
    display: none;
  }

  /* Filter button — bring to ~44px touch target */
  .filter-button {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  /* View mode switcher — enlarge touch targets */
  .view-mode-btn {
    width: 40px;
    height: 40px;
  }

  /* Filter panel — stack groups vertically */
  .event-filters {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
  }

  .filter-group {
    width: 100%;
  }

  .filter-toggle {
    min-height: 44px;
  }

  .clear-filters-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  /* Filter dropdowns — prevent viewport overflow */
  .club-filter-dropdown {
    left: 0;
    right: 0;
    min-width: unset;
    max-width: unset;
  }

  .club-filter-list-item {
    padding: 12px;
    font-size: 0.9rem;
  }

  /* List view — larger text and spacing */
  .lv-date-header {
    font-size: 0.82rem;
    padding: 14px 16px 6px;
  }

  .lv-event-card {
    grid-template-columns: 62px 1fr;
    column-gap: 10px;
    padding: 10px;
  }

  .lv-time {
    font-size: 0.85rem;
  }

  .lv-club-name {
    font-size: 0.78rem;
  }

  .lv-event-title {
    font-size: 0.95rem;
  }

  .lv-stats-row {
    font-size: 0.8rem;
    gap: 8px;
  }

  .lv-section-title {
    font-size: 0.72rem;
  }

  .lv-detail-panel {
    padding: 12px 12px 14px;
  }

  /* FullCalendar — shrink verbose view buttons to prevent toolbar overflow */
  .fc-toolbar .fc-button-group .fc-dayGridMonth-button,
  .fc-toolbar .fc-button-group .fc-timeGridWeek-button,
  .fc-toolbar .fc-button-group .fc-timeGridDay-button {
    font-size: 0.78rem !important;
    padding: 6px 8px !important;
  }

  /* FullCalendar toolbar — allow wrapping so nav row and view row can split */
  .fc .fc-toolbar.fc-header-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px 6px;
  }

  /* Title — much smaller on mobile so it doesn't crowd the toolbar */
  .fc-toolbar-title {
    font-size: 1.1rem !important;
  }

  /* Footer — stack copyright above Strava logo on narrow screens */
  .footer-content {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
  }

  .strava-logo {
    margin-left: 0;
  }
}
