/* ============================================
   Tasty – Opskrift Detalje + Editor Styles v2
   ============================================ */

/* ============================
   OPSKRIFT DETALJE
   ============================ */

.recipe-detail {
  background: var(--color-white);
  min-height: 100vh;
  padding-bottom: 100px;
}

/* Top: tilbage + hjerte */
.recipe-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  position: sticky;
  top: 0;
  z-index: 10;
  background: transparent;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  -webkit-tap-highlight-color: transparent;
}
.back-btn svg { width: 20px; height: 20px; color: var(--color-text-dark); }

.fav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  -webkit-tap-highlight-color: transparent;
}
.fav-btn svg { width: 20px; height: 20px; color: var(--color-text-dark); }

/* Edit-knap (svæver øverst til højre) */
.edit-btn {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  z-index: 20;
  -webkit-tap-highlight-color: transparent;
}
.edit-btn svg { width: 17px; height: 17px; color: var(--color-text-dark); }

/* Cirkulær billede-sektion */
.recipe-detail-image-section {
  display: flex;
  justify-content: center;
  padding: 0 var(--space-md) var(--space-lg);
  margin-top: -20px;
}

.recipe-detail-image-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-bg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recipe-detail-image-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recipe-detail-image-circle .placeholder-emoji {
  font-size: 56px;
}

/* Tekst-body */
.recipe-detail-body {
  padding: 0 var(--space-md);
}

.recipe-detail-cat {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.recipe-detail-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  letter-spacing: -0.4px;
  margin-bottom: var(--space-lg);
}

/* Stats-række: kcal / gram / tid / portioner */
.recipe-stats-row {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-lg);
  background: #EDE5DE;
  border-radius: var(--radius-lg);
  padding: var(--space-md) 0;
}

.recipe-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border-right: 1px solid var(--color-border);
}
.recipe-stat:last-child { border-right: none; }

.recipe-stat-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--color-text-dark);
  letter-spacing: -0.5px;
}

.recipe-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-light);
  text-align: center;
}

/* Portioner-justering */
.servings-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: #EDE5DE;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: var(--space-lg);
}

.servings-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-mid);
  flex: 1;
}

.servings-ctrl {
  display: flex;
  align-items: center;
  gap: 16px;
}

.servings-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-white);
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  color: var(--color-text-dark);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.servings-btn:active { background: #D8CCBF; }
.servings-btn:disabled { opacity: 0.35; }

.servings-val {
  font-size: 18px;
  font-weight: 800;
  min-width: 24px;
  text-align: center;
  color: var(--color-text-dark);
}

.servings-reset {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

/* Tags */
.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.recipe-tag {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Divider */
.recipe-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-lg) 0;
}

/* Sektion-overskrift */
.recipe-section-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: var(--space-md);
  letter-spacing: -0.3px;
}

/* Sektionsunderoverskrift (fx "Salat", "Marinade") */
.section-subtitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
  padding-left: 2px;
}

/* Ingrediens-liste */
.ingredients-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-sm); }

.ingredient-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: #EDE5DE;
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.ingredient-emoji {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.ingredient-name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-dark);
}

.ingredient-amount {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
}

/* Fremgangsmåde */
.steps-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-md); }

.step-item {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-dark);
  flex: 1;
  padding-top: 4px;
}

/* Video */
.video-section { margin-top: var(--space-lg); }
.video-embed { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius-lg); overflow: hidden; background: #000; }
.video-embed iframe, .video-embed video { width: 100%; height: 100%; border: none; display: block; }

/* Start madlavning-knap */
.start-cooking-btn {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 416px;
  background: var(--color-accent-dark);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  padding: 17px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  z-index: 50;
  letter-spacing: -0.2px;
  -webkit-tap-highlight-color: transparent;
}
.start-cooking-btn:active { opacity: 0.85; }
.start-cooking-btn svg { width: 18px; height: 18px; }


/* ============================
   OPRET / REDIGER FORMULAR
   ============================ */

.editor-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.editor-back-btn {
  width: 36px;
  height: 36px;
  background: #EDE5DE;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.editor-back-btn svg { width: 20px; height: 20px; }

.editor-header h2 {
  font-size: 18px;
  font-weight: 800;
  flex: 1;
  letter-spacing: -0.3px;
}

.editor-save-btn {
  background: var(--color-accent-dark);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.editor-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  background: var(--color-bg);
  min-height: calc(100vh - 64px);
}

/* Billede-upload */
.image-upload-area {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius-xl);
  border: 2px dashed var(--color-border);
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.image-upload-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.image-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-light);
  pointer-events: none;
  z-index: 1;
}
.image-upload-label svg { width: 32px; height: 32px; }
.image-upload-label span { font-size: 14px; font-weight: 500; }

/* Formularfelter */
.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-input, .field-textarea, .field-select {
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 15px;
  font-family: var(--font-sans);
  color: var(--color-text-dark);
  background: var(--color-white);
  outline: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  width: 100%;
  transition: box-shadow 0.2s;
}

.field-input:focus, .field-textarea:focus, .field-select:focus {
  box-shadow: 0 0 0 2px var(--color-accent-dark);
}

.field-textarea { resize: none; min-height: 90px; line-height: 1.5; }

.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Dynamiske lister */
.dynamic-list { display: flex; flex-direction: column; gap: var(--space-sm); }

.dynamic-item { display: flex; align-items: flex-start; gap: var(--space-sm); }
.dynamic-item .field-input, .dynamic-item .field-textarea { flex: 1; }

.remove-item-btn {
  width: 44px;
  height: 44px;
  background: var(--color-white);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-danger);
  flex-shrink: 0;
  margin-top: 3px;
  -webkit-tap-highlight-color: transparent;
}
.remove-item-btn svg { width: 16px; height: 16px; }

.add-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--color-white);
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 13px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-mid);
  width: 100%;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}
.add-item-btn svg { width: 18px; height: 18px; }

/* Step reorder knapper */
.step-reorder-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  margin-top: 3px;
}

.reorder-btn {
  width: 32px;
  height: 28px;
  background: #EDE5DE;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.reorder-btn:active { background: #D8CCBF; }
.reorder-btn svg { width: 14px; height: 14px; }

/* Step content wrapper + ingrediens-linker */
.step-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.step-link-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  cursor: pointer;
  font-family: var(--font-sans);
  width: 100%;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, color 0.15s;
}
.step-link-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.step-link-btn:has(~ .step-ing-picker[style*="block"]),
.step-link-btn.active {
  border-color: var(--terracotta);
  color: var(--terracotta);
}

.step-ing-picker {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-ing-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-dark);
  border-bottom: 1px solid var(--color-border);
}
.step-ing-check:last-child { border-bottom: none; }
.step-ing-check input[type=checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--terracotta);
  flex-shrink: 0;
  cursor: pointer;
}

/* Underopskrift blokke (editor) */
.sub-recipe-block {
  background: #EDE5DE;
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.sub-recipe-header {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  align-items: center;
}

.sub-recipe-header .field-input { flex: 1; }

.remove-sub-recipe-btn {
  width: 36px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-danger);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.remove-sub-recipe-btn svg { width: 18px; height: 18px; }

.field-label-hint {
  font-weight: 400;
  text-transform: none;
  font-size: 11px;
  color: var(--color-text-light);
}

/* Slet-sektion */
.delete-section { padding-bottom: var(--space-xl); }

.btn-danger {
  width: 100%;
  background: none;
  color: var(--color-danger);
  border: 1.5px solid var(--color-danger);
  border-radius: var(--radius-pill);
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================
   Rating
   ============================================ */
.recipe-rating {
  margin: var(--space-md) 0 var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rating-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-mid);
  width: 72px;
}

.rating-stars {
  display: flex;
  gap: 2px;
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  color: var(--terracotta);
  display: flex;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}
.star-btn:active { transform: scale(1.2); }
.star-btn svg { width: 26px; height: 26px; }
.star-btn.filled svg { fill: var(--terracotta); }

/* ============================================
   Madlavningstilstand overlay
   ============================================ */
#cooking-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.25s;
}
#cooking-overlay.open { opacity: 1; }

.cooking-sheet {
  width: 100%;
  max-height: 92dvh;
  background: var(--color-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(40px);
  transition: transform 0.25s;
}
#cooking-overlay.open .cooking-sheet { transform: translateY(0); }

.cooking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
  flex-shrink: 0;
}

.cooking-close-btn {
  background: var(--color-bg);
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-dark);
  -webkit-tap-highlight-color: transparent;
}
.cooking-close-btn svg { width: 18px; height: 18px; }

.cooking-counter {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cooking-step-area {
  padding: 16px 20px;
  flex-shrink: 0;
}

.cooking-step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--terracotta);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.cooking-step-text {
  font-size: 18px;
  line-height: 1.55;
  color: var(--color-text-dark);
  font-weight: 500;
}

.cooking-ings {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--color-border);
  padding: 12px 20px;
  min-height: 0;
}

.cooking-ings-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-light);
  margin-bottom: 10px;
}

.cooking-ing-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cooking-ing-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-dark);
  line-height: 1.4;
}

.cooking-ing-dot {
  color: var(--terracotta);
  font-size: 16px;
  flex-shrink: 0;
}

.cooking-ing-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
  margin-top: 8px;
}

.cooking-nav {
  display: flex;
  gap: 12px;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.cooking-prev-btn,
.cooking-next-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
.cooking-prev-btn { background: var(--color-bg); color: var(--color-text-dark); }
.cooking-prev-btn:disabled { opacity: 0.3; cursor: default; }
.cooking-prev-btn svg, .cooking-next-btn svg { width: 18px; height: 18px; }
.cooking-next-btn { background: var(--basil-green); color: #fff; }
.cooking-next-btn.done { background: var(--terracotta); }
