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

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

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

/* Tooltip styling for calendar events */
.fc-event[title] {
  position: relative;
  cursor: help;
}

.fc-event[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9em;
  white-space: pre-line;
  z-index: 1000;
  min-width: 200px;
  max-width: 300px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  line-height: 1.5;
  margin-bottom: 8px;
}

.fc-event[title]:hover::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% - 1px);
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.85) transparent transparent;
  z-index: 1001;
}

/* Remove tooltips from navigation buttons */
.fc-toolbar .fc-button[title] {
  cursor: pointer;
}

.fc-toolbar .fc-button[title]:hover::after,
.fc-toolbar .fc-button[title]:hover::before {
  display: none;
}

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

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

/* 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: all 0.3s ease;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  border: 1px solid #e2e8f0;
}

.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;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  margin-left: auto;
}

.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;
  }
  
  .filter-label {
    font-size: 0.9rem;
  }
  
  .clear-filters-btn {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
}

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

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