/*
 * public/css/style.css - Design Futuriste 2025 (Optimisé Alignement & Espacement)
 */

/* --- Variables et Réinitialisation Globale --- */
:root {
  --color-dark: #121212;
  --color-mid-dark: #1e1e1e;
  --color-primary: #00bcd4;
  --color-secondary: #ff3366;
  --color-text: #e0e0e0;
  --color-text-subtle: #888;
  --border-radius: 12px;
  --shadow-glow-primary: 0 0 8px rgba(0, 188, 212, 0.6);
  --shadow-glow-secondary: 0 0 8px rgba(255, 51, 102, 0.4);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--color-dark);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  /* Correction 1: Utilisation de Flexbox pour centrer le contenu global si besoin */
  justify-content: center;
  align-items: center;
  /* Centrage vertical si le contenu est plus petit que 100vh */
  padding: 50px 0;
  /* padding fixe en haut et en bas */
}

/* --- Conteneur Principal --- */
.container {
  width: 95%;
  max-width: 1200px;
  padding: 30px;
  background: var(--color-mid-dark);
  border: 1px solid rgba(0, 188, 212, 0.2);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), var(--shadow-glow-primary);
  animation: fadeIn 0.8s ease-out;
}

/* --- En-tête et Titres --- */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 3em;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(0, 188, 212, 0.7);
}

.header .accent {
  color: var(--color-primary);
}

.header .lead {
  color: var(--color-text-subtle);
  font-size: 1.1em;
  margin-top: 10px;
}

/* --- Section de Recherche --- */
.search {
  display: flex;
  gap: 15px;
  margin-bottom: 40px;
  align-items: center;
  justify-content: center;
  /* Maintient le centrage horizontal des éléments de recherche */
}

#query {
  flex-grow: 1;
  max-width: 400px;
  padding: 15px 20px;
  border: 2px solid var(--color-primary);
  background-color: #2a2a2a;
  color: var(--color-text);
  border-radius: 8px;
  font-size: 1em;
  transition: all 0.3s ease;
  box-shadow: inset 0 0 5px rgba(0, 188, 212, 0.3);
}

#query:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: inset 0 0 8px var(--color-secondary), 0 0 15px rgba(255, 51, 102, 0.4);
}

#btnSearch {
  padding: 15px 30px;
  background-color: var(--color-secondary);
  color: var(--color-dark);
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1em;
  text-transform: uppercase;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(255, 51, 102, 0.4);
}

#btnSearch:hover:not(:disabled) {
  background-color: #ff5e85;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(255, 51, 102, 0.6);
}

#btnSearch:disabled {
  background-color: #555;
  cursor: not-allowed;
  box-shadow: none;
}

.cooldown {
  color: var(--color-primary);
  font-weight: bold;
  animation: pulse 1s infinite alternate;
}

/* --- Section Résultat/Statut --- */
.result-section {
  min-height: 200px;
}

.loader {
  text-align: center;
  font-size: 1.2em;
  color: var(--color-primary);
  padding: 50px;
  border: 1px dashed rgba(0, 188, 212, 0.4);
  border-radius: var(--border-radius);
  margin: 20px 0;
  box-shadow: var(--shadow-glow-primary);
}

.error {
  background-color: rgba(255, 51, 102, 0.15);
  color: var(--color-secondary);
  padding: 15px;
  border: 1px solid var(--color-secondary);
  border-radius: 8px;
  margin: 20px 0;
  font-weight: bold;
}

.result-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-header h2 {
  color: var(--color-primary);
  font-size: 1.8em;
  text-shadow: 0 0 5px rgba(0, 188, 212, 0.5);
}

.result-header .generated-at {
  color: var(--color-text-subtle);
  font-size: 0.9em;
  font-style: italic;
  margin-top: 5px;
}


/* --- CONTENEUR ET STYLES DE CARTE LUXUEUSE --- */

/* Conteneur de la grille de cartes */
.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 30px;
  margin-top: 30px;
  padding: 0;
  background: none;
  border: none;
  font-size: 1em;
}

/* Style de la Carte */
.ranking-card {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.ranking-card:hover {
  transform: translateY(-5px);
  border-color: var(--color-primary);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 188, 212, 0.4);
}

/* --- Effets de Prestige pour le Top 3 --- */
.ranking-card.rank-1 {
  border-color: gold;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.ranking-card.rank-1 .rank-badge {
  background-color: gold;
  color: var(--color-dark);
}

.ranking-card.rank-2 {
  border-color: silver;
}

.ranking-card.rank-2 .rank-badge {
  background-color: silver;
  color: var(--color-dark);
}

.ranking-card.rank-3 {
  border-color: #cd7f32;
}

.ranking-card.rank-3 .rank-badge {
  background-color: #cd7f32;
  color: var(--color-dark);
}


/* --- Composants de la Carte --- */

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
}

.rank-badge {
  font-size: 1.8em;
  font-weight: 800;
  padding: 5px 15px;
  border-radius: 8px;
  background-color: var(--color-primary);
  color: var(--color-dark);
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 188, 212, 0.4);
}

.score-badge {
  text-align: right;
}

.score-label {
  display: block;
  font-size: 0.7em;
  color: var(--color-text-subtle);
  letter-spacing: 1px;
}

.score-value {
  font-size: 2em;
  font-weight: 900;
  color: var(--color-secondary);
  text-shadow: 0 0 8px rgba(255, 51, 102, 0.5);
  line-height: 1;
}

.card-title {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 15px;
  line-height: 1.3;
}

.explanation {
  color: var(--color-text-subtle);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 25px;
  padding-left: 10px;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
}

/* Section Sources - CORRECTION de l'espacement et alignement */
.sources-list {
  background-color: #121212;
  /* Correction 2: Diminution du padding */
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid rgba(0, 188, 212, 0.1);
}

.sources-list h4 {
  color: var(--color-primary);
  font-size: 0.9em;
  margin-bottom: 8px;
  /* Réduction légère de la marge */
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sources-content {
  color: #888;
  font-size: 0.8em;
  line-height: 1.4;
  /* Correction 3: Réduction du line-height pour resserrer les lignes */
}

.sources-content span {
  display: block;
  margin-bottom: 3px;
  /* Espacement minimal entre les sources */
}

/* --- Pied de Page --- */
footer {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer small {
  color: var(--color-text-subtle);
  font-size: 0.8em;
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  from {
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.6);
  }

  to {
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.9);
  }
}

/* --- Responsivité (Mobile) --- */
@media (max-width: 900px) {
  .container {
    padding: 20px;
    width: 100%;
  }

  .header h1 {
    font-size: 2.2em;
  }

  .search {
    flex-direction: column;
    gap: 10px;
  }

  #query {
    max-width: 100%;
  }

  #btnSearch {
    width: 100%;
    padding: 12px 20px;
  }

  /* Une seule colonne pour les cartes sur mobile */
  .cards-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ranking-card {
    padding: 20px;
  }
}

/* ============================================== */
/* CONSENTEMENT COOKIE (Luxe Subtil - Dark Mode)  */
/* ============================================== */

/* --- 1. Bannière Principale (Bottom Fixed) --- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  /* Utilisation des variables du thème */
  background-color: var(--color-dark);
  border-top: 1px solid var(--color-primary);
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  /* Toujours au-dessus */
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
}

.banner-content p {
  color: var(--color-text);
  font-size: 0.95em;
  line-height: 1.5;
}

.banner-actions {
  display: flex;
  gap: 15px;
  /* Pour que les boutons aient une taille équivalente (RGPD/CNIL) */
  flex-shrink: 0;
}

/* --- Styles de Bouton (Basés sur le thème) --- */
.btn-cookie {
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-transform: uppercase;
  font-size: 0.9em;
}

/* Bouton Tout Accepter (Primaire) */
.btn-accept {
  background-color: var(--color-primary);
  color: var(--color-dark);
  border-color: var(--color-primary);
}

.btn-accept:hover {
  background-color: #00A9B4;
  /* Légèrement plus clair */
  box-shadow: 0 4px 10px rgba(0, 141, 150, 0.4);
}

/* Bouton Tout Refuser (Secondaire/Négatif) */
.btn-refuse {
  background-color: transparent;
  color: var(--color-text-subtle);
  border-color: var(--color-text-subtle);
}

.btn-refuse:hover {
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}

/* Bouton Personnaliser (Neutre) */
.btn-customize {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}

.btn-customize:hover {
  background-color: var(--color-mid-dark);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* --- 2. Modale de Préférences (Overlay) --- */
.cookie-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cookie-modal {
  background-color: var(--color-mid-dark);
  padding: 30px;
  border-radius: var(--border-radius);
  max-width: 600px;
  width: 90%;
  box-shadow: 0 0 25px rgba(0, 141, 150, 0.3);
  border: 1px solid rgba(0, 141, 150, 0.3);
  animation: modal-in 0.3s ease-out;
}

.modal-title {
  font-family: var(--font-serif-title);
  color: var(--color-primary);
  margin-bottom: 10px;
  font-size: 1.8em;
}

.modal-intro {
  color: var(--color-text-subtle);
  margin-bottom: 25px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
}

/* --- Catégories de Cookies --- */
.category-list {
  margin-bottom: 30px;
}

.cookie-category {
  padding: 15px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.category-title {
  font-weight: 600;
  color: var(--color-text);
}

.category-status {
  font-size: 0.8em;
  padding: 3px 8px;
  border-radius: 4px;
}

.required {
  background-color: var(--color-text-subtle);
  color: var(--color-dark);
}

.category-description {
  font-size: 0.9em;
  color: var(--color-text-subtle);
  padding-right: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  /* Bouton Enregistrer plus visible */
  gap: 10px;
  margin-top: 20px;
}

/* --- Switch (Toggle) Style (Minimaliste et Moderne) --- */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #333;
  transition: 0.4s;
  border-radius: 20px;
  border: 1px solid var(--color-text-subtle);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 2px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

input:checked+.slider:before {
  transform: translateX(19px);
}

/* Animations */
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Responsivité du bandeau */
@media (max-width: 768px) {
  .cookie-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 15px;
  }

  .banner-actions {
    width: 100%;
    flex-direction: column;
    /* Boutons empilés */
    gap: 8px;
  }

  .btn-cookie {
    width: 100%;
  }

  .cookie-modal {
    margin: 20px;
  }
}