/**
 * OUALID FIT — Feuille de Style Personnalisée (Athletic Carbon & Volt UI)
 * Inspiré de Whoop, Apple Fitness+ & Hevy — Ergonomie à une main sur iPhone en salle de sport
 */

:root {
  --volt-primary: #84cc16;
  --volt-bright: #a3e635;
  --volt-dark: #65a30d;
  --cobalt-primary: #0ea5e9;
  --cobalt-bright: #3b82f6;
  --volt-glow: rgba(132, 204, 22, 0.35);
  --dark-950: #070A0E;
  --dark-900: #0C1117;
  --dark-800: #131B24;
  --dark-700: #1C2735;
}

/* Base & Ergonomie Mobile */
* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--dark-950);
  color-scheme: dark;
}

body {
  background-color: var(--dark-950);
  background-image: 
    radial-gradient(circle at 12% 0%, rgba(132, 204, 22, 0.08) 0%, transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.07) 0%, transparent 42%);
  background-attachment: fixed;
  overscroll-behavior-y: none;
}

/* Suppression des flèches sur les inputs numériques pour une saisie rapide en salle */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Empêche le zoom automatique iOS Safari lors du focus d'un champ de saisie */
@media screen and (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Safe areas iPhone PWA (Notch / Dynamic Island & Home Indicator) */
.safe-top {
  padding-top: calc(env(safe-area-inset-top, 48px) + 0.75rem) !important;
}

@supports not (padding-top: env(safe-area-inset-top)) {
  .safe-top {
    padding-top: 3.5rem !important;
  }
}

@media (display-mode: standalone) {
  .safe-top {
    padding-top: max(3.5rem, calc(env(safe-area-inset-top, 48px) + 0.75rem)) !important;
  }
}

.safe-bottom {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

/* Barres de défilement fines et élégantes */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(12, 17, 23, 0.7);
}

::-webkit-scrollbar-thumb {
  background: rgba(39, 53, 73, 0.85);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--volt-primary);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Glassmorphism & Surfaces Athlétiques Carbone */
.glass-card {
  background: linear-gradient(145deg, rgba(19, 27, 36, 0.88) 0%, rgba(12, 17, 23, 0.95) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
}

.glass-card-interactive {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-card-interactive:hover {
  transform: translateY(-2px);
  border-color: rgba(132, 204, 22, 0.4);
  box-shadow: 0 14px 34px -10px rgba(132, 204, 22, 0.16);
}

.glass-card-interactive:active {
  transform: translateY(0) scale(0.99);
}

/* Hero Banner Gradient OUALID FIT (Volt & Cobalt) */
.saker-hero-card {
  background: 
    radial-gradient(120% 120% at 100% 0%, rgba(132, 204, 22, 0.2) 0%, rgba(14, 165, 233, 0.1) 45%, rgba(19, 27, 36, 0.96) 85%),
    linear-gradient(180deg, rgba(19, 27, 36, 0.96) 0%, rgba(12, 17, 23, 0.99) 100%);
  border: 1px solid rgba(132, 204, 22, 0.3);
  box-shadow: 0 16px 40px -12px rgba(132, 204, 22, 0.15);
}

/* Effets Glow Vert Volt (#84cc16) & Bleu Cobalt (#0ea5e9) */
.saker-glow {
  box-shadow: 0 0 25px -4px rgba(132, 204, 22, 0.45);
}

.saker-glow-sm {
  box-shadow: 0 0 14px -2px rgba(132, 204, 22, 0.35);
}

.saker-text-glow {
  text-shadow: 0 0 20px rgba(132, 204, 22, 0.45);
}

.cobalt-glow {
  box-shadow: 0 0 25px -4px rgba(14, 165, 233, 0.4);
}

/* Navigation Active States (Sidebar Desktop & Bottom Bar Mobile) */
.nav-btn {
  color: #94a3b8;
  border: 1px solid transparent;
}

.nav-btn:hover {
  color: #f8fafc;
  background: rgba(28, 39, 53, 0.55);
}

.nav-btn.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(132, 204, 22, 0.18) 0%, rgba(14, 165, 233, 0.05) 100%);
  border-color: rgba(132, 204, 22, 0.35);
  box-shadow: inset 3px 0 0 0 var(--volt-primary);
}

.nav-btn.active i,
.nav-btn.active svg {
  color: var(--volt-bright);
}

.mobile-nav-btn {
  color: #64748b;
  transition: all 0.2s ease;
}

.mobile-nav-btn.active {
  color: var(--volt-bright);
  background: rgba(132, 204, 22, 0.14);
  font-weight: 700;
}

/* Sélecteurs de Semaine (Pills S1 - S4) */
.week-pill {
  background: rgba(19, 27, 36, 0.85);
  color: #94a3b8;
  border: 1px solid rgba(51, 65, 85, 0.6);
  transition: all 0.18s ease;
}

.week-pill:hover {
  color: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.4);
}

.week-pill.active {
  background: linear-gradient(135deg, #a3e635 0%, #84cc16 100%);
  color: #070A0E;
  font-weight: 800;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 14px rgba(132, 204, 22, 0.35);
}

/* Cartes et Lignes de Séries (Workout Set Rows) */
.set-row {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(51, 65, 85, 0.45);
  background: rgba(12, 17, 23, 0.7);
}

.set-row:focus-within {
  border-color: rgba(132, 204, 22, 0.6);
  background: rgba(19, 27, 36, 0.92);
  box-shadow: 0 0 0 2px rgba(132, 204, 22, 0.15);
}

.set-row.completed,
.set-row-done {
  background: linear-gradient(90deg, rgba(132, 204, 22, 0.16) 0%, rgba(12, 17, 23, 0.78) 100%) !important;
  border-color: rgba(132, 204, 22, 0.45) !important;
}

.set-check-btn {
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s ease;
}

.set-check-btn:active {
  transform: scale(0.88);
}

/* Anneaux SVG Circulaires (Timer, Calories, Progression) */
.progress-ring-circle {
  transition: stroke-dashoffset 0.35s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.25s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* Animations Fluides */
@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-section:not(.hidden) {
  animation: fadeInSlide 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(132, 204, 22, 0.55);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(132, 204, 22, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(132, 204, 22, 0);
  }
}

.timer-active-pulse {
  animation: pulseRing 2s infinite;
}

@keyframes timerFinishFlash {
  0%, 100% {
    border-color: rgba(132, 204, 22, 0.85);
    box-shadow: 0 0 28px rgba(132, 204, 22, 0.45);
  }
  50% {
    border-color: rgba(14, 165, 233, 0.9);
    box-shadow: 0 0 32px rgba(14, 165, 233, 0.6);
  }
}

.timer-finished-alert {
  animation: timerFinishFlash 0.8s ease-in-out 4;
}

/* Bottom Sheet Drawer for Mobile (Tools, 1RM, Disques) */
@keyframes slideUpDrawer {
  from {
    transform: translateY(100%);
    opacity: 0.8;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.bottom-sheet-content {
  animation: slideUpDrawer 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-height: 88vh;
  border-top-left-radius: 1.5rem;
  border-top-right-radius: 1.5rem;
  overscroll-behavior: contain;
}

@media (min-width: 640px) {
  .bottom-sheet-content {
    animation: fadeInSlide 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-radius: 1.5rem;
    max-height: 85vh;
  }
}

/* WCAG AA Ergonomie : Cibles tactiles d'au moins 44x44 px sur mobile */
@media (pointer: coarse) {
  .mobile-nav-btn {
    min-height: 48px;
    min-width: 48px;
  }
  button,
  .btn-touch {
    min-height: 44px;
  }
}

/* Accessibilité : Respect strict de prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .view-section:not(.hidden),
  .timer-active-pulse,
  .timer-finished-alert,
  .bottom-sheet-content {
    animation: none !important;
  }
}
