/* Typography: Inter on recettes page */
body {
  font-family: 'Inter', var(--ff-text), system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ========================== */
/* HEADER & CATEGORIES */
/* ========================== */
header {
  margin-top: 140px; /* rely on body padding-top for fixed nav offset */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

/* Use global header h1 style from global.css */

main {
  width: 80%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: auto;
}


.list-buttons {
  display: flex;
  gap: 1rem;
}

.list-buttons button,
.list-buttons a {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 5px;
  background-color: transparent;
  color: black;
  font-family: var(--ff-text);
  font-size: 1.15rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.list-buttons button:hover,
.list-buttons a:hover,
.list-buttons button.active,
.list-buttons a.active {
  text-decoration: underline;
}

hr {
  width: 60%;
  border: 1px solid #000;
  margin: 1rem 0;
}

/* ========================== */
/* SEARCH BAR */
/* ========================== */
.search-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem auto;
  gap: 1rem;
  width: 80%;
}

.search-bar button {
  background-color: #000;
  border: none;
  border-radius: 5px;
  padding: 0.5rem 1rem;
  color: white;
  cursor: pointer;
}

.search-bar .separator {
  width: 1px;
  height: 2rem;
  background-color: #ccc;
}

.search-bar input {
  padding: 0.5rem 1rem;
  border-radius: 5px;
  border: 1px solid #ccc;
  width: 60%;
}

.search-bar label {
  font-weight: 600;
}


/* ========================== */
/* RECIPES LIST & CARDS */
/* ========================== */
.list-recipes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 2rem;
}

.recipe-card {
  width: 300px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
  position: relative; /* important pour le submenu */
  overflow: visible;

}

.recipe-image-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.recipe-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Badges niveau et durée */
.recipe-badges {
  font-family: var(--ff-text);
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.badge {
  background-color: rgba(0,0,0,0.7);
  color: white;
  font-size: 1rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Content de la carte */
.recipe-card-content {
  font-family: var(--ff-text);

  padding: 0.5rem 1rem 1rem 1rem;
  position: relative; /* pour submenu */
}

.recipe-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.recipe-card-header h1 {
  font-size: 1.1rem;
  font-weight: bold;
  margin: 0;
  flex: 1;
}

.recipe-card-header button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
}

/* Submenu like / enregistrer */
.submenu-recipe {
  display: none;
  position: absolute;
  top: 240px !important;
  right: 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  flex-direction: column;
  gap: 0.3rem;
  z-index: 1000;
}

.submenu-recipe a,
.submenu-recipe button {
  font-size: 0.85rem;
  color: #000;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.submenu-recipe.active {
  display: flex; /* affiché quand JS ajoute la classe */
}

/* ========================== */
/* MODAL FILTRE */
/* ========================== */
.filter-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
}

.filter-modal-content {
  background-color: #fff;
  margin: 80px auto;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  border-radius: 8px;
  position: relative;
  height: fit-content;
}

.filter-modal .close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 2rem;
  cursor: pointer;
}

.filter-modal h2, .filter-modal h3 {
  margin: 1rem 0;
}

.filter-modal label {
  display: block;
  margin-bottom: 0.5rem;
}

.filter-modal button {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 5px;
  background-color: #000;
  color: white;
  cursor: pointer;
  border: 2px solid black;
}

.filter-modal .apply-filter {
  width: 100%;
  margin-top: 0.6rem;
}

/* Niveau sélectionné */
.filter-modal input[type="radio"]:checked + label {
  background-color: #000;
  color: white;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}

/* Boutons de tri sélectionné */
.filter-modal button[type="submit"][name="filter"].active {
  background-color: white;
  color: black;
}

/* Optional : hover pour tous les labels */
.filter-modal label:hover {
  /* background-color: rgba(0,0,0,0.1); */
  cursor: pointer;
}

.filter-modal button[type="submit"][name="filter"]:hover {
  background-color: white;
  color: black;
  border: 2px solid black;
}

button.reset-filter {
  margin-top: 30px;
  width: 100%;
  background-color: white;
  border: 2px solid rgb(191, 30, 30);
  color: rgb(191, 30, 30);
}

button.reset-filter:hover {
  border: 2px solid black;
  color: white;
  background-color: rgb(191, 30, 30);

}

/* Phone responsiveness */
@media (max-width: 600px) {
  header { margin-top: 0; }
  main { width: 95%; }
  .list-buttons { flex-wrap: wrap; gap: 0.5rem; }

  .search-bar { width: 100%; gap: 0.5rem; }
  .search-bar input { width: 100%; }

  .list-recipes { gap: 12px; }
  .recipe-card { width: 100%; max-width: 380px; }
  .recipe-image-wrapper { height: 200px; }

  .submenu-recipe { right: 8px; }
  .filter-modal-content { margin: 60px auto; padding: 1rem; width: 92%; }
}