/* Rides Page Styles */

.container.mt-4 p {
  font-size: 1.125rem;
  color: #333;
  line-height: 1.6;
}

.container.mt-4 h2 {
  font-size: 2rem;
  color: #333;
}

.ride-card {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 30px;
  margin: 25px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.ride-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3498db, #2ecc71, #f39c12, #e74c3c);
  border-radius: 16px 16px 0 0;
}

.ride-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

.ride-card h4 {
  color: white;
  margin-bottom: 10px;
  font-weight: 600;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.ride-card h4 a {
  color: white;
  text-decoration: none;
}

.ride-card h4 a:hover {
  color: #3498db;
  text-decoration: none;
}

.ride-card .text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
}

.ride-stats {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ride-stat {
  text-align: center;
  min-width: 60px;
  flex: 1;
  box-sizing: border-box;
}

.ride-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #3498db;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  margin-bottom: 5px;
  word-wrap: break-word;
}

.ride-stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  word-wrap: break-word;
}

.ride-map {
  width: 100%;
  max-width: 100%;
  height: 400px;
  margin-top: 20px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  box-sizing: border-box;
}

.site-logo {
  position: absolute;
  right: 20px;
  top: 10px;
  height: 60px;
  object-fit: contain;
}

.view-ride-btn {
  background: linear-gradient(45deg, #3498db, #2980b9);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 25px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  margin-top: 15px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  width: 100%;
  max-width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.view-ride-btn:hover {
  background: linear-gradient(45deg, #2980b9, #1e73a3);
  color: white;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.ride-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 15px;
  width: 100%;
  max-width: 100%;
}

.ride-title-section {
  flex: 1;
  min-width: 200px;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.ride-actions {
  margin-left: 15px;
  max-width: 100%;
}

/* Garmin attribution and device/source styling */
.garmin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #fff;
  padding: 4px 6px;
  border-radius: 6px;
  font-weight: 700;
  margin-left: 8px;
}

.ride-source {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.9);
}
.ride-source-text {
  color: #dfe6e9;
  font-weight: 600;
}

/* Normalize logos (Garmin / Strava / Zwift) to a consistent height.
   Add a .strava-logo class for any Strava logo usage so it matches Garmin. */
.garmin-logo, .zwift-logo, .strava-logo, .mywhoosh-logo { height: 28px; width: auto; display: block; }
.garmin-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff; /* white bubble for Garmin */
  padding: 6px 8px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.06);
}

/* Small trademark superscript next to Garmin logo */
.garmin-trademark {
  font-size: 10px;
  line-height: 1;
  margin-left: 6px;
  color: rgba(0,0,0,0.6); /* darker on white */
  font-weight: 700;
  transform: translateY(-6px);
}

/* Zwift logo styling: match Garmin bubble for consistency */
.zwift-badge { margin-left: 8px; }
.zwift-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ff7a00; /* bright Zwift/orange rounded card */
  padding: 6px 8px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.06);
}
.zwift-logo { height: 28px; width: auto; display: block; }

/* mywhoosh specific styling: match other badges but allow a slightly smaller padded wrap */
.mywhoosh-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff; /* white bubble like Garmin */
  padding: 4px 6px; /* slightly smaller padding */
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.06);
}

/* Ensure any images placed in the upper-right action area are constrained to badge size to avoid layout breaks */
.ride-actions img { height: 28px; width: auto; display: block; }

/* Hide any images inside .ride-actions that are not explicitly our badge classes to prevent stray thumbnails from breaking layout */
.ride-actions img:not(.garmin-logo):not(.strava-logo):not(.zwift-logo):not(.mywhoosh-logo) {
  display: none !important;
}

/* Ensure mywhoosh logo uses the same sizing rules and doesn't overflow */
.mywhoosh-logo { height: 28px; width: auto; display: block; }

/* Prevent large images embedded in ride.body (rich text) from overflowing the header/actions area
   and hide tiny broken-image placeholders that may appear as separate <img> tags in the actions column. */
.ride-body img { max-width: 100%; height: auto; display: block; margin-top: 8px; border-radius: 8px; }
.ride-header img { max-height: 34px; width: auto; }
.ride-actions img { max-height: 34px; }

/* Debug panel for polyline troubleshooting */
.polyline-debug {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-family: monospace;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
  word-break: break-word;
}

/* Tablet - Keep 3 columns */
@media (max-width: 992px) and (min-width: 769px) {
  .ride-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    justify-items: center;
  }
  
  .ride-stat {
    margin: 0;
    min-width: auto;
  }
  
  .ride-stat-value {
    font-size: 1.75rem;
  }
}

/* Mobile optimized - fit more stats */
@media (max-width: 768px) {
  .ride-card {
    padding: 15px;
    margin: 15px 0;
    border-radius: 12px;
  }
  
  .ride-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .ride-actions {
    margin-left: 0;
    margin-top: 5px;
    width: 100%;
  }
  
  .view-ride-btn {
    padding: 12px 20px;
    font-size: 0.85rem;
    width: 100%;
  }
  
  /* 3 columns for mobile to fit more stats */
  .ride-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
  }
  
  .ride-stat {
    margin: 0;
    padding: 8px 4px;
    min-width: 0;
  }
  
  .ride-stat-value {
    font-size: 1.2rem;
    margin-bottom: 2px;
  }
  
  .ride-stat-label {
    font-size: 0.65rem;
    line-height: 1.1;
  }
  
  .ride-map {
    height: 250px;
  }
  
  .ride-title-section h4 {
    font-size: 1.1rem;
    line-height: 1.2;
  }
  
  .ride-title-section .text-muted {
    font-size: 0.8rem;
  }
}

/* iPhone specific optimizations */
@media (max-width: 430px) {
  .ride-card {
    padding: 12px;
    margin: 10px 0;
  }
  
  .ride-stats {
    padding: 10px;
    gap: 6px;
  }
  
  .ride-stat {
    padding: 6px 2px;
  }
  
  .ride-stat-value {
    font-size: 1.1rem;
  }
  
  .ride-stat-label {
    font-size: 0.6rem;
  }
  
  .ride-map {
    height: 200px;
  }
  
  .view-ride-btn {
    padding: 10px 15px;
    font-size: 0.8rem;
  }
}

/* iPhone SE and smaller */
@media (max-width: 375px) {
  .ride-card {
    padding: 10px;
    margin: 8px 0;
  }
  
  .ride-stats {
    padding: 8px;
    gap: 4px;
  }
  
  .ride-stat {
    padding: 4px 1px;
  }
  
  .ride-stat-value {
    font-size: 1rem;
  }
  
  .ride-stat-label {
    font-size: 0.55rem;
  }
  
  .ride-title-section h4 {
    font-size: 1rem;
  }
}

/* Landscape orientation for phones */
@media (max-width: 768px) and (orientation: landscape) {
  .ride-stats {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
  }
  
  .ride-stat-value {
    font-size: 1.1rem;
  }
  
  .ride-stat-label {
    font-size: 0.6rem;
  }
  
  .ride-map {
    height: 180px;
  }
}

/* Homepage intro overrides: ensure the name and intro paragraph are white on the home page */
.container.mt-4 .center .text-center h2,
.container.mt-4 .center .text-center p {
  color: #ffffff;
}

/* Ensure the "My Personal Stuff" section heading is visible on dark backgrounds */
#personal-stuff-heading {
  color: #ffffff !important;
}

/* Profile dropdown link colours for homepage profile images */
.profile-dropdown {
  background: transparent;
}

.profile-dropdown .dropdown-item {
  color: #000 !important; /* black text before hover */
  background: white;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.profile-dropdown .dropdown-item:hover,
.profile-dropdown .dropdown-item:focus {
  color: #1abc9c !important; /* green on hover */
  background-color: rgba(26,188,156,0.06) !important;
}