:root {
  --bg-dark: #050505;
  --bg-card: rgba(31, 41, 55, 0.4);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-primary: #e2e2e2;
  --text-secondary: #d6c0d3;
  --accent-pink: #D946EF;
  --accent-neon: #8B5CF6;
  --accent-orange: #fc4c02; /* Strava Orange */
  --accent-gradient: linear-gradient(135deg, var(--accent-pink), var(--accent-neon));
  --glow-shadow: 0 0 25px rgba(217, 70, 239, 0.35);
  --success-cyan: #22D3EE;
  --highlight-green: #39FF14;
}

/* --- Strava Style Challenges --- */
.hero-card {
  display: flex;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  color: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
}

.hero-info {
  flex: 1;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-image {
  flex: 1.5;
  background-size: cover;
  background-position: center;
  min-height: 350px;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  color: #0f172a;
}

.hero-meta {
  list-style: none;
  margin-bottom: 2rem;
}

.hero-meta li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: #475569;
}

.hero-btn {
  background: var(--accent-orange);
  color: #fff;
  border: none;
  padding: 1rem 2.5rem;
  font-weight: 800;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
  transition: all 0.3s;
}

.hero-btn:hover {
  background: #e34402;
  transform: scale(1.05);
}

.challenge-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.filter-btn:hover, .filter-btn.active {
  background: #fff;
  color: #0f172a;
  border-color: #fff;
}

/* Strava Grid Cards */
.strava-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  color: #1e293b;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s;
}

.strava-card:hover {
  transform: translateY(-8px);
}

.strava-card-img {
  height: 180px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.strava-card-badge {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 45px;
  height: 45px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  border: 2px solid #f1f5f9;
}

.strava-card-info {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.strava-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
  color: #0f172a;
}

.strava-card-meta {
  list-style: none;
  margin-bottom: 1.5rem;
  flex: 1;
}

.strava-card-meta li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: #475569;
}

.strava-card-btn {
  background: var(--accent-orange);
  color: #fff;
  border: none;
  padding: 0.8rem;
  font-weight: 800;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  width: 100%;
  transition: background 0.3s;
}

.strava-card-btn:hover {
  background: #e34402;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  background-image: radial-gradient(circle at top right, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
                    radial-gradient(circle at bottom left, rgba(217, 70, 239, 0.1) 0%, transparent 50%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 2.5rem 2rem;
  z-index: 10;
}
.card {
  background: linear-gradient(145deg, rgba(20, 20, 20, 0.8), rgba(10, 10, 10, 0.9));
  padding: 2.5rem;
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}
.sidebar-logo {
  font-size: 1.75rem;
  font-weight: 900;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 3rem;
  letter-spacing: -1px;
  text-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
}
.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.nav-item {
  padding: 1rem 1.25rem;
  border-radius: 16px;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transform: translateX(8px);
}
.nav-item.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(217, 70, 239, 0.4);
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 100%;
    max-width: 500px;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translate(-50%, -40%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* --- User Profile Header --- */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    background: linear-gradient(145deg, rgba(40, 40, 40, 0.4), rgba(20, 20, 20, 0.6));
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-neon);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--accent);
}

/* --- Form Controls in Cards --- */
.card input, .card select {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.card select option, select option {
    background-color: #1e293b;
    color: #fff;
}

.card input:focus, .card select:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.2);
}

.close-modal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-modal-btn:hover {
    background: #ef4444;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 3rem;
  overflow-y: auto;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  position: relative;
  z-index: 100;
}
.header-title h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}
.header-title p {
  color: var(--text-secondary);
  margin-top: 0.25rem;
}
.profile-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent-neon);
  object-fit: cover;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.stat-card {
  background: rgba(31, 41, 55, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.stat-card:hover {
  transform: translateY(-5px);
  border-color: rgba(217, 70, 239, 0.3);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), var(--glow-shadow);
}
.stat-label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}
.stat-value {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Connect Section */
.connect-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.connect-card {
  background: rgba(31, 41, 55, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.connect-card:hover {
  transform: translateY(-5px);
  border-color: rgba(217, 70, 239, 0.3);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), var(--glow-shadow);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.app-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  display: flex; justify-content: center; align-items: center;
  font-size: 1.5rem;
}
.strava-icon { color: #FC4C02; }
.google-icon { color: #34A853; }

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 99px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  letter-spacing: 0.5px;
}
.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}
.btn-primary:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 8px 25px rgba(138, 43, 226, 0.6);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-slide-up {
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Mobile Responsive & Auto Layout */
@media (max-width: 1024px) {
  .hero-card {
    flex-direction: column;
  }
  .hero-image {
    min-height: 250px;
  }
  .hero-info {
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    padding: 1rem;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: column;
    z-index: 100;
    position: sticky;
    top: 0;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(24px);
  }
  
  .sidebar-logo {
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.5rem;
  }
  
  .nav-links {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    gap: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  
  .nav-links::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  
  .nav-item {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    flex-shrink: 0;
  }
  
  .main-content {
    padding: 1.25rem;
  }
  
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
  
  .header-title h1 {
    font-size: 1.75rem;
  }
  
  .profile-area {
    width: 100%;
    justify-content: flex-end;
  }
  
  .connect-section {
    grid-template-columns: 1fr;
  }
  
  .connect-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem;
  }
  
  .btn {
    width: 100%;
    text-align: center;
  }

  .activity-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .modal .card {
    padding: 1.5rem !important;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 1rem;
  }
  
  .card {
    padding: 1.5rem;
    border-radius: 16px;
  }

  .stat-card {
    padding: 1.25rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .leaderboard-table th, .leaderboard-table td {
    padding: 1rem 0.5rem;
    font-size: 0.85rem;
  }

  .header-title h1 {
    font-size: 1.5rem;
  }
}

/* Section Visibility */
.content-section {
    display: none;
}
.content-section.active {
    display: block;
}

/* Leaderboard Table */
.leaderboard-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    margin-top: 1rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    text-align: left;
    color: var(--text-secondary);
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.leaderboard-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.activity-item {
    background: linear-gradient(90deg, rgba(30, 30, 30, 0.5), rgba(20, 20, 20, 0.5));
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(10px) scale(1.01);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#map-container {
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
}

/* --- Progress Ring System --- */
.progress-ring-container {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}
.progress-ring {
    transform: rotate(-90deg);
}
.progress-ring-circle {
    transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-linecap: round;
}
.ring-icon {
    position: absolute;
    font-size: 1.3rem;
    font-weight: normal;
}
.text-pink { color: var(--accent-pink); text-shadow: 0 0 10px rgba(217, 70, 239, 0.5); }
.text-cyan { color: var(--success-cyan); text-shadow: 0 0 10px rgba(34, 211, 238, 0.5); }
.text-purple { color: var(--accent-neon); text-shadow: 0 0 10px rgba(139, 92, 246, 0.5); }
.text-orange { color: var(--accent-orange); text-shadow: 0 0 10px rgba(252, 76, 2, 0.5); }
.text-green { color: var(--highlight-green); text-shadow: 0 0 10px rgba(57, 255, 20, 0.5); }
.text-gold { color: #FFD700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }

/* --- Glowing elements & typography --- */
.greeting-title {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.greeting-subtitle {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    margin-top: 2.5rem;
}
.section-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    text-transform: uppercase;
}
.section-header-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-pink);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: opacity 0.2s;
}
.section-header-link:hover {
    opacity: 0.8;
}

/* Floating Action Button (FAB) */
.fab-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(217, 70, 239, 0.4), 0 0 20px rgba(139, 92, 246, 0.2);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.fab-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(217, 70, 239, 0.6), 0 0 30px rgba(139, 92, 246, 0.4);
}
.fab-btn span {
    font-size: 2rem;
    font-weight: bold;
}

