/* =========================
   Canonical Button System
   ========================= */

.btn {
  color: white;
  display: inline-block;
  font-weight: 600;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  padding: clamp(0.35rem, 0.25rem + 0.5vw, 0.55rem) clamp(0.6rem, 0.45rem + 0.55vw, 0.85rem);
  font-size: clamp(0.65rem, 0.55rem + 1.4vw, 0.85rem);
  border-radius: var(--radius-md);
  text-decoration: none;
  line-height: 1.4;
  transition:
    background-color var(--transition),
    border-color     var(--transition),
    color            var(--transition),
    box-shadow       var(--transition);
}

.btn-primary {
  background-color: var(--blue);
  border-color: var(--blue);
  color: white;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--blue-dark);
  border-color: var(--blue-dark);
  color: white;
}

.btn-secondary {
  background-color: var(--gray);
  border-color: var(--gray);
  color: white;
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  background-color: var(--gray-dark);
  border-color: var(--gray-dark);
  color: white;
}

.btn-success {
  background-color: var(--green);
  border-color: var(--green);
  color: white;
}
.btn-success:hover,
.btn-success:focus-visible {
  background-color: var(--green-dark);
  border-color: var(--green-dark);
  color: white;
}

.btn-danger {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}
.btn-danger:hover,
.btn-danger:focus-visible {
  background-color: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: white;
}

.btn-outline-primary {
  background-color: transparent;
  border-color: var(--blue);
  color: var(--blue);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
  background-color: var(--blue-dark);
  border-color: var(--blue-dark);
  color: white;
}

.btn-outline-warning {
  background-color: transparent;
  border-color: var(--yellow);
  color: var(--yellow);
}
.btn-outline-warning:hover,
.btn-outline-warning:focus-visible {
  background-color: var(--yellow-dark);
  border-color: var(--yellow-dark);
  color: white;
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: var(--font-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.65rem 1.3rem;
  font-size: var(--font-base);
  border-radius: var(--radius-lg);
}


/* =========================
   Shared UI Utilities
   ========================= */

.shard-icon {
  display: inline-block;
  line-height: 1;
  vertical-align: -25%;
  padding: 0 2px 0 0;
}

.lh-1 {
  line-height: 1;
}

/* Claim-reward button — golden outline overlay on top of Bootstrap .btn base */
.claim-reward-button {
  background: transparent;
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
}

.claim-reward-button:hover {
  background: var(--color-gold);
  border-color: color-mix(in srgb, var(--color-gold) 70%, #000);
  color: #1a1500;
}


/* =========================
   Stage Profile Layout
   ========================= */

/* Profile images shown on race pages. */
.stage-profile-layout {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 2vw, 2rem);
  align-items: center;
  justify-content: space-between;
}

.stage-profile-layout.no-profile-img {
  justify-content: flex-start;
}

.stage-profile-nav {
  position: relative;
  z-index: 1;
}

.stage-profile-info {
  flex: 1 1 320px;
  max-width: 50%;
}

/* GC headers are centered and use the full width. */
.stage-profile-layout--gc {
  justify-content: center;
}

.stage-profile-info--gc {
  max-width: 100%;
  text-align: center;
}

.stage-profile-title {
  font-size: clamp(1.9rem, 2.6vw, 2.6rem);
  font-weight: 600;
}

.stage-profile-title--gc {
  font-size: clamp(2.2rem, 3vw, 3rem);
}

.stage-profile-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

.stage-profile-route {
  font-size: var(--font-md);
}

.stage-profile-distance {
  margin-top: 0.75rem;
  font-size: var(--font-base);
  color: var(--color-text-muted);
}

.stage-profile-image-wrap {
  flex: 1 1 320px;
  max-width: 50%;
  display: flex;
  justify-content: center;
}

.stage-profile-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

@media (max-width: 900px) {
  .stage-profile-info,
  .stage-profile-image-wrap {
    max-width: 100%;
  }
}


/* =========================
   Rider Detail Modal
   ========================= */

.rider-detail-modal {
  align-items: center;
  display: none;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 1200;
}

.rider-detail-modal.is-open {
  display: flex;
}

.rider-detail-backdrop {
  background: rgba(0, 0, 0, 0.75);
  inset: 0;
  position: absolute;
}

.rider-detail-window {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 900px);
  max-width: min(980px, 92vw);
  overflow: hidden;
  position: relative;
  width: 100%;
  z-index: 1;
}

.rider-detail-close-row {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-sm) var(--space-sm) 0;
  position: relative;
  z-index: 5;
}

.rider-detail-close-wrap {
  align-items: center;
  background: color-mix(in srgb, var(--color-surface) 82%, #000);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  display: inline-flex;
  justify-content: center;
}

.rider-detail-close {
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 2rem;
  line-height: 1;
  padding: var(--space-xs) var(--space-md);
  position: relative;
  z-index: 6;
}

.rider-detail-close:hover {
  color: var(--color-accent);
}

.rider-detail-content {
  align-items: start;
  display: grid;
  gap: calc(var(--spacing-unit) * 2);
  grid-template-columns: max-content minmax(0, 1fr);
  padding: calc(var(--spacing-unit) * 1.2) calc(var(--spacing-unit) * 2.5) calc(var(--spacing-unit) * 2.5);
}

.rider-detail-left {
  display: flex;
}

.rider-detail-card {
  min-width: 300px;
}

.rider-detail-card .rider-card {
  /* Keep cloned rider card dimensions inside modal bounds. */
  box-sizing: border-box;
  margin: 0 auto;
  width: min(100%, 300px);
}

.rider-detail-card .rider-card:hover {
  cursor: default;
  transform: none;
}

.rider-detail-card .rider-card.unowned::before {
  display: none;
}

.rider-detail-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.rider-detail-title {
  font-weight: 700;
  margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.rider-detail-results {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-unit);
  min-height: 0;
}

.rider-detail-status {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.rider-detail-results-list {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 0.8);
  list-style: none;
  margin: 0;
  max-height: calc(85vh - 220px);
  overflow-y: auto;
  padding: 0 var(--space-sm) 0 0;
}

.rider-detail-results-item {
  align-items: center;
  background: color-mix(in srgb, var(--color-surface) 70%, #000);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  gap: calc(var(--spacing-unit) * 1.2);
  padding: calc(var(--spacing-unit) * 1.1) calc(var(--spacing-unit) * 1.2);
}

.rider-detail-result-main {
  display: grid;
  gap: 0.25rem;
}

.rider-detail-result-date {
  color: var(--color-text-muted);
  font-size: clamp(0.62rem, 0.55rem + 0.35vw, 0.72rem);
  font-weight: 800;
  text-transform: uppercase;
}

.rider-detail-result-headline {
  align-items: center;
  display: inline-flex;
  gap: 0.4rem;
  font-size: clamp(0.9rem, 0.7rem + 1.5vw, 1.05rem);
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.rider-detail-result-headline .icon.profile {
  flex: 0 0 auto;
}

.rider-detail-result-link {
  color: inherit;
  text-decoration: none;
}

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

.rider-detail-result-meta {
  color: var(--color-text-muted);
  font-size: clamp(0.7rem, 0.5rem + 1.2vw, 0.82rem);
}

.rider-detail-result-score {
  min-width: 64px;
  text-align: right;
}

.rider-detail-result-position {
  font-size: var(--font-md);
  font-weight: 800;
  line-height: 1;
}

.rider-detail-result-points {
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  margin-top: 0.25rem;
}

.user-team-modal-window {
  max-height: 85vh;
  max-width: 90vw;
}

.user-team-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .rider-detail-content {
    grid-template-columns: 1fr;
    max-height: 85vh;
    overflow-y: auto;
  }

  .rider-detail-left {
    justify-content: center;
  }

  .rider-detail-card {
    display: flex;
    justify-content: center;
    min-width: 0;
    width: 100%;
  }

  .rider-detail-results-list {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}


/* =========================
   CookieConsent v3 Theme
   ========================= */

#cc-main {
  /* Backgrounds — match the site's dark surface layer */
  --cc-bg:                    #09041a;
  --cc-secondary-color:       #b8b8c8;

  /* Text */
  --cc-primary-color:         #f0f0f0;

  /* Borders and separators */
  --cc-separator-border-color:        rgba(255, 255, 255, 0.10);
  --cc-section-category-border:       rgba(255, 255, 255, 0.08);

  /* Buttons — equal visual weight for accept and reject */
  --cc-btn-primary-bg:                #0b5ed7;
  --cc-btn-primary-color:             #ffffff;
  --cc-btn-primary-border-color:      #0b5ed7;
  --cc-btn-primary-hover-bg:          #043b8d;
  --cc-btn-primary-hover-color:       #ffffff;
  --cc-btn-primary-hover-border-color: #043b8d;

  --cc-btn-secondary-bg:              #3a3450;
  --cc-btn-secondary-color:           #f0f0f0;
  --cc-btn-secondary-border-color:    rgba(255, 255, 255, 0.13);
  --cc-btn-secondary-hover-bg:        #4a4460;
  --cc-btn-secondary-hover-color:     #f0f0f0;
  --cc-btn-secondary-hover-border-color: rgba(255, 255, 255, 0.25);

  /* Category blocks in the preferences modal */
  --cc-cookie-category-block-bg:             #0e0430;
  --cc-cookie-category-block-border:         rgba(255, 255, 255, 0.10);
  --cc-cookie-category-block-hover-bg:       #150540;
  --cc-cookie-category-block-hover-border:   rgba(255, 255, 255, 0.20);
  --cc-cookie-category-expanded-block-bg:    #0e0430;
  --cc-cookie-category-expanded-block-hover-bg: #150540;

  /* Footer of the consent banner (Privacy Policy / Terms links) */
  --cc-footer-bg:             #070022;
  --cc-footer-border-color:   rgba(255, 255, 255, 0.10);
  --cc-footer-color:          #b8b8c8;

  /* Toggle (analytics on/off) */
  --cc-toggle-on-bg:          #0b5ed7;
  --cc-toggle-off-bg:         #6c757d;
  --cc-toggle-on-knob-bg:     #ffffff;
  --cc-toggle-off-knob-bg:    #ffffff;
  --cc-toggle-readonly-bg:    #3a3450;
  --cc-toggle-readonly-knob-bg: #b8b8c8;

  /* Links */
  --cc-link-color:            #6ea8fe;

  /* Overlay */
  --cc-overlay-bg:            rgba(0, 0, 0, 0.6);

  /* Scrollbar */
  --cc-webkit-scrollbar-bg:       rgba(255, 255, 255, 0.06);
  --cc-webkit-scrollbar-hover-bg: rgba(255, 255, 255, 0.14);

  /* Border radius — matches site's --radius-md */
  --cc-modal-border-radius:   8px;
  --cc-btn-border-radius:     8px;
}
