﻿/* ==========================================================================
   LES 3 JOURS DE CHERBOURG EN COTENTIN - LECTEUR AUDIO LIVE OFFICIEL
   Design moderne, responsive, optimisé mobile & outdoor
   ========================================================================== */

:root {
  --bg-main: #0a0f1d;
  --bg-card: rgba(18, 26, 47, 0.75);
  --bg-card-solid: #121a2f;
  --bg-card-hover: rgba(26, 38, 68, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(72, 202, 228, 0.3);

  --primary: #00b4d8;
  --primary-glow: rgba(0, 180, 216, 0.4);
  --secondary: #ffd166; /* Maillot or / prestige */
  --live-red: #ff003b; /* Rouge Flashy Direct */
  --live-red-glow: rgba(255, 0, 59, 0.7);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 10%, #162447 0%, #0a0f1d 80%);
  background-attachment: fixed;
  overflow-x: hidden;
  line-height: 1.5;
  padding: env(safe-area-inset-top, 16px) env(safe-area-inset-right, 12px) env(safe-area-inset-bottom, 16px) env(safe-area-inset-left, 12px);
}

.app-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* En-tête */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: linear-gradient(135deg, #0077b6, #00b4d8);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 180, 216, 0.35);
}

.brand-logo svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
}

.brand-info h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: all 0.2s ease;
}

/* Animation de pulsation du bouton de partage */
#shareBtn {
  position: relative;
  background: rgba(0, 180, 216, 0.15);
  border-color: rgba(0, 180, 216, 0.5);
  color: #48cae4;
  animation: sharePulseBlink 2s infinite ease-in-out;
}

#shareBtn:hover, #shareBtn:focus-visible {
  animation: none;
  background: rgba(0, 180, 216, 0.4);
  border-color: #00e5ff;
  color: #ffffff;
  transform: scale(1.08);
}

@keyframes sharePulseBlink {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 180, 216, 0.6);
    border-color: rgba(0, 180, 216, 0.4);
    background: rgba(0, 180, 216, 0.12);
    color: #48cae4;
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 16px 4px rgba(0, 180, 216, 0.45);
    border-color: #00e5ff;
    background: rgba(0, 180, 216, 0.35);
    color: #ffffff;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 180, 216, 0);
    border-color: rgba(0, 180, 216, 0.4);
    background: rgba(0, 180, 216, 0.12);
    color: #48cae4;
  }
}

/* Bandeau d'alerte en direct */
.alert-banner {
  display: none;
  background: linear-gradient(90deg, #ff003b, #ff4d6d);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(255, 0, 59, 0.4);
  animation: pulseGlow 2s infinite;
  align-items: center;
  gap: 10px;
}

.alert-banner.active {
  display: flex !important;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.92; transform: scale(0.995); }
}

/* Carte Principale du Lecteur */
.player-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.player-card.is-live {
  border-color: #ff003b;
  box-shadow: 0 0 35px rgba(255, 0, 59, 0.3), 0 8px 30px rgba(0, 0, 0, 0.4);
}

.player-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 30%, rgba(0, 180, 216, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.is-live::before {
  background: radial-gradient(circle at 50% 20%, rgba(255, 0, 59, 0.15) 0%, transparent 65%) !important;
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Badge de Statut Normal (En attente) */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  transition: all 0.3s ease;
}

/* ==========================================================================
   BADGE DIRECT : ROUGE INTENSE, FLASHY & PULSATION DYNAMIQUE
   ========================================================================== */
.live-indicator.live-active {
  background: linear-gradient(135deg, #ff003b 0%, #ff1a4b 50%, #d90429 100%);
  border: 1.5px solid #ffffff;
  color: #ffffff !important;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 20px rgba(255, 0, 59, 0.75), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  animation: liveBadgePulse 1.6s infinite ease-in-out;
}

.live-active .pulse-dot {
  background: #ffffff !important;
  box-shadow: 0 0 10px #ffffff, 0 0 18px #ff003b;
  animation: pulseDotFlash 0.8s infinite alternate;
}

@keyframes liveBadgePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 16px rgba(255, 0, 59, 0.65), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 0 30px 6px rgba(255, 0, 59, 0.95), inset 0 1px 2px rgba(255, 255, 255, 0.7);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 16px rgba(255, 0, 59, 0.65), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  }
}

@keyframes pulseDotFlash {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.3); opacity: 1; }
}

.listeners-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.listeners-badge svg {
  width: 14px;
  height: 14px;
  fill: var(--primary);
}

.track-info {
  text-align: center;
  margin-bottom: 16px;
}

.speaker-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ffd166, #f39c12);
  color: #0b132b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.is-live .speaker-badge {
  background: linear-gradient(135deg, #ff003b, #ff4d6d);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 0, 59, 0.5);
}

.track-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.25;
  word-break: break-word;
}

.track-subtitle {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 500;
}

.is-live .track-subtitle {
  color: #ff4d6d;
}

/* ==========================================================================
   SCÈNE ANIMÉE : OMBRES DE COUREURS CYCLISTES
   ========================================================================== */
.cyclists-scene-wrapper {
  position: relative;
  width: 100%;
  height: 110px;
  background: linear-gradient(180deg, #081026 0%, #122244 100%);
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
  transition: border-color 0.4s ease;
}

.is-live .cyclists-scene-wrapper {
  border-color: rgba(255, 0, 59, 0.4);
}

.cyclists-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Défilement continu de la route */
.road-line {
  stroke-dasharray: 20 20;
  animation: roadScroll 1.2s linear infinite;
}

.is-playing .road-line {
  animation-duration: 0.6s;
}

@keyframes roadScroll {
  0% { stroke-dashoffset: 40; }
  100% { stroke-dashoffset: 0; }
}

/* Balancement vertical réaliste des 3 cyclistes */
.cyclist-bob-1 {
  animation: cyclistBob1 0.7s ease-in-out infinite alternate;
}
.cyclist-bob-2 {
  animation: cyclistBob2 0.75s ease-in-out 0.2s infinite alternate;
}
.cyclist-bob-3 {
  animation: cyclistBob3 0.8s ease-in-out 0.4s infinite alternate;
}

.is-playing .cyclist-bob-1 { animation-duration: 0.45s; }
.is-playing .cyclist-bob-2 { animation-duration: 0.42s; }
.is-playing .cyclist-bob-3 { animation-duration: 0.48s; }

@keyframes cyclistBob1 {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-2.5px); }
}
@keyframes cyclistBob2 {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-2px); }
}
@keyframes cyclistBob3 {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-3px); }
}

/* Mouvement de pédalage */
.cyclist-legs {
  animation: legPedal 0.5s ease-in-out infinite alternate;
}

.is-playing .cyclist-legs {
  animation-duration: 0.3s;
}

@keyframes legPedal {
  0% { transform: translateY(0px); }
  100% { transform: translateY(1.5px); }
}

/* Lignes de vent */
.speed-line {
  stroke: #00e5ff;
  stroke-dasharray: 15 25;
  animation: speedLine 1s linear infinite;
  opacity: 0.4;
}

.is-playing .speed-line {
  opacity: 0.9;
  animation-duration: 0.5s;
}

@keyframes speedLine {
  0% { stroke-dashoffset: 80; }
  100% { stroke-dashoffset: 0; }
}

/* Effet halo quand le speaker est en direct */
.is-live .cyclist-leader {
  filter: drop-shadow(0 0 10px #ff003b);
}

/* Commandes du Lecteur */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.btn-play {
  width: 76px;
  height: 76px;
  min-width: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  box-shadow: 0 6px 20px rgba(0, 180, 216, 0.45);
  transition: all 0.2s ease;
}

.is-live .btn-play {
  background: linear-gradient(135deg, #ff003b, #d90429);
  box-shadow: 0 6px 24px rgba(255, 0, 59, 0.6);
}

.btn-play:active {
  transform: scale(0.94);
}

.btn-play svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.btn-secondary-action {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: all 0.2s ease;
}

.btn-secondary-action:active {
  background: rgba(255, 255, 255, 0.15);
}

.btn-secondary-action svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.player-subcontrols {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 12px;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 180px;
}

.volume-control svg {
  width: 20px;
  height: 20px;
  fill: var(--text-muted);
  cursor: pointer;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.is-live .volume-slider::-webkit-slider-thumb {
  background: #ff003b;
}

.stream-format-badge {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

/* Modal Partage & QR Code */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
  position: relative;
}

.qr-box {
  background: #ffffff;
  padding: 14px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.qr-image {
  width: 200px;
  height: 200px;
  max-width: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.btn-close-modal {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px;
  background: var(--primary);
  color: #0b132b;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

/* Footer */
.footer {
  text-align: center;
  padding: 10px;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

@media (max-width: 480px) {
  .app-container {
    padding: 6px;
    gap: 12px;
  }
  
  .player-card {
    padding: 18px 14px;
  }

  .track-title {
    font-size: 1.25rem;
  }

  .cyclists-scene-wrapper {
    height: 95px;
  }

  .btn-play {
    width: 68px;
    height: 68px;
    min-width: 68px;
  }

  .qr-image {
    width: 180px;
    height: 180px;
  }
}
