/* Recipe Detail Page Styles */

.recipe {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--spacing-xl);
  max-width: 800px;
  margin: 0 auto;
}

.recipe-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.recipe-name {
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.recipe-description {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  line-height: 1.7;
  font-weight: 300;
}

/* Recipe Header Actions */
.recipe-actions {
  display: flex;
  gap: var(--spacing-xs);
  flex-shrink: 0;
}

.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-xs);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.icon-button:hover {
  background-color: var(--accent-light);
  color: var(--primary-color);
  transform: scale(1.1);
}

.icon-button:active {
  transform: scale(0.95);
}

/* Favorite Button */
.favorite-button.favorited {
  color: var(--primary-color);
}

.favorite-button.favorited svg {
  fill: var(--primary-color);
}

/* Copy Toast */
.copy-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background-color: var(--primary-color);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Cooking Stats */
.cooking-stats {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 300;
  margin-bottom: var(--spacing-sm);
}

.cooking-stats:empty {
  display: none;
}

/* Cooking Notes Display */
#cooking-notes-display:empty {
  display: none;
}

.personal-notes {
  margin-top: var(--spacing-lg);
}

.personal-notes h3 {
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
  border-bottom: 2px solid var(--accent-light);
  padding-bottom: var(--spacing-sm);
  letter-spacing: 0.02em;
}

.personal-notes-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.personal-notes-header h3 {
  flex: 1;
}

.cooking-note-text {
  margin: 0;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-line;
}

.cooking-note-edit-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0 var(--spacing-sm);
}

.cooking-note-edit-btn:hover {
  text-decoration: underline;
}

.cooking-note-textarea {
  width: 100%;
  padding: var(--spacing-sm);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: var(--spacing-sm);
}

.cooking-note-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.cooking-note-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.cooking-note-save-btn,
.cooking-note-cancel-btn {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
}

.cooking-note-save-btn {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.cooking-note-save-btn:hover {
  background-color: var(--primary-dark);
}

.cooking-note-cancel-btn {
  background-color: var(--surface);
  color: var(--text-secondary);
}

.cooking-note-cancel-btn:hover {
  border-color: var(--primary-color);
}

/* Serving Adjuster */
.serving-adjuster {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.serving-adjuster button {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1.5px solid var(--primary-color);
  background: none;
  color: var(--primary-color);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}

.serving-adjuster button:hover {
  background-color: var(--primary-color);
  color: white;
}

.serving-adjuster button:active {
  transform: scale(0.9);
}

#current-servings {
  font-weight: 500;
  color: var(--text-primary);
}


/* Sections */
.ingredients,
.instructions {
  margin-top: var(--spacing-lg);
}

.ingredients h3,
.instructions h3 {
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
  border-bottom: 2px solid var(--accent-light);
  padding-bottom: var(--spacing-sm);
  letter-spacing: 0.02em;
}

/* Ingredients List */
.ingredient-category {
  margin-bottom: var(--spacing-lg);
}

.ingredient-category:last-child {
  margin-bottom: 0;
}

.ingredient-category h4 {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-sm);
}

.ingredients ul {
  list-style: none;
  padding: 0;
}

.ingredients li {
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  border-left: 3px solid var(--accent-light);
  background-color: var(--accent-light-alpha-30);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}

.ingredients li:hover {
  border-left-color: var(--accent-color);
}

.ingredient-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.ingredient-checkbox {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1;
}

.ingredients input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--primary-color);
}

.ingredients label {
  cursor: pointer;
  flex: 1;
  user-select: none;
}

.ingredients input[type="checkbox"]:checked + label {
  text-decoration: line-through;
  color: var(--text-secondary);
  opacity: 0.7;
}

.add-to-cart {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.add-to-cart:active {
  transform: scale(0.9);
}

.add-to-cart.in-cart {
  background-color: var(--accent-light);
  color: var(--primary-color);
}

.add-to-cart.in-cart svg {
  fill: var(--primary-color);
}

/* Instructions List */
.instructions ol {
  counter-reset: step-counter;
  list-style: none;
  padding: 0;
}

/* Ingredient references in steps */
.ingredient-ref {
  color: var(--primary-color);
  font-weight: 500;
}

/* Instructions List */
.instructions li {
  counter-increment: step-counter;
  padding: var(--spacing-md) 0;
  margin-bottom: var(--spacing-lg);
  position: relative;
  padding-left: 3.5rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.7;
  min-height: 2.5rem;
}

.instructions li:before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--primary-color);
  color: white;
  font-weight: 400;
  font-size: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Notes and Serving Suggestions */
.recipe-notes,
.serving-suggestions {
  margin-top: var(--spacing-lg);
  padding-left: var(--spacing-md);
  border-left: 3px solid var(--accent-color);
}

.recipe-notes h3,
.serving-suggestions h3 {
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: var(--spacing-sm);
  color: var(--primary-color);
}

.recipe-notes p,
.serving-suggestions p {
  margin: 0;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Similar Recipes */
#similar-recipes {
  margin-top: var(--spacing-xl);
}

#similar-recipes:empty {
  display: none;
}

#similar-recipes h3 {
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
  border-bottom: 2px solid var(--accent-light);
  padding-bottom: var(--spacing-sm);
  letter-spacing: 0.02em;
}

.similar-recipes-list {
  list-style: none;
  padding: 0;
}

.similar-recipe-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
}

.similar-recipes-list li:last-child .similar-recipe-item {
  border-bottom: none;
}

.similar-recipe-item:active {
  background: var(--accent-light-alpha-30);
}

.similar-recipe-body {
  flex: 1;
  min-width: 0;
}

.similar-recipe-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.4;
}

.similar-recipe-shared {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 300;
  margin-top: 0.15rem;
  line-height: 1.4;
}

.similar-recipe-chevron {
  color: var(--text-secondary);
  flex-shrink: 0;
  opacity: 0.5;
}

/* Action Buttons */
.action-buttons {
  margin-top: var(--spacing-xl);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--spacing-sm);
}

.action-buttons .button {
  flex: 1;
  width: auto;
}

.plan-week-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.2s;
}

.plan-week-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .recipe {
    padding: var(--spacing-md);
  }

  .recipe-name {
    font-size: 1.75rem;
  }

  .ingredients h3,
  .instructions h3 {
    font-size: 1.25rem;
  }

  .instructions li {
    padding-left: 3rem;
  }

  .instructions li:before {
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
  }

  .action-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: var(--spacing-md);
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 100;
  }

  #recipe-detail {
    padding-bottom: 5rem;
  }
}

@media (max-width: 480px) {
  .recipe {
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
  }

  .recipe-name {
    font-size: 1.5rem;
  }

  .recipe-description {
    font-size: 1rem;
  }
}

/* ─── Dark mode overrides ────────────────────────────────────────────────── */
:root[data-theme="dark"] .ingredients li {
  background-color: transparent;
  border-left-color: var(--accent-color);
}

:root[data-theme="dark"] .icon-button:hover {
  background-color: transparent;
}

:root[data-theme="dark"] .add-to-cart.in-cart {
  background-color: transparent;
}

/* ─── Print ─────────────────────────────────────────────────────────────── */

@media print {
  /* Reset page */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  header,
  .recipe-actions,
  .serving-adjuster,
  .add-to-cart,
  #similar-recipes,
  .action-buttons,
  .cooking-stats,
  .recipe-tags { display: none !important; }

  body { background: white; }

  .recipe {
    border: none;
    padding: 0;
    max-width: 100%;
    margin: 0;
  }

  /* Replace interactive checkboxes with printable squares */
  .ingredient-checkbox input[type="checkbox"] { display: none; }
  .ingredient-checkbox label::before {
    content: '';
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border: 1.5px solid #666;
    border-radius: 2px;
    margin-right: 0.5rem;
    vertical-align: middle;
    flex-shrink: 0;
  }

  /* Clean up ingredient rows */
  .ingredients li {
    border-left: none;
    background: none;
    padding: 0.2rem 0;
    margin: 0;
  }

  .ingredient-item { gap: 0; }

  /* Keep step numbers but make them print-friendly */
  .instructions li:before {
    background-color: #6B9080;
    print-color-adjust: exact;
  }

  /* Attribution footer */
  .recipe::after {
    content: 'biteme.ovh';
    display: block;
    margin-top: 2rem;
    font-size: 0.75rem;
    color: #999;
    text-align: right;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
  }
}
