/* ============================================
   PAGE - Recipe detail
   ============================================ */

/* ── Photo gallery ── */
.gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.gallery-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--neutral-100);
  cursor: pointer;
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
}

.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumb {
  width: 72px;
  height: 54px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color var(--transition-fast);
  opacity: 0.7;
}

.gallery-thumb.active,
.gallery-thumb:hover {
  border-color: var(--primary-400);
  opacity: 1;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Recipe header ── */
.recipe-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.recipe-title {
  font-size: var(--text-3xl);
  line-height: var(--lh-tight);
}

.recipe-description {
  color: var(--neutral-600);
  line-height: var(--lh-loose);
}

.recipe-author {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--neutral-500);
}

/* ── Meta bar ── */
.recipe-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--neutral-100);
  border-radius: var(--radius-lg);
}

.recipe-meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  min-width: 80px;
  text-align: center;
}

.recipe-meta-item .meta-icon {
  color: var(--primary-400);
}

.recipe-meta-item .meta-value {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--neutral-700);
}

.recipe-meta-item .meta-label {
  font-size: var(--text-xs);
  color: var(--neutral-500);
}

/* ── Quantity calculator ── */
.quantity-calc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--primary-50);
  border: 1.5px solid var(--primary-200);
  border-radius: var(--radius-lg);
}

.quantity-calc-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--neutral-700);
}

.quantity-calc-original {
  font-size: var(--text-xs);
  color: var(--neutral-500);
  margin-top: var(--space-1);
}

.quantity-calc-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.quantity-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-400);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
}

.quantity-btn:hover {
  background: var(--primary-500);
}

.quantity-value {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--primary-500);
  min-width: 40px;
  text-align: center;
}

/* ── Ingredients list ── */
.ingredients-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.ingredient-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--neutral-100);
}

.ingredient-item:last-child {
  border-bottom: none;
}

.ingredient-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-400);
  flex-shrink: 0;
}

.ingredient-item.checked .ingredient-text {
  text-decoration: line-through;
  opacity: 0.5;
}

.ingredient-qty {
  font-weight: var(--fw-semibold);
  color: var(--neutral-800);
  min-width: 60px;
}

.ingredient-text {
  color: var(--neutral-600);
  transition: all var(--transition-fast);
}

/* Ingredient linked to another recipe */
.ingredient-linked {
  background: #FAFAFF;
}

.ingredient-recipe-link {
  color: #6D28D9;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #DDD6FE;
  font-weight: var(--fw-medium);
  transition: all var(--transition-fast);
}

.ingredient-recipe-link:hover {
  color: #5B21B6;
  text-decoration-color: #6D28D9;
}

/* ── Steps ── */
.steps-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.step {
  display: flex;
  gap: var(--space-4);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-400);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-text {
  color: var(--neutral-600);
  line-height: var(--lh-loose);
}

.step-img {
  margin-top: var(--space-3);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 400px;
}

.step-img img {
  width: 100%;
  height: auto;
}

/* ── Actions bar ── */
.recipe-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox-prev { left: var(--space-4); }
.lightbox-next { right: var(--space-4); }

/* ── Sub-recipes (recettes liees) ── */
.sub-recipes-section {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--neutral-200);
}

.sub-recipes-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.sub-recipe-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-base);
}

.sub-recipe-card:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.sub-recipe-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}

.sub-recipe-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sub-recipe-name {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  color: var(--neutral-800);
}

.sub-recipe-desc {
  font-size: var(--text-xs);
  color: var(--neutral-500);
}

/* ── Variants ── */
.variants-section {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--neutral-200);
}

.variants-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.variant-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: box-shadow var(--transition-base);
}

.variant-card:hover {
  box-shadow: var(--shadow-md);
}

.variant-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.variant-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  color: var(--neutral-800);
  flex: 1;
}

.variant-desc {
  font-size: var(--text-sm);
  color: var(--neutral-600);
  line-height: var(--lh-normal);
  margin-bottom: var(--space-3);
}

.variant-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.variant-ingredient {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  padding: var(--space-1) var(--space-3);
  background: var(--neutral-100);
  color: var(--neutral-600);
  border-radius: var(--radius-full);
}

/* ── Aliases for show.php ── */

.recipe-breadcrumb {
  font-size: var(--text-sm);
  color: var(--neutral-500);
  margin-bottom: var(--space-6);
}

.recipe-breadcrumb a {
  color: var(--neutral-500);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.recipe-breadcrumb a:hover {
  color: var(--primary-400);
}

.recipe-breadcrumb-sep {
  margin: 0 var(--space-2);
}

.recipe-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.recipe-photo-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--neutral-100);
  cursor: zoom-in;
}

.recipe-photo-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.recipe-photo-thumbs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
}

.recipe-photo-thumbs::-webkit-scrollbar { display: none; }

.recipe-thumb {
  width: 72px;
  height: 54px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  opacity: 0.7;
  transition: all var(--transition-fast);
  padding: 0;
  background: none;
}

.recipe-thumb.active,
.recipe-thumb:hover {
  border-color: var(--primary-400);
  opacity: 1;
}

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

.recipe-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--neutral-100);
  border-radius: var(--radius-lg);
}

.recipe-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--primary-400);
}

.recipe-meta-label {
  font-size: var(--text-xs);
  color: var(--neutral-500);
}

.recipe-meta-value {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--neutral-700);
}

.recipe-portions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--primary-50);
  border: 1.5px solid var(--primary-200);
  border-radius: var(--radius-lg);
}

.recipe-portions-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--neutral-700);
  margin-right: auto;
}

.recipe-portions-value {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--primary-500);
  min-width: 30px;
  text-align: center;
}

.recipe-section {
  margin-top: var(--space-6);
}

.recipe-section-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  color: var(--neutral-800);
  margin-bottom: var(--space-4);
}

.recipe-ingredients {
  list-style: none;
}

.recipe-ingredient {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--neutral-100);
}

.recipe-ingredient:last-child {
  border-bottom: none;
}

.recipe-ingredient.checked .form-check-label {
  text-decoration: line-through;
  opacity: 0.5;
}

.ingredient-link {
  color: #6D28D9;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #DDD6FE;
  font-weight: var(--fw-medium);
}

.ingredient-link:hover {
  color: #5B21B6;
  text-decoration-color: #6D28D9;
}

.recipe-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.recipe-step {
  display: flex;
  gap: var(--space-4);
}

.recipe-step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-400);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

.recipe-step-content {
  flex: 1;
  color: var(--neutral-600);
  line-height: var(--lh-loose);
}

.recipe-author {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--neutral-200);
  font-size: var(--text-sm);
  color: var(--neutral-500);
  text-align: center;
}

/* Lightbox overlay */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.lightbox-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}
