/* ------------------------------ */
/* styles.css (Refonte Premium & Mobile) */
/* ------------------------------ */

:root {
  /* Nouvelle Palette SegSeq */
  --color-accent: #FC4C02;        /* Orange Strava */
  --color-bg-main: #1B241F;       /* Vert Mat Profond */
  --color-bg-surface: #26332C;    /* Vert Mat Secondaire */
  --color-text-main: #F0F4F2;     /* Blanc Cassé */
  --color-text-muted: #8D9F95;    /* Gris-Vert Muted */
  --danger: #E63946;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--color-bg-main);
  color: var(--color-text-main);
  min-height: 100vh;
  position: relative;
  z-index: 0;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 0 30px;
}

/* --- BOUTONS MODERNISÉS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  gap: 8px;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 4px 15px rgba(252, 76, 2, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(252, 76, 2, 0.4);
}

.btn-view-feature {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(252, 76, 2, 0.1);
  color: var(--color-accent);
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  transition: all 0.3s ease;
}

.btn-view-feature:hover {
  background: var(--color-accent);
  color: #fff;
  transform: scale(1.05);
}

.btn-delete {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 12px 22px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s ease;
}

.btn-delete:hover {
  background: var(--danger);
  color: white;
}

/* --- TYPOGRAPHIE & LAYOUT --- */
.hero { text-align: center; padding: 80px 20px 40px; }
.logo { font-size: 4rem; color: var(--color-text-main); margin-bottom: 10px; }
.logo span { color: var(--color-accent); }
.brand { font-size: 4rem; font-weight: 800; letter-spacing: -2px; }
.brand .accent { color: var(--color-accent); }
.tagline { font-size: 1.5rem; margin-top: 20px; color: var(--color-text-main); font-weight: 500;}
.subtitle { font-size: 1.1rem; color: var(--color-text-muted); margin-top: 20px; line-height: 1.6; max-width: 600px; margin-inline: auto;}
.section { padding: 60px 0; margin-bottom: 40px; }
.section-title { text-align: center; font-size: 2.2rem; margin-bottom: 40px; font-weight: 700;}

/* CALL TO ACTION (Correction du centrage) */
.cta {
  display: flex;
  flex-direction: column;
  align-items: center; /* Centre horizontalement */
  justify-content: center;
  margin-top: 40px;
  gap: 15px;
}

.strava-btn {
  height: 48px;
  cursor: pointer;
  transition: opacity 0.2s;
  /* margin: 0 auto retiré car Flexbox gère le centrage */
}
.strava-btn:hover { opacity: 0.85; }

/* --- CARTES & GRILLES --- */
.card, .form-card, .profile-card, .stat-card, .challenge-card, .example {
  background: var(--color-bg-surface);
  color: var(--color-text-main);
  border-radius: 24px;
  padding: 35px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.05);
}

.steps, .examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
}

.number {
  color: var(--color-accent);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 15px;
}

.example {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px;
}
.example-meta { color: var(--color-text-muted); font-size: 0.9rem; margin-top: 5px; }

/* --- CAROUSEL --- */
.carousel-container { overflow: hidden; position: relative; width: 100%; max-width: 700px; margin: 0 auto; padding-bottom: 20px; }
.carousel-track { display: flex; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); will-change: transform; }
.carousel-slide { min-width: 100%; box-sizing: border-box; text-align: center; }
.carousel-slide .number { font-size: 3rem; margin-bottom: 20px; }
.carousel-dots { display: flex; justify-content: center; gap: 12px; margin-top: 25px; }
.carousel-dot { width: 10px; height: 10px; background: var(--color-text-muted); border-radius: 50%; cursor: pointer; transition: all 0.3s ease; opacity: 0.5;}
.carousel-dot.active { background: var(--color-accent); transform: scale(1.3); opacity: 1;}

/* --- FLÈCHES CAROUSEL --- */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(38, 51, 44, 0.6); /* var(--color-bg-surface) avec transparence */
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px); /* Effet verre élégant */
}

.carousel-arrow:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  transform: translateY(-50%) scale(1.1);
}

.carousel-arrow.left { left: 10px; }
.carousel-arrow.right { right: 10px; }


/* --- HEADER & NAVIGATION --- */
.main-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: 15px 30px; 
  max-width: 1200px; 
  margin: auto; 
}

/* Nouveaux groupes de navigation */
.nav-group-1, .nav-group-2 {
  display: flex;
  align-items: center;
  gap: 25px;
}

.nav-icon { 
  color: var(--color-text-main); 
  transition: color 0.2s, transform 0.2s; 
  display: flex; 
  align-items: center; 
  justify-content: center;
}
.nav-icon:hover { 
  color: var(--color-accent); 
  transform: scale(1.1);
}

.lang-selector { 
  display: flex; 
  gap: 8px; 
  font-size: 0.9rem; 
  font-weight: 600; 
  color: var(--color-text-muted);
}
.lang-btn { cursor: pointer; transition: color 0.2s; }
.lang-btn:hover { color: var(--color-text-main); }
.lang-btn.active { color: var(--color-accent); }

.nav-profile-pic { 
  width: 38px; 
  height: 38px; 
  border-radius: 50%; 
  object-fit: cover; 
  border: 2px solid var(--color-accent); 
}


/* --- FOOTER --- */
.main-footer { text-align: center; padding: 40px 20px; color: var(--color-text-muted); display: flex; flex-direction: column; gap: 15px; align-items: center;}
.footer-icons { display: flex; gap: 20px; }
.footer-icon { color: var(--color-text-muted); transition: color 0.2s; }
.footer-icon:hover { color: var(--color-accent); transform: scale(1.1); }

/* Lien discret SegSeq dans le footer */
.segseq-link {
    color: inherit; /* Reste de la même couleur que le texte environnant */
    text-decoration: none; /* Pas de soulignement par défaut pour rester propre */
    transition: color 0.2s ease-in-out;
}

.segseq-link:hover {
    /* J'utilise un fallback sur le orange classique Strava au cas où la variable n'existe pas exactement sous ce nom */
    color: var(--color-accent, #fc4c02); 
}


/* --- FORMULAIRES & INPUTS (Adaptés au thème sombre) --- */
label { display: block; margin-top: 20px; font-weight: 600; color: var(--color-text-muted); }
input, select, textarea {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--color-bg-main);
  color: var(--color-text-main);
  margin-top: 8px;
  font-size: 1rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-accent); }

/* --- TABLEAUX --- */
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
th { background: rgba(255,255,255,0.05); color: var(--color-text-muted); font-weight: 600; }
tr:hover { background: rgba(255,255,255,0.02); }

/* --- DRAG & DROP SEGMENTS --- */
.segment-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-bg-main);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid rgba(255,255,255,0.1);
}
.segment-row.over { border: 1px dashed var(--color-accent); background: rgba(252, 76, 2, 0.05); }
.segment-row.dragging { opacity: 0.4; }
.drag-handle { cursor: grab; color: var(--color-text-muted); display: flex; align-items: center; padding: 5px; }
.drag-handle:active { cursor: grabbing; }
.segment-content { flex: 1; display: flex; align-items: center; gap: 10px; }
.segment-content input { margin-top: 0; padding: 12px; }

.btn-add-row {
  background: transparent;
  border: 2px dashed rgba(255,255,255,0.2);
  color: var(--color-text-muted);
  width: 100%;
  padding: 15px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
}
.btn-add-row:hover { border-color: var(--color-accent); color: var(--color-accent); background: rgba(252, 76, 2, 0.05); }

/* --- AUTOCOMPLETE --- */
.autocomplete-wrapper { position: relative; width: 100%; }
.autocomplete-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--color-bg-surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  max-height: 200px; overflow-y: auto; z-index: 1000; display: none; text-align: left;
}
.autocomplete-item { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; font-size: 0.9rem; color: var(--color-text-main); }
.autocomplete-item:hover { background-color: rgba(255,255,255,0.05); }

/* --- TOGGLE SWITCH --- */
.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.2); transition: .4s; border-radius: 26px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--color-accent); }
input:checked + .slider:before { transform: translateX(24px); }

/* =========================================
   📱 OPTIMISATIONS MOBILES (RESPONSIVE)
   ========================================= */
@media (max-width: 768px) {
  .container { padding: 0 15px; }
  .section { padding: 40px 0; margin-bottom: 40px; }
  .hero { padding: 40px 15px 20px; }
  .brand { font-size: 3rem; }
  .tagline { font-size: 1.3rem; }
  .section-title { font-size: 1.8rem; }
  .card, .example { padding: 20px; }
  
   /* Grille pour le Header Mobile (Groupe 1 sous Groupe 2) */
  .main-header { 
    flex-direction: column;
    gap: 15px;
    padding: 15px; 
  }
  
  .nav-group-2 {
    order: 1; /* S'affiche en HAUT sur mobile */
    width: 100%;
    justify-content: flex-end; /* Aligne les icônes auth/profil à droite */
  }

  .nav-group-1 { 
    order: 2; /* S'affiche en BAS sur mobile */
    width: 100%;
    justify-content: center; /* Centre Accueil, Explore, Create */
    gap: 40px; 
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  
  .nav-brand { grid-column: 1; grid-row: 1; }
  .nav-auth { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  
  .nav-menu { 
    grid-column: 1 / -1; /* Prend toute la largeur */
    grid-row: 2; 
    justify-content: center; /* Centre les icônes et la langue */
    gap: 40px; /* Espace généreux pour le tactile */
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05); /* Ligne de séparation subtile */
  }

  .table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }

 /* --- OPTIMISATION CAROUSEL MOBILE (Swipe Natif) --- */
  .carousel-container {
    overflow: visible; /* Permet au track de gérer son propre débordement */
    padding: 0;
  }
  
  .carousel-track {
    overflow-x: auto;
    scroll-snap-type: x mandatory; /* Force l'arrêt sur une carte */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Défilement inertiel ultra-fluide sur iOS */
    transform: none !important; /* DÉSACTIVE le déplacement JavaScript sur mobile */
    gap: 15px; /* Espace entre les cartes */
    padding-bottom: 20px;
  }
  
  /* Masquer la barre de défilement disgracieuse */
  .carousel-track::-webkit-scrollbar { display: none; }
  .carousel-track { -ms-overflow-style: none; scrollbar-width: none; }

  .carousel-slide {
    min-width: 85%; /* Laisse deviner la carte suivante sur le côté droit ! */
    scroll-snap-align: center; /* Centre la carte quand on lâche le doigt */
  }
  
  /* On cache les flèches et les points sur mobile : le swipe naturel suffit */
  .carousel-arrow, .carousel-dots {
    display: none !important;
  }


}

/* --- SEGMENTS & FILTRES (Thème sombre) --- */
.segment-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 15px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-filter {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  transition: all 0.2s ease;
}

.btn-filter:hover {
  border-color: var(--color-text-main);
  color: var(--color-text-main);
}

.btn-filter.active {
  background: var(--color-text-main);
  color: var(--color-bg-main);
  border-color: var(--color-text-main);
  font-weight: 700;
}

/* Animation rotation bouton synchro */
@keyframes spin { 100% { transform: rotate(360deg); } }
.spinning { animation: spin 1s linear infinite; }


/* =========================================
   NOUVEAUX STYLES : EXPLORE, CHALLENGE, PROFIL
   ========================================= */

/* Boutons SVG (Modifier / Supprimer) */
.action-icons {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}
.icon-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 5px;
  display: inline-flex;
}
.icon-btn:hover { color: var(--color-accent); transform: scale(1.15); }
.icon-btn.delete:hover { color: var(--danger); }

/* Titre orange pour les défis */
.challenge-title-accent {
  color: var(--color-accent);
}

/* Espacement des tuiles Explore (Grille) */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px; /* C'est ce 'gap' qui donne de l'air aux tuiles */
}

/* Image dans la tuile Challenge */
.challenge-header-layout {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.challenge-main-img {
  max-width: 120px;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.1);
}

/* Mise en page Profil */
.profile-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.profile-page-pic {
  border-radius: 50%;
  border: 3px solid var(--color-accent);
  width: 100px;
  height: 100px;
  object-fit: cover;
}


/* =========================================
   VUE ADMINISTRATEUR (TOGGLE)
   ========================================= */
/* Par défaut, les éléments admin sont cachés */
.admin-feature {
  display: none !important;
}

/* Quand le body a la classe view-admin, on les affiche */
body.view-admin .admin-feature {
  display: block !important;
}

/* Variante pour les éléments qui nécessitent flexbox (ex: conteneurs de boutons) */
body.view-admin .admin-feature-flex {
  display: flex !important;
}

/* Variante pour les éléments qui nécessitent inline-flex (ex: boutons SVG) */
body.view-admin .admin-feature-inline-flex {
  display: inline-flex !important;
}

/* =========================================
   OPTIMISATIONS MISSION (Détails & Tuiles)
   ========================================= */

/* 1. Grille pour les détails du défi (Page challenge.html) */
.challenge-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 15px;
  background: rgba(255, 255, 255, 0.02);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 30px;
}

/* 2. Ajustement de la grille Explore pour l'Option 1 (Hauteurs naturelles) */
.explore-grid {
  align-items: start; /* Empêche l'étirement vertical des tuiles sans image */
}

.challenge-card {
  display: flex;
  flex-direction: column;
  height: auto; /* Laisse la carte prendre sa taille naturelle */
}

/* =========================================
   FEATURED CHALLENGES & ISOLATION
   ========================================= */
body.isolated-mode .nav-group-1 {
  display: none !important; /* Cache Accueil, Explore, Create */
}

.featured-badge {
  display: inline-block;
  background: var(--color-accent);
  color: white;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.end-date-warning {
  color: var(--danger);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}


/* =========================================
   PAGINATION ÉLÉGANTE (explore.html)
   ========================================= */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 40px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-main);
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  transform: scale(1.1);
}

.pagination-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.pagination-text {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  min-width: 80px;
  text-align: center;
}


/* =========================================
   SYSTÈME DE NOTIFICATIONS
   ========================================= */

/* Pastille rouge sur l'icône cloche */
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--color-bg-main); /* Effet de détourage */
  pointer-events: none; /* Empêche de bloquer le clic sur l'icône */
}

/* Panneau déroulant */
.notification-panel {
  position: absolute;
  top: 45px;
  right: 0;
  width: 320px;
  background: var(--color-bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  text-align: left;
}

/* En-tête du panneau */
.notification-header {
  padding: 15px 20px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text-main);
}

/* Liste scrollable */
.notification-list {
  max-height: 350px;
  overflow-y: auto;
}

/* Item de notification standard */
.notif-item {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--color-text-main);
  transition: background 0.2s ease;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Item de notification NON LU */
.notif-item.unread {
  background: rgba(252, 76, 2, 0.05); /* Teinte orange très légère */
  border-left: 3px solid var(--color-accent);
}

/* Customisation de la barre de défilement pour la liste */
.notification-list::-webkit-scrollbar {
  width: 6px;
}
.notification-list::-webkit-scrollbar-track {
  background: transparent;
}
.notification-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* Adaptation Mobile */
@media (max-width: 768px) {
  .notification-panel {
    position: fixed; /* Détaché de l'icône sur mobile pour éviter de casser la largeur */
    top: 70px;
    right: 15px;
    width: calc(100% - 30px);
    max-width: 400px;
  }
}



