/* ==========================================================================
   PAGE DÉTAIL RECETTE
   ========================================================================== */

/* --- 1. Utilitaires --- */
.print-only-meta,
.print-only-image {
  display: none;
}

/* --- 2. En-tête Recette --- */
.recipe-header {
  margin-bottom: var(--space-l);
}
.recipe-title {
  margin-bottom: var(--space-m);
  font-family: var(--font-serif);
  font-size: 3rem;
  line-height: 1.1;
  color: var(--clr-text-main);
}
.recipe-description {
  max-width: 100%;
  margin-bottom: var(--space-m);
  font-family: var(--font-sans);
  font-size: 1.125rem;
  color: var(--clr-text-main);
}
.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: var(--space-l);
}
.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}

/* --- 3. Visuel & Méta (DESKTOP) --- */
.recipe-visual {
  margin-bottom: 64px;
}

.recipe-hero-image {
  width: 100%;
  height: 500px;
  margin-bottom: 24px;
  background-color: var(--clr-bg-body);
  border-radius: var(--radius-l);
  box-shadow: 0 4px 16px
    color-mix(in srgb, var(--clr-text-soft), transparent 92%);
  overflow: hidden;
}

.recipe-hero-figure {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
}
.recipe-hero-figure img,
.recipe-hero-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-caption {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: #ffffff;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  pointer-events: none;
}

/* BARRE D'INFOS (ALIGNEMENT PROPORTIONNEL) */
.recipe-meta-bar {
  display: flex;
  align-items: center; /* Centrage vertical */
  /* On enlève le padding latéral pour laisser le flex gérer l'équilibre */
  padding: 24px 0;
  margin-top: 0;

  background-color: var(--clr-bg-white);
  border-radius: var(--radius-l);
  box-shadow: 0 4px 12px
    color-mix(in srgb, var(--clr-text-soft), transparent 94%);
  border: 1px solid color-mix(in srgb, var(--clr-text-main), transparent 95%);
}

.meta-item {
  flex: 1; /* MAGIQUE : Chaque bloc prend 1 part égale de la largeur totale */
  display: flex;
  align-items: center;
  justify-content: center; /* Centre le contenu (Icône+Texte) dans sa part */
  gap: 16px;
}

.meta-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  color: var(--clr-text-main);
}
.meta-text {
  display: flex;
  flex-direction: column;
}
.meta-text .label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--clr-text-main), transparent 50%);
  margin-bottom: 2px;
}
.meta-text .value {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--clr-text-main);
}

.separator-v {
  flex: 0 0 1px; /* Largeur fixe pour le séparateur, ne grandit pas */
  height: 40px;
  background-color: color-mix(in srgb, var(--clr-text-main), transparent 90%);
  display: block;
}

/* --- 4. Layout Principal --- */
.recipe-body-grid {
  display: grid;
  grid-template-columns: 384px 1fr;
  align-items: start;
  gap: 64px;
  margin-bottom: 80px;
}

/* --- 5. Sidebar (Ingrédients) --- */
.recipe-sidebar {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--clr-text-main), transparent 80%)
    transparent;
}

.ingredients-card {
  padding: 32px;
  background-color: var(--clr-bg-white);
  border-radius: var(--radius-l);
  box-shadow: 0 4px 16px
    color-mix(in srgb, var(--clr-text-soft), transparent 96%);
}
.sidebar-title {
  margin-bottom: 24px;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--clr-text-main);
}
.sidebar-subtitle {
  margin-bottom: 16px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--clr-text-main);
}

/* Contrôleur Portions */
.portion-controller {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
  margin-bottom: 32px;
  background-color: transparent;
  border: 1px solid color-mix(in srgb, var(--clr-text-main), transparent 85%);
  border-radius: var(--radius-full);
}
.portion-controller button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--clr-text-main);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--clr-text-main), transparent 80%);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}
.portion-controller button:hover {
  color: var(--clr-text-soft);
  background-color: var(--clr-accent-gold);
  border-color: var(--clr-accent-gold);
}
.portion-controller span {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
}

/* Ustensiles & Ingrédients */
.ustensils-section {
  margin-top: 0;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid
    color-mix(in srgb, var(--clr-text-main), transparent 90%);
}
.ustensils-list {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: color-mix(in srgb, var(--clr-text-main), transparent 20%);
  list-style: disc inside;
}
.ustensils-list li {
  margin-bottom: 8px;
}
.ingredients-list {
  margin-bottom: 48px;
  list-style: none;
}
.ingredient-item {
  border-bottom: 1px solid
    color-mix(in srgb, var(--clr-text-main), transparent 90%);
  border-radius: 4px;
  transition: background-color 0.2s ease, border-radius 0.2s ease;
}
.ingredient-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
}
.checkbox-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  padding: 12px 8px;
  cursor: pointer;
}
.checkbox-wrapper input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  cursor: pointer;
}
.custom-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background-color: transparent;
  border: 1px solid color-mix(in srgb, var(--clr-text-main), transparent 70%);
  border-radius: 4px;
  transition: all 0.2s ease;
}
.ingredient-item:hover .custom-checkbox {
  border-color: var(--clr-accent-gold);
}
.checkbox-wrapper input:checked ~ .custom-checkbox {
  background-color: var(--clr-accent-gold);
  border-color: var(--clr-accent-gold);
}
.check-icon {
  display: none;
  width: 16px;
  height: 16px;
  color: var(--clr-text-soft);
}
.checkbox-wrapper input:checked ~ .custom-checkbox .check-icon {
  display: block;
}
.ing-text {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--clr-text-main);
  transition: opacity 0.2s ease;
}
.checkbox-wrapper input:checked ~ .ing-text {
  text-decoration: line-through;
  opacity: 0.5;
}

/* --- 6. Préparation --- */
.section-title {
  margin-top: 0;
  margin-bottom: 16px;
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--clr-text-main);
}
.step-item {
  display: flex;
  gap: 32px;
  margin-bottom: 48px;
}
.step-number {
  min-width: 40px;
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  color: var(--clr-text-main);
}
.step-text {
  padding-top: 8px;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--clr-text-main);
}
.chef-note {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 48px;
  padding: 24px 32px;
  background-color: var(--clr-bg-white);
  border-left: 4px solid var(--clr-accent-gold);
  border-radius: 0 8px 8px 0;
}
.note-icon img {
  width: 32px;
  height: auto;
  opacity: 0.8;
}
.note-content p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--clr-text-main);
}

/* --- 7. Suggestions & Autres --- */
.suggestions-section {
  margin-bottom: 80px;
}
.suggestions-title {
  margin-bottom: 32px;
  font-family: var(--font-serif);
  font-size: 2rem;
}
.recipes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-l);
  margin-top: 32px;
}

/* --- 8. Modal Partage --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: rgba(46, 46, 46, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.share-modal {
  width: 90%;
  max-width: 400px;
  padding: 32px;
  background-color: var(--clr-bg-white);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.open .share-modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-header h3 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--clr-text-main);
}
.modal-header button {
  color: color-mix(in srgb, var(--clr-text-main), transparent 40%);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}
.modal-header button:hover {
  color: var(--clr-text-main);
}
.share-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-items: center;
  column-gap: 8px;
  row-gap: 24px;
}
.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
}
.share-option span {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--clr-text-main);
}
.share-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  color: white;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.share-option:hover .share-icon {
  transform: scale(1.1);
}
.brand-whatsapp .share-icon {
  background-color: #25d366;
}
.brand-facebook .share-icon {
  background-color: #1877f2;
}
.brand-twitter .share-icon {
  background-color: #1da1f2;
}
.brand-email .share-icon {
  background-color: var(--clr-accent-gold);
}
.brand-copy .share-icon {
  background-color: var(--clr-text-main);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* --- 9. Responsive --- */
@media (max-width: 1024px) {
  .recipes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .recipes-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   RESPONSIVE MOBILE (PAGE RECETTE) - VERSION FINALE
   ========================================================================== */
@media (max-width: 900px) {
  /* 1. Layout Global */
  .recipe-visual {
    margin-bottom: 24px;
  }
  .recipe-body-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 40px;
  }

  /* 2. Image */
  .recipe-hero-image {
    height: 250px;
    margin-bottom: 16px;
  }

  /* 3. Méta-barre (Temps) */
  .recipe-meta-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 12px;
    padding: 16px;
    margin-top: 0;
    margin-bottom: 0;
    border-radius: var(--radius-m);
  }

  .separator-v {
    display: none;
  }
  .meta-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }
  .meta-item {
    width: 100%;
    justify-content: flex-start;
  }

  /* 4. Sidebar Ingrédients (Remontée) */
  .recipe-sidebar {
    width: 100%;
    order: 1;
    position: relative;
    top: 0; /* ANNULATION du top sticky */
    margin-top: 0;
    margin-bottom: 48px;
  }

  .ingredients-card {
    padding: 20px;
    margin-bottom: 0;
  }

  /* 5. Instructions */
  .recipe-instructions {
    order: 2;
    padding-left: 0;
  }
  .step-item {
    gap: 16px;
    margin-bottom: 32px;
  }
  .step-number {
    font-size: 2rem;
    min-width: 32px;
    line-height: 1.2;
  }
  .recipe-title {
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: 12px;
  }
  .action-btn span {
    display: none;
  }
  .recipe-actions {
    gap: 12px;
  }
}

@media print {
  @page {
    size: Letter;
    margin: 0.75in;
  }
  body {
    background-color: white;
    color: #111;
    font-size: 10pt;
    line-height: 1.4;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .site-header,
  .site-footer,
  .breadcrumbs-container,
  .recipe-actions,
  .suggestions-section,
  #floating-search-btn,
  .portion-controller,
  .tag-pill,
  .checkbox-wrapper input,
  .recipe-tags,
  .recipe-meta-bar,
  .recipe-visual,
  .print-only-visual,
  #btn-wake-lock {
    display: none !important;
  }
  .container-main {
    max-width: 100% !important;
    margin: 0;
    padding: 0;
  }
  .recipe-header {
    margin-bottom: 24px;
    padding-bottom: 0;
    border: none;
  }
  .recipe-title {
    margin-bottom: 8px;
    font-size: 26pt;
    line-height: 1.1;
    color: #000;
  }
  .recipe-description {
    margin-bottom: 0;
    font-size: 11pt;
    font-style: italic;
    color: #444;
  }
  .recipe-body-grid {
    display: grid;
    grid-template-columns: 32% 63%;
    gap: 5%;
    align-items: start;
    margin-top: 0;
  }
  .recipe-sidebar {
    position: static !important;
    max-height: none !important;
    padding-right: 20px;
    overflow: visible !important;
    border-right: 1px solid #eee;
  }
  .ingredients-card {
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  .print-only-meta {
    display: block !important;
    margin-bottom: 32px;
    padding: 0;
    background: transparent !important;
    border: none;
  }
  .print-meta-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    padding-bottom: 2px;
    font-size: 10pt;
    border-bottom: 1px dotted #ccc;
  }
  .print-meta-item:last-child {
    border-bottom: none;
  }
  .print-meta-item strong {
    font-weight: 600;
    color: #000;
  }
  .print-meta-item span[style] {
    font-weight: 700;
    color: #000 !important;
  }
  .ustensils-section {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
  }
  .sidebar-subtitle {
    margin-bottom: 8px;
    font-size: 12pt;
    font-weight: 700;
    text-transform: uppercase;
    color: #444;
  }
  .ustensils-list {
    margin: 0 0 0 20px !important;
    padding: 0 !important;
    list-style: disc !important;
  }
  .ustensils-list li {
    position: relative;
    margin-bottom: 2px;
    padding-left: 0;
    font-size: 10pt;
    color: #333;
  }
  .ustensils-list li::before {
    content: none !important;
    display: none !important;
  }
  .sidebar-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 14pt;
    font-weight: 700;
    color: #000;
    border-bottom: 1px solid #333;
  }
  .ingredients-list {
    margin-bottom: 16px;
  }
  .ingredient-item {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    page-break-inside: avoid;
  }
  .custom-checkbox {
    width: 14px;
    height: 14px;
    margin-right: 10px;
    border: 1px solid #333 !important;
    border-radius: 3px;
  }
  .ing-text {
    font-size: 10.5pt;
    color: #000;
  }
  .ing-text strong.qty {
    font-weight: 700;
  }
  .recipe-instructions {
    padding-left: 0;
  }
  .print-only-image {
    display: block !important;
    height: 180px;
    margin-bottom: 32px;
    overflow: hidden;
    border: none;
    border-radius: 0;
  }
  .print-only-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .section-title {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 16pt;
    font-weight: 700;
    color: #000;
    border-bottom: 1px solid #333;
  }
  .step-item {
    gap: 16px;
    margin-bottom: 20px;
    page-break-inside: avoid;
  }
  .step-number {
    min-width: 24px;
    font-size: 18pt;
    font-weight: 700;
    line-height: 1;
    color: #000 !important;
  }
  .step-text {
    font-size: 11pt;
    text-align: justify;
    color: #000;
  }
  .chef-note {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    padding: 8px 16px;
    background-color: transparent !important;
    border: none;
    border-left: 4px solid var(--clr-accent-gold) !important;
    border-radius: 0;
    page-break-inside: avoid;
  }
  .note-icon img {
    width: 24px;
    opacity: 0.6;
    filter: grayscale(100%);
  }
  .note-content p {
    margin: 0;
    font-size: 10pt;
    font-style: italic;
    color: #333;
  }
}
