/* Variables */
:root {
  --ff-main: "Poppins", sans-serif;
  --ff-text: "Inter", sans-serif;

  --color-black: #2c2c2c;
  --color-yellow: #ffeba1;
  --color-orange: #e25430;
  --color-blue: #9ec5e3;
  --color-orange-hover: #c74224;

  --color-light-old: #f5f2e8;
  --color-warm-old: #ffeba1;

  --color-fresh: #8edfb4;
  --color-warm: #dba070;

  --bg: #ffffff;
  --panel: #ffffff;
  --accent: #e25430;
  --text: #111;
  --muted: #6b6b6b;
  --container: 880px;
}

/* Reset CSS */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
/* ========================== */
/* FOCUS ACCESSIBLE GLOBAL */
/* ========================== */

*:focus {
  outline: 3px solid #e63946 !important;
  outline-offset: 3px !important;
  box-shadow: none !important;
}

/* Pour les navigateurs modernes */
*:focus-visible {
  outline: 3px solid #e63946 !important;
  outline-offset: 3px !important;
  box-shadow: none !important;
}


html {
  scroll-padding-top: var(--nav-height);
}

body {
  padding-top: var(--nav-height);
  padding-bottom: var(--footer-height);
}

/* Page loader */
.page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
}


/* Navigation */
nav {
  position: fixed;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px;
  background-color: #fff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  font-family: var(--ff-text);
}

nav a {
  padding: 6px 2px;
  color: var(--color-black);
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

nav a.link-recipe {
  position: relative;
  display: flex;
  align-items: center;
}

nav i.bx {
  font-size: 1rem;
}

.hidden-recipes {
  display: none;
}

/* Header */
header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 140px;
}

header .fil-ariane {
  display: flex;
  justify-content: start;
  margin: 1rem 2rem;
  margin-right: auto;
  font-family: var(--ff-text);
}

header .fil-ariane a {
  color: black;
  font-style: italic;
  font-weight: 300;
  text-decoration: underline;
}

header h1 {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
  font-weight: 700;
  font-size: 1.8rem;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 1.5rem;
    margin-top: 0;
  }
}

header hr {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30%;
  border: 1px solid #000;
}


/* Sous-menu */
.submenu {
  position: absolute;
  top: 32px;
  left: -30px;
  z-index: 500;
  display: none;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  background-color: #fff;
  border: 1px solid black;
  border-radius: 8px;
}

.link-recipe:hover+.submenu,
.submenu:hover {
  display: flex;
}

/* Allow JS/ARIA to control visibility as well */
.link-recipe[aria-expanded="true"] + .submenu,
.submenu.is-open {
  display: flex;
}

/* Improve tap targets inside submenu */
.submenu a {
  padding: 6px 2px;
}

nav img {
  height: 50px;
}

.nav-avatar {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  object-fit: cover;
}

nav .menu-elements {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-left: auto; /* push links/search/avatar to the right side */
}

nav .links {
  position: relative;
  display: flex;
  gap: 50px;
}

nav button {
  padding: 10px 20px;
  background-color: #fff;
  border: none;
  outline: none;
}

nav button .bx-search {
  font-size: 2rem;
}

.button-search {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background-color: transparent;
  border-radius: 50px;
  font-size: 1.2rem;
  cursor: pointer;
}

p {
  font-family: var(--ff-text);
}


/* Liste des recettes */
.all-recipes {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 85%;
  gap: 3rem;
  margin: 2rem auto;
  padding: 2rem;
}

.all-recipes .title-filter {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 80%;
  gap: 1rem;
  margin: auto;
}

.all-recipes .filter-add-recipe {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: end;
  width: 90%;
  gap: 1rem;
  margin: auto;
}

/* .all-recipes .title-filter button,
.all-recipes .filter-add-recipe button {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 20px;
  background-color: transparent;
  border: 2px solid black;
  border-radius: 50px;
  font-size: 1rem;
  cursor: pointer;
} */

button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
}

/* Bouton like */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
}

.like-btn .heart {
  font-size: 1.2rem;
  line-height: 1;
}

.like-btn.liked .heart,
.like-btn.broken .heart {
  color: #e63946;
}

.submenu-recipe .heart-icon {
  margin-right: 8px;
  font-size: 1rem;
}

/* Bouton ajout recette */
button.btn-add-recipe {
  background-color: var(--color-orange) !important;
  color: white;
  border: 2px solid transparent !important;
}

button.btn-add-recipe:hover {
  background-color: white !important;
  color: var(--color-orange);
  border: 2px solid var(--color-orange) !important;
  transition: 0.2s all ease;
}

/* Labels de fichiers interactifs */
label[for="banniere_file"],
label[for="photo_de_profil_file"] {
  color: var(--color-orange-hover);
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.12s ease, transform 0.08s ease;
}

label[for="banniere_file"]:hover,
label[for="photo_de_profil_file"]:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.banner-preview,
.avatar-preview {
  cursor: pointer;
  transition: box-shadow 0.12s ease, transform 0.08s ease;
}

.banner-preview:focus,
.avatar-preview:focus,
.banner-preview:hover,
.avatar-preview:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* Boutons de filtre */
.title-filter button,
.filter-add-recipe button {
  position: relative;
  transition: 0.3s all ease;
}

.title-filter button:hover,
.filter-add-recipe button:hover {
  background-color: #f0f0f0;
}

.filter-submenu {
  position: absolute;
  top: 50px;
  right: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  min-width: 200px;
  padding: 10px;
  background-color: white;
  border: 1px solid black;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.filter-submenu a {
  padding: 8px 12px;
  color: black;
  font-family: var(--ff-text);
  text-decoration: none;
  transition: 0.2s ease;
}

.filter-submenu a:hover {
  background-color: black;
  color: white;
  border-radius: 5px;
  cursor: pointer;
}

/* Grille de recettes */
.list-recipes {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 30px;
}

.list-recipes a {
  color: black;
  text-decoration: none;
}

/* Carte recette */
.card-recipe {
  position: relative;
  /* width: 350px; */
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 5px 5px rgba(0, 0, 0, 0.25);
}

.card-recipe img {
  width: 350px;
  height: 250px;
  object-fit: cover;
}

.card-recipe .content-recipe {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 20px 15px;
}

.card-recipe .content-recipe h1 {
  margin: 0;
  font-size: 1.3rem;
  font-family: var(--ff-text);
}

.card-recipe .content-recipe button {
  background-color: transparent;
  border: none;
  cursor: pointer;
}

button i.bx-dots-vertical-rounded {
  font-size: 1.4rem;
}

/* Sous-menu recette */
.submenu-recipe {
  position: absolute;
  top: 60px;
  right: 20px;
  z-index: 999;
  display: none;
  flex-direction: column;
  background-color: white;
  border: 2px solid black;
  border-radius: 8px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.submenu-recipe a {
  padding: 12px 20px;
  color: black;
  font-family: var(--ff-main);
  text-decoration: none;
  transition: 0.2s ease;
}

.submenu-recipe form button,
.submenu-recipe button {
  width: 100%;
  padding: 12px 20px;
  background-color: transparent;
  color: black;
  border: none;
  font-family: var(--ff-text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.submenu-recipe a:hover,
.submenu-recipe button:hover,
.submenu-recipe form button:hover {
  background-color: black !important;
  color: white;
  cursor: pointer;
}


/* Bannière préférences */
.banner-preferences {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 130px;
  background-color: var(--color-blue);
}

.banner-preferences span {
  display: flex;
  justify-content: center;
  align-items: center;
}

.banner-preferences span i.bx-info-circle {
  margin-right: 10px;
  font-size: 2rem;
}

.banner-preferences a {
  margin-top: 30px;
  padding: 10px 20px;
  background: white;
  color: black;
  border: 2px solid black;
  border-radius: 60px;
  font-size: 1.2rem;
  text-decoration: none;
}

.banner-preferences a:hover {
  background: black;
  color: white;
  transition: 0.2s all ease;
}

/* Modales */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  font-family: var(--ff-text);
}

.modal .close {
  position: absolute;
  right: 30px;
  top: 20px;
  color: var(--color-black);
  font-size: 2rem;
  cursor: pointer;
  transition: 0.2s all ease;
}

.modal .close:hover {
  color: var(--color-orange);
}

.modal-content {
  display: flex;
  flex-direction: column;
  width: 95%;
  max-width: 1200px;
  height: 90vh;
  gap: 25px;
  padding: 40px 50px;
  background: linear-gradient(145deg, #fff, #f9f9f9);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: 25px;
  color: var(--color-black);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
}

/* Formulaires add/edit */
#modal-add form,
#modal-edit form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#modal-add label,
#modal-edit label {
  color: var(--color-black);
  font-size: 1rem;
  font-weight: 600;
}

#modal-add input[type="text"],
#modal-add input[type="file"],
#modal-add textarea,
#modal-edit input[type="text"],
#modal-edit input[type="file"],
#modal-edit textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #ddd;
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  transition: 0.2s all ease;
}

#modal-add input[type="text"]:focus,
#modal-add input[type="file"]:focus,
#modal-add textarea:focus,
#modal-edit input[type="text"]:focus,
#modal-edit input[type="file"]:focus,
#modal-edit textarea:focus {
  border-color: var(--color-orange);
  box-shadow: 0 0 10px rgba(255, 131, 96, 0.3);
}

#modal-add textarea,
#modal-edit textarea {
  min-height: 200px;
  resize: vertical;
}

#modal-add .btn.primary,
#modal-edit .btn.primary {
  align-self: center;
  width: fit-content;
  padding: 14px 20px;
  background: var(--color-orange);
  color: white;
  border: 2px solid transparent;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s all ease;
}

#modal-add .btn.primary:hover,
#modal-edit .btn.primary:hover {
  background: white;
  color: var(--color-orange);
  border: 2px solid var(--color-orange);
}

/* Modale delete */
#modal-delete .modal-content {
  max-width: 450px;
  height: auto;
  padding: 30px 40px;
}

#modal-delete p {
  color: var(--color-black);
  font-size: 1rem;
  text-align: center;
}

#modal-delete .btn.danger {
  align-self: center;
  width: fit-content;
  padding: 14px 20px;
  background: var(--color-orange);
  color: white;
  border: 2px solid transparent;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s all ease;
}

#modal-delete .btn.danger:hover {
  background: white;
  color: var(--color-orange);
  border: 2px solid var(--color-orange);
}

#modal-delete #form-delete {
  margin: auto;
}

@media (max-width: 768px) {

  #modal-add .modal-content,
  #modal-edit .modal-content {
      width: 100%;
      height: 95vh;
      padding: 30px 20px;
  }

  #modal-delete .modal-content {
      width: 90%;
      padding: 25px 15px;
  }
}


/* Boutons génériques */
.btn {
  padding: 10px 16px;
  color: white;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: #2563eb;
}

.btn.danger {
  background: #dc2626;
}

.btn.danger:hover {
  background: #b91c1c;
}

/* ========================== */
/* TITLE + FILTER BUTTON */
/* ========================== */
.title-filter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 80%;
  margin: 1rem auto;
}

.title-filter h1 {
  font-size: 1.5rem;
  font-weight: bold;
}

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

form fieldset {
  padding: 10px;
}

/* Footer */
footer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  background-color: #fafafa;
  font-family: var(--ff-text);
  box-sizing: border-box;
  clear: both;
}

footer .list-elements-footer {
  display: flex;
  justify-content: center;
  gap: 100px;
  padding: 60px 130px;
  text-overflow: ellipsis;
}

footer .list-elements-footer div {
  display: flex;
  flex-direction: column;
}

footer .list-elements-footer div h1 {
  width: 100%;
  font-size: 1.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

footer .list-elements-footer div ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 20px;
  margin-top: 10px;
  list-style: none;
}

footer a {
  color: black;
}

footer p {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  text-align: center;
}

/* Modale de collection */
.modal-collection {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
}

.modal-collection .modal-content {
  width: 90%;
  max-width: 420px;
  padding: 20px;
  background: white;
  border-radius: 12px;
}

@keyframes pop {
  from {
      opacity: 0;
      transform: scale(0.8);
  }

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

.close-modal {
  float: right;
  font-size: 1.5625rem;
  cursor: pointer;
}

.modal-content button {
  margin-top: 10px;
  padding: 10px 14px;
  background: #2ecc71;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.success-message {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  padding: 12px 16px;
  background: #2ecc71;
  color: white;
  border-radius: 8px;
  animation: fadeOut 3s forwards;
}

@keyframes fadeOut {
  0% {
      opacity: 1;
  }

  80% {
      opacity: 1;
  }

  100% {
      opacity: 0;
      transform: translateY(-10px);
  }
}


/* Barre de recherche */
#search-container {
  position: fixed;
  top: 100px;
  right: 0;
  z-index: 9999;
  display: none;
  width: 500px;
  padding: 12px;
  background: white;
  border-bottom: 1px solid #ddd;
}

#search-container input#search-input:focus {
  border: 2px solid black;
}

#search-input {
  width: 100%;
  padding: 12px;
  font-size: 1.0625rem;
}

.result-card {
  display: flex;
  gap: 15px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 12px;
}

.result-card img {
  width: 120px;
  height: 90px;
  border-radius: 10px;
  object-fit: cover;
}

/* Résultats de recherche */
#results_search_container {
  position: fixed;
  top: 180px;
  right: 0;
  z-index: 9999;
  display: none;
  width: 500px;
  height: 550px;
  padding: 15px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

#results_search .card-recipe-search {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
}

#results_search .card-recipe-search img {
  width: 80px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

#results_search .card-recipe-search .content-recipe {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.875rem;
}

#results_search .card-recipe-search .content-recipe h1 {
  margin: 0;
  font-size: 0.9375rem;
}

#results_search .card-recipe-search .content-recipe p {
  margin: 2px 0;
  color: #555;
}

#results_search .card-recipe-search .content-recipe a {
  margin-top: 4px;
  color: #1a73e8;
  font-size: 0.8125rem;
  text-decoration: none;
}

#results_search .card-recipe-search .content-recipe a:hover {
  text-decoration: underline;
}

/* ================================================= */
/* =============== RESPONSIVE GLOBAL =============== */
/* ================================================= */

/* ----------- BASE ----------- */
@media (max-width: 1024px) {
  :root {
    --container: 100%;
  }
}


/* ================================================= */
/* ================= NAVIGATION ==================== */
/* ================================================= */
@media (max-width: 768px) {

  nav {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  nav img {
    height: 40px;
  }

  /* Menu principal */
  nav .links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    display: none;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  }

  nav .links.active {
    display: flex;
  }

  nav a {
    width: 100%;
    font-size: 1.1rem;
    padding: 10px 0;
  }

  /* Sous-menu recettes */
  .submenu {
    position: static;
    border: none;
    padding: 10px 0 0 15px;
    gap: 12px;
    display: none;
  }

  .submenu.is-open {
    display: flex;
  }

  .hidden-recipes {
    display: flex;
  }

  /* Burger */
  .burger {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 2000;
  }

  .burger span {
    width: 26px;
    height: 3px;
    background: black;
    border-radius: 2px;
  }
}

/* ================================================= */
/* ================= HEADER / HERO ================= */
/* ================================================= */
@media (max-width: 600px) {

  header {
    flex-direction: column !important;
    height: auto !important;
    margin-top: 120px !important;
  }

  header img,
  header img.plat-gauche,
  header img.plat-droite {
    height: 40vh !important;
  }

  div.slogan h1 {
    font-size: 2rem;
  }

  div.slogan h2 {
    font-size: 1.1rem;
  }
}

/* ================================================= */
/* =================== CONTENU ===================== */
/* ================================================= */
@media (max-width: 768px) {

  /* Sections trop larges */
  main .title,
  .banner-preferences,
  .last-recipes,
  footer .list-elements-footer {
    padding: 24px 16px !important;
  }

  /* Filtres / titres */
  .title-filter,
  .all-recipes .title-filter,
  .all-recipes .filter-add-recipe {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }
}

/* ================================================= */
/* ================= CARTES RECETTES =============== */
/* ================================================= */
@media (max-width: 600px) {

  .list-recipes {
    gap: 16px;
  }

  .card-recipe {
    width: 100%;
    max-width: 100%;
  }

  .card-recipe img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }
}

/* ================================================= */
/* ==================== SLIDER ===================== */
/* ================================================= */
@media (max-width: 600px) {

  .infos-slide {
    position: static;
    width: 100%;
    height: auto;
    padding: 16px;
    text-align: center;
    border-radius: 0;
  }

  .infos-slide button {
    font-size: 3rem;
  }

  .buttons-slider {
    gap: 6px;
  }

  .button-slider {
    width: 36px;
    height: 10px;
  }
}

/* ================================================= */
/* ==================== FOOTER ===================== */
/* ================================================= */
@media (max-width: 1180px) {

  footer .list-elements-footer {
    gap: 32px;
    text-align: center;
    margin: 3rem;
    font-size: 1.2rem;
  }

  footer .list-elements-footer div h1 {
    font-size: 1.3rem;
  }

  footer .list-elements-footer ul {
    margin-left: 0;
    font-size: 1.1rem;

  }
}


/* ================================================= */
/* =================== FOOTER DESKTOP ===================== */
/* ================================================= */

@media (min-width: 1150px) {
  footer .list-elements-footer {
    grid-template-columns: repeat(4, 1fr);
    gap: 80px;
    padding: 60px 80px;
  }
}


@media (min-width: 1046px) {
  footer .list-elements-footer {
    grid-template-columns: repeat(4, 1fr);
    gap: 80px;
    padding: 60px 130px;
  }
}


/* ================================================= */
/* =================== FOOTER TABLETTE ==================== */
/* ================================================= */

@media (min-width: 600px) {
  footer .list-elements-footer {
    grid-template-columns: repeat(2, 1fr);
    text-align: left;
  }

  footer .list-elements-footer div {
    align-items: flex-start;
  }
}

/* ================================================= */
/* ================= FOOTER MOBILE ================= */
/* ================================================= */

@media (max-width: 895px) {

  footer .list-elements-footer {
    flex-direction: column;
    gap: 32px;
    padding: 32px 20px;
    text-align: center;
  }

  footer .list-elements-footer div {
    align-items: center;
  }

  footer .list-elements-footer div ul {
    margin-left: 0;
  }

  footer h1 {
    font-size: 1.3rem;
  }

  footer a {
    font-size: 1rem;
  }

  footer .profil img {
    width: 110px;
    margin-bottom: 12px;
  }

  footer p {
    font-size: 0.85rem;
  }
}



/* ================================================= */
/* ================= UX TACTILE ==================== */
/* ================================================= */
@media (max-width: 768px) {
  a,
  button {
    min-height: 44px;
  }
}