/* ===== CasaCourses 2.0 Programme Page Styles ===== */

/* Header - single inline subtitle */
.cc-header {
  padding: 1rem 0.75rem 0.75rem;
  color: var(--text);
}

.cc-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0.85;
  margin: 0;
}

/* Next banner - Two-row card design from prochain-depart-card.png */
.cc-next-banner {
  display: grid;
  grid-template-columns: auto;
  align-items: stretch;
  gap: 0;
  border-radius: 0px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .25), inset 0 2px 0 rgba(0, 0, 0, .3);
  position: sticky;
  top: 0;
  z-index: 100;
  border: 1px solid #a0181f;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cc-next-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .35), inset 0 2px 0 rgba(0, 0, 0, .3);
}

.cc-next-banner:active {
  transform: translateY(0);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .25), inset 0 2px 0 rgba(0, 0, 0, .3);
}

/* Smooth content refresh animation */
.cc-content.is-refreshing {
  opacity: 0.95;
  transition: opacity 0.15s ease-out;
}

/* Row 1: Red header with countdown */
.cc-next-banner .banner-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #A0171F;
  color: #fff;
  padding: 0.6rem 1rem;
}

.cc-next-banner .dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: #ffd46b;
  flex-shrink: 0;
}

/* Pulsating animation - only when countdown is active */
.cc-next-banner.is-counting .dot {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    transform: scale(0.2);
    box-shadow: 0 0 0 0 rgba(255, 212, 107, 0.7);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.1);
    box-shadow: 0 0 8px 2px rgba(255, 212, 107, 0.5);
  }
}

.cc-next-banner .label {
  font-weight: 700;
  font-size: 0.95rem;
}

/* Row 2: Dark body with race details */
.cc-next-banner .banner-body {
  background: #1E0B0E;
  color: #fff;
  padding: 0.85rem 1rem;
}

.cc-next-banner .race-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Code pills (R#C# codes) */
.cc-code-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 1.75rem;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-radius: 4px;
  transform: skewX(-8deg);
}

.cc-code-pill--reunion {
  background: #9ca3af;
  color: #1b1e26;
}

.cc-code-pill--race {
  background: #9ca3af;
  color: #1b1e26;
}

.cc-next-banner .race-meta {
  font-size: 0.85rem;
  opacity: 0.9;
  line-height: 1.4;
}

/* Countdown digits */
.cc-countdown {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-weight: 800;
}

/* Source info */
.cc-source {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

.cc-source div {
  margin: 0.15rem 0;
}

/* Meetings & races */
.cc-meeting {
  background: var(--card);
  border: 1px solid var(--outline);
  border-radius: 0px;
  margin: .1rem 0rem;
  overflow: hidden;
}

.cc-meeting-head {
  position: relative;
  padding: 1rem 1rem;
  border-bottom: 1px solid var(--outline);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.cc-meeting-head:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Row 1: Track name + Next time */
.cc-meeting-head .head-row-1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-direction: unset;
  gap: 0.5rem;
}

.cc-meeting-head .track-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  flex: 1;
}

.cc-meeting-head .next-time {
  font-size: 1rem;
  font-weight: 700;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1;
  margin-left: 1rem;
  opacity: 0.95;
  letter-spacing: -0.02em;
}

/* Status-specific styling */
.cc-meeting-head .next-time.status-terminee {
  opacity: 0.6;
  color: #9ca3af;  /* Gray - muted for finished meetings */
  font-style: normal;
}

.cc-meeting-head .next-time.status-imminent {
  color: #ef4444;  /* Red - urgent for imminent starts */
  font-style: normal;
  animation: pulse-subtle 2s ease-in-out infinite;
}

/* Subtle pulse animation for imminent departures */
@keyframes pulse-subtle {
  0%, 100% {
    opacity: 0.95;
  }
  50% {
    opacity: 1;
  }
}

/* Row 2: Metadata + Premium badges */
.cc-meeting-head .head-row-2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.cc-meeting-head .meta-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.9;
}

.cc-meeting-head .meta-item {
  white-space: nowrap;
}

.cc-meeting-head .meta-sep {
  opacity: 0.5;
  margin: 0 0.25rem;
}

.cc-meeting-head .premium-badges {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cc-meeting-head .premium-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
}

.cc-meeting-head .premium-badge:hover {
  transform: scale(1.05);
}

.cc-meeting-head .badge-quinte-plus {
  background: #ef4444;  /* Bright red - matches screenshot */
}

.cc-meeting-head .badge-quarte {
  background: #3b82f6;  /* Bright blue - matches screenshot */
}

.cc-meeting-head .badge-tierce {
  background: #22c55e;  /* Bright green - matches screenshot */
}

/* Toggle icon - positioned bottom right */
.cc-meeting-head .toggle-icon {
  position: absolute;
  bottom: 0.75rem;
  right: 1.5rem;
  opacity: 0.4;
  transition: transform 0.2s ease, opacity 0.15s ease;
}

.cc-meeting-head:hover .toggle-icon {
  opacity: 0.6;
}

.cc-meeting.is-collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.cc-meeting-races {
  max-height: 10000px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  overflow: hidden;
  padding: 0rem 0rem 0rem;
}

.cc-meeting.is-collapsed .cc-meeting-races {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

/* Responsive adjustments for meeting header */
@media (max-width: 768px) {
  .cc-meeting-head .head-row-1 {
    flex-direction: unset;
    align-items: center;
    gap: 0.5rem;
  }

  .cc-meeting-head .next-time {
    margin-left: 0;
  }

  /* Row 2 keeps horizontal layout on mobile - no changes needed */
}

.cc-race {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: var(--soft);
  border: 1px solid var(--outline);
  border-radius: 0px;
  padding: 1rem;
  margin: 0;
}

.cc-race:last-child {
  margin-bottom: 15px;
}

/* Clickable race card styling */
.cc-race--clickable {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cc-race--clickable:hover {
  background: #292d33;
  /* border-color: var(--accent); */
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cc-race--clickable:active {
  transform: translateX(1px);
}

/* Race content wrapper - side-by-side layout */
.race-content {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  width: 100%;
}

/* Left: Stacked R# / C# codes */
.race-code-stack {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-right: 6px;
}

.reunion-code,
.course-code {
  font-weight: 800;
  font-size: 1.1rem;
  color: #1b1e26;
  background-color: #a8a8a8;
  padding: 1px 1px;
  border-radius: 3px;
  transform: skewX(351deg);
  line-height: 1.2;
  text-align: center;
  min-width: 2.2rem;
}

/* Main content area */
.race-main {
  flex: 1;
  position: relative;
  padding-right: 5rem;
}

/* Time area - absolute positioned top right */
.race-time-area {
  position: absolute;
  top: 0;
  right: -3px;
}

.race-time {
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  opacity: 0.7;
}

/* Race name - prominent title */
.race-name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

/* Premium badges on race cards - positioned bottom right (where old status flag was) */
.race-premium-badges {
  position: absolute;
  bottom: 0px;
  right: -.3rem;
  display: flex;
  gap: 0.35rem;
  z-index: 10;
}

.race-premium-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.35rem;
  font-weight: 800;
  font-size: 0.7rem;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
}

.race-premium-badge:hover {
  transform: scale(1.05);
}

.race-premium-badge.badge-quinte-plus {
  background: #ef4444;  /* Bright red - Quinte+ */
}

.race-premium-badge.badge-quarte {
  background: #3b82f6;  /* Bright blue - Quarte */
}

.race-premium-badge.badge-tierce {
  background: #22c55e;  /* Bright green - Tierce */
}

/* Metadata lines */
.race-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.race-meta-line {
  opacity: 0.75;
  line-height: 1.4;
}

.race-content .chevron-right {
  opacity: 0.4;
  transition: opacity 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: -7px;
}

.cc-race--clickable:hover .chevron-right {
  opacity: 0.8;
  transform: translateX(2px);
}

/* Race status flag - now in top-right (replacing time) */
.race-status-flag {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

.race-status-flag--open {
  /* Two use cases:
     1. Race not started yet - shows no label (handled by Twig)
     2. Race started but no results - shows "En Cours" with red pulsing animation */
  background: #dc2626;  /* Red - race in progress */
  color: #ffffff;
  animation: pulse-running 1.5s ease-in-out infinite;
}

.race-status-flag--closed {
  background: #6366f1;  /* Indigo - betting closed, race not started */
  color: #ffffff;
}

.race-status-flag--running {
  background: #dc2626;  /* Red - race in progress */
  color: #ffffff;
  animation: pulse-running 1.5s ease-in-out infinite;
}

.race-status-flag--imminent,
.race-status-flag--scheduled,
.race-status-flag--closed {
  background: #dc2626;  /* Red - imminent start */
  color: #ffffff;
  animation: pulse-imminent 1.8s ease-in-out infinite;
}

@keyframes pulse-running {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes pulse-imminent {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.02);
  }
}

.race-status-flag--finished {
  background: #f59e0b;  /* Amber - provisional results */
  color: #000000;
}

.race-status-flag--official {
  background: #10b981;
  color: #000000;
}

.race-status-flag--disabled,
.race-status-flag--canceled {
  background: #ef4444;
  color: #000000;
}

.race-status-flag--stale {
  background: #6b7280;  /* Gray - indicates data unavailable/stale */
  color: #000000;
}

.race-status-flag--stale_with_pmu {
  background: #8b5cf6;  /* Purple - PMU fallback data available */
  color: #000000;
}

.race-status-flag--scheduled {
  background: #06b6d4;  /* Cyan - future race */
  color: #000000;
}

.race-status-flag--postponed {
  background: #f97316;  /* Deep orange - rescheduled */
  color: #000000;
}

/* Legacy status badges (inline) - kept for backwards compatibility */
.race-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 0.5rem;
}

.race-status--open {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.race-status--closed,
.race-status--finished {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.race-status--official {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.race-status--disabled,
.race-status--canceled {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Finish order chips - inline in metadata */
.race-meta-line--finish {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Non-partants row - add subtle spacing above for visual separation */
.race-meta-line--nonpartants {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding-top: 0.2rem;
}

.finish-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.4rem;
  background: #10b981;
  color: #fff;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s ease;
}

.finish-chip:hover {
  transform: scale(1.05);
}

/* Non-partant chips - red style for scratched horses */
.nonpartant-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.4rem;
  background: #ef4444;
  color: #fff;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s ease;
}

.nonpartant-chip:hover {
  transform: scale(1.05);
}

/* Legacy styles - can be removed if not used elsewhere */
.finish-order {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.finish-label {
  font-weight: 600;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
  .cc-next-banner-simple {
    flex-wrap: wrap;
  }

  .cc-next-banner-simple .banner-center {
    flex-basis: 100%;
    order: 3;
  }

  .cc-next-banner-simple .btn {
    order: 4;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .cc-race {
    flex-direction: column;
    align-items: flex-start;
  }

  .cc-race .tr {
    width: 100%;
  }

  .cc-race .btn {
    width: 100%;
    text-align: center;
  }
}
