/* ============================================================
   SportPulse – Design System (mobile-first)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700;800;900&family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --bg-0: #080808;
  --bg-1: #0F0F0F;
  --bg-2: #181818;
  --bg-card: #141414;
  --bg-card-hover: #1E1E1E;

  --primary: #F97316;
  --primary-light: #FB923C;
  --primary-dark: #EA580C;
  --primary-glow: rgba(249, 115, 22, 0.12);
  --primary-glow-strong: rgba(249, 115, 22, 0.25);

  --accent: #A8A8A8;
  --accent-light: #C8C8C8;
  --accent-glow: rgba(255, 255, 255, 0.05);

  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --error: #EF4444;
  --error-glow: rgba(239, 68, 68, 0.15);
  --warning: #F59E0B;

  --text-1: #F9FAFB;
  --text-2: #D1D5DB;
  --text-3: #9CA3AF;
  --text-4: #6B7280;
  --text-5: #2C2C2C;

  --border: rgba(255, 255, 255, 0.07);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-focus: rgba(249, 115, 22, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(249, 115, 22, 0.12);

  --transition: 0.2s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-0);
  color: var(--text-1);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; }

/* ─── Scrollbar globale ───────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 99px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.20);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.10) transparent;
}

/* ─── Navigation ─────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: #000;
  flex-shrink: 0;
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.5px;
}

.logo-text span {
  color: var(--primary);
}

.nav-links {
  display: none;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-1);
  background: var(--border);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-burger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
}

.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-0);
  z-index: 99;
  padding: 24px 20px;
  flex-direction: column;
  gap: 8px;
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-1);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--primary);
  border-color: var(--border-focus);
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--primary);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--primary-glow-strong);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--primary-glow-strong);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text-1);
  border-color: rgba(255,255,255,0.15);
  background: var(--border);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-lg);
}

.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Loading state */
.btn.loading .btn-text { opacity: 0; }
.btn.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn { position: relative; }

/* ─── Form elements ───────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.3px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-4);
  pointer-events: none;
  transition: color var(--transition);
  font-size: 16px;
  line-height: 1;
}

.form-input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder { color: var(--text-4); }

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input:focus ~ .input-icon,
.input-wrap:focus-within .input-icon { color: var(--primary); }

.form-input.valid { border-color: var(--success); }
.form-input.invalid { border-color: var(--error); }

.input-suffix {
  position: absolute;
  right: 14px;
  color: var(--text-4);
  cursor: pointer;
  transition: color var(--transition);
  font-size: 16px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-4);
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 16px;
  transition: color var(--transition);
}

.form-hint.valid { color: var(--success); }
.form-hint.error { color: var(--error); }
.form-hint.info { color: var(--text-2); }

/* Password strength bar */
.password-strength {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.password-strength-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease, background 0.4s ease;
}

/* ─── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

/* ─── Tag / Badge ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-primary {
  background: var(--primary-glow);
  color: var(--primary-light);
  border: 1px solid rgba(249,115,22,0.2);
}

/* ─── Page wrapper ────────────────────────────────────────────── */
.page-with-nav {
  padding-top: 64px;
}

/* ─── Section ─────────────────────────────────────────────────── */
.section {
  padding: 64px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── Animations ──────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(32px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
  50% { box-shadow: 0 0 40px var(--primary-glow-strong); }
}

.animate-fade { animation: fadeIn 0.5s ease both; }
.animate-slide { animation: slideUp 0.6s ease both; }

/* ─── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  animation: slideUp 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.toast.success { border-color: rgba(16,185,129,0.3); color: #6EE7B7; }
.toast.error { border-color: rgba(239,68,68,0.3); color: #FCA5A5; }

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(8px); pointer-events: none; }
}

/* ─── Divider ─────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-5);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (min-width: 640px) {
  .nav-links { display: flex; }
  .nav-burger { display: none; }
  .nav-actions .btn-ghost { display: inline-flex; }

  .section { padding: 80px 40px; }
}

@media (min-width: 1024px) {
  .section { padding: 96px 40px; }
}

/* ─── Poppins font usage ──────────────────────────────────────── */
h1, h2, h3,
.logo-text,
.nav-links a,
.sidebar-nav a,
.card-title,
.auth-title {
  font-family: 'Poppins', 'Inter', sans-serif;
}

/* ─── Élégance éditoriale ────────────────────────────────────── */
.form-label {
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-size: 11px;
}

.badge {
  letter-spacing: 0.8px;
}

.nav-links a {
  letter-spacing: 0.2px;
}

/* Thin rule separator */
hr, .divider::before, .divider::after {
  border-color: rgba(255,255,255,0.06);
}

/* ─── Mobile app – règles globales ───────────────────────────── */

/* Prevent tap highlight flash on all interactive elements */
a, button, [role="button"], label, input, textarea, select, summary {
  -webkit-tap-highlight-color: transparent;
}

/* Prevent double-tap zoom (keeps single-tap fast) */
button, a, label, summary {
  touch-action: manipulation;
}

/* Prevent text selection on UI controls */
button, .bottom-nav-item, .filter-tab, .nav-icon, .topbar-btn {
  -webkit-user-select: none;
  user-select: none;
}

/* Prevent pull-to-refresh / bounce overscroll */
body {
  overscroll-behavior-y: contain;
}

/* Prevent iOS input zoom (requires font-size >= 16px on focus) */
@media (max-width: 767px) {
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* Safe area insets for iPhone notch / Dynamic Island */
.news-topbar, .msg-topbar {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.bottom-nav {
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  height: calc(64px + env(safe-area-inset-bottom));
}
