/* ====== Reset léger ====== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", Arial, sans-serif;
  line-height: 1.7;
  background: #fafafa;
  color: #333;
}

/* ====== Header & Nav ====== */
header {
  background: linear-gradient(135deg, #43a047, #2e7d32);
  padding: 1.2rem;
  color: white;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 1px;
}

nav {
  margin-top: 0.8rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

nav a {
  text-decoration: none;
  color: white;
  font-weight: 500;
  transition: color 0.3s, border-bottom 0.3s;
  border-bottom: 2px solid transparent;
  padding-bottom: 0.2rem;
}

nav a:hover {
  color: #c8e6c9;
  border-bottom: 2px solid #c8e6c9;
}

/* ====== Main & Sections ====== */
main {
  padding: 2rem 5%;
  max-width: 1200px;
  margin: auto;
}

.hero {
  text-align: center;
  padding: 3rem 2rem;
  background: #e8f5e9;
  border-radius: 12px;
  margin-bottom: 3rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.hero h1 {
  font-size: 2.5rem;
  color: #2e7d32;
  margin-bottom: 1rem;
}

/* ====== Recipe Page ====== */
.recipe {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.recipe-image-container {
  width: 100%;
  max-height: 400px;
  overflow: hidden;
  border-radius: 12px;
  background-color: #f9f9f9;
  display: flex;
  justify-content: center;
  align-items: center;
}

.recipe-image-container img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}



.recipe-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
  color: #2e7d32;
}

.recipe-summary {
  font-size: 1.1rem;
  text-align: center;
  color: #555;
  margin-bottom: 2rem;
}

.recipe-content h2 {
  color: #2e7d32;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.recipe-content p,
.recipe-content li {
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
  margin-bottom: 0.7rem;
}

.recipe-content ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.recipe-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.recipe-content li {
  margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
  .recipe {
    padding: 1rem;
  }
  .recipe-header h1 {
    font-size: 2rem;
  }
}

/* ====== Recipe Grid ====== */
.featured-recipes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.featured-recipes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  justify-items: center; /* centre les cartes */
}

.recipe-card {
  width: 100%;
  max-width: 300px; /* largeur fixe max pour uniformité */
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.recipe-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.recipe-card img {
  width: 100%;          /* prend toute la largeur de la card */
  height: auto;         /* garde les proportions */
  border-radius: 8px;
  object-fit: cover;    /* si tu veux couper légèrement l’image pour remplir l’espace */
  margin-bottom: 0.5rem;
}



/* ====== Footer ====== */

footer {
  text-align: center;
  padding: 1rem;
  color: #555;
  font-size: 0.9rem;
}


#search-input {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  width: 60%;
  max-width: 400px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

#search-input:focus {
  outline: none;
  border-color: #2e7d32;
  box-shadow: 0 0 0 3px rgba(46,125,50,0.2);
}

#search-results {
  margin-top: 0.5rem;
  background: white;
  border-radius: 8px;
  max-width: 400px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#search-results a {
  display: block;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #2e7d32;
  border-bottom: 1px solid #eee;
}

#search-results a:hover {
  background: #e8f5e9;
}


.recipe-times {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #555;
}

.recipe-times span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ====== Pagination ====== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}

.pagination a {
  padding: 0.5rem 1rem;
  background-color: #43a047; /* vert foncé cohérent avec ton header */
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.3s, color 0.3s;
}

.pagination a:hover {
  background-color: #2e7d32; /* vert plus foncé au hover */
  color: #c8e6c9; /* léger vert clair pour le texte au hover */
}

.back-button {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: #2e7d32;
  color: white;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.3s;
}

.back-button:hover {
  background: #43a047;
}


/* ===== Dark theme ===== */
body.dark {
  background: #121212;
  color: #e0e0e0; /* texte général */
}

/* Liens */
body.dark a {
  color: #80cbc4; /* couleur claire pour les liens */
  text-decoration: none;
}

body.dark a:hover {
  color: #a5d6a7;
  text-decoration: underline;
}

/* Titres dans les recettes */
body.dark .recipe h1,
body.dark .recipe h2,
body.dark .recipe h3 {
  color: #a5d6a7; /* vert clair pour les titres */
}

/* Contenu texte des recettes */
body.dark .recipe-content p,
body.dark .recipe-content li {
  color: #e0e0e0; /* texte lisible sur fond sombre */
}

/* Cards */
body.dark .recipe-card {
  background: #1f1f1f;
  color: #e0e0e0;
}

body.dark .recipe-card h3 a {
  color: #80cbc4;
}

body.dark .recipe-card h3 a:hover {
  color: #a5d6a7;
}

/* Hero section */
body.dark .hero h1 {
  color: #a5d6a7;
}

/* Footer */
body.dark footer {
  color: #aaa;
}

/* Pagination */
body.dark .pagination a {
  background-color: #43a047;
  color: white;
}

body.dark .pagination a:hover {
  background-color: #2e7d32;
  color: #c8e6c9;
}

/* Search input */
body.dark #search-input {
  background: #1e1e1e;
  color: #e0e0e0;
  border-color: #555;
}


/* ===== Dark theme for single recipe ===== */
body.dark .recipe {
  background: #1f1f1f;
  color: #e0e0e0; /* texte général */
}

body.dark .recipe-header h1 {
  color: #a5d6a7; /* titre vert clair */
}

body.dark .recipe-summary {
  color: #cfcfcf; /* résumé légèrement plus clair */
}

body.dark .recipe-times span {
  color: #e0e0e0; /* temps préparation/cuisson */
}

body.dark .recipe-content h2,
body.dark .recipe-content h3 {
  color: #a5d6a7; /* titres secondaires vert clair */
}

body.dark .recipe-content p,
body.dark .recipe-content li {
  color: #e0e0e0; /* texte des paragraphes et listes */
}

body.dark .recipe-image-container {
  background-color: #2a2a2a; /* conteneur image */
}

body.dark .back-button {
  background: #2e7d32; 
  color: white;
  transition: background 0.3s;
}

body.dark .back-button:hover {
  background: #43a047;
  color: white;
}

/* Dark theme Hero */
body.dark .hero {
  background: #1e1e1e; /* gris très foncé */
  color: #a5d6a7;       /* texte vert clair pour contraste */
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

body.dark .hero h1 {
  color: #a5d6a7;       /* texte principal */
}

body.dark #search-input {
  background: #2a2a2a;
  color: #e0e0e0;
  border-color: #555;
}

body.dark #search-input::placeholder {
  color: #aaa;
}

.recipe-card a.recipe-link {
  display: flex;
  flex-direction: column;
  color: inherit; /* pour que le texte garde sa couleur */
  text-decoration: none; /* enlève le soulignement */
  height: 100%;
}

.recipe-card a.recipe-link:hover {
  text-decoration: none; /* facultatif */
}

.recipe-card a.recipe-link h3 {
  text-align: center;
  margin-bottom: 0.5rem; /* optionnel pour espacement */
  color: inherit;        /* garde la couleur selon light/dark */
}

