﻿:root {
  --bg: #f5f3ec;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: #ffffff;
  --text: #0f2a23;
  --muted: #567067;
  --line: rgba(15, 42, 35, 0.12);
  --accent: #0f3a2e;
  --accent-2: #b24a2f;
  --shadow: 0 18px 40px rgba(17, 39, 33, 0.12);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #fff8e7 0%, transparent 42%),
    radial-gradient(circle at 90% 20%, #e4f2e9 0%, transparent 38%),
    var(--bg);
}

body {
  position: relative;
  padding-bottom: 3rem;
}

.bg-glow {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  filter: blur(50px);
  opacity: 0.35;
}

.bg-glow-1 {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: #f2b66a;
  top: -70px;
  right: -80px;
}

.bg-glow-2 {
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: #80b79a;
  bottom: -120px;
  left: -100px;
}

.hero {
  padding: 2.4rem 1rem 1.2rem;
}

.hero-inner {
  max-width: 1240px;
  margin: 0 auto;
  background:
    radial-gradient(1200px 440px at -8% -78%, rgba(255, 237, 208, 0.24), transparent 58%),
    radial-gradient(840px 300px at 112% 130%, rgba(204, 250, 228, 0.28), transparent 62%),
    linear-gradient(138deg, #0f3b31 0%, #256354 46%, #79b7a1 100%);
  color: #fcfffd;
  border-radius: var(--radius-xl);
  padding: 2.1rem 1.35rem 2rem;
  box-shadow: 0 28px 52px rgba(7, 29, 23, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  opacity: 0.86;
}

h1,
h2,
h3 {
  font-family: "Fraunces", serif;
  margin: 0;
}

.hero h1 {
  margin-top: 0.62rem;
  margin-bottom: 0.8rem;
  font-size: clamp(1.95rem, 5.4vw, 3rem);
  line-height: 1.05;
  text-shadow: 0 6px 20px rgba(6, 20, 16, 0.33);
}

.subtitle {
  margin: 0.8rem 0 1.4rem;
  max-width: 640px;
  font-size: 1rem;
  line-height: 1.55;
  opacity: 0.95;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.58rem;
  padding: 0.34rem;
  border-radius: 999px;
  background: rgba(246, 255, 251, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.34);
  width: fit-content;
  backdrop-filter: blur(8px) saturate(120%);
}

.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.64);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(11, 26, 22, 0.08);
}

.controls-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 42, 35, 0.12);
  box-shadow: 0 14px 30px rgba(11, 26, 22, 0.12);
  padding: 1.15rem;
}

.controls-grid {
  display: grid;
  gap: 0.75rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  border: 0;
  margin: 0;
  padding: 0;
}

.field span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.field-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.hint-dot {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(15, 42, 35, 0.2);
  background: #f1f6f3;
  color: #2f5145;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  padding: 0;
}

.hint-dot::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  min-width: 210px;
  max-width: min(300px, 75vw);
  padding: 0.55rem 0.62rem;
  border-radius: 10px;
  background: #183b31;
  color: #f5faf7;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.34;
  text-align: left;
  box-shadow: 0 10px 22px rgba(8, 25, 20, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 30;
}

.hint-dot.is-open::after {
  opacity: 1;
}

.field-hint {
  color: #5f756c;
  font-size: 0.8rem;
  line-height: 1.3;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  padding: 0.72rem 0.82rem;
  background: #fff;
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(15, 58, 46, 0.26);
  border-color: transparent;
}

.time-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  gap: 0.55rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.toggle span {
  white-space: normal;
  line-height: 1.2;
}

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.68rem 1.24rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #ffd3a1, #f6a867);
  color: #2f170d;
  box-shadow: 0 12px 24px rgba(218, 132, 84, 0.35);
}

.btn-secondary {
  background: rgba(246, 255, 251, 0.18);
  color: #f6fffb;
  border: 1px solid rgba(255, 255, 255, 0.36);
}

.btn-secondary:hover {
  background: rgba(246, 255, 251, 0.26);
  border-color: rgba(255, 255, 255, 0.5);
}

.admin-link {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #f6fffb;
  background: rgba(246, 255, 251, 0.14);
  border-radius: 999px;
  padding: 0.36rem 0.8rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px) saturate(120%);
}

.admin-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.auth-state {
  margin: 0.68rem 0 0;
  font-size: 0.84rem;
  opacity: 0.9;
  min-height: 1em;
  color: rgba(243, 250, 247, 0.92);
}

.auth-state:empty {
  display: none;
}

.hero-inner *::marker {
  content: "";
}

.hero-inner p:empty {
  display: none !important;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.section-title {
  font-size: clamp(1.45rem, 4.2vw, 2rem);
}

.count-pill {
  background: #ffe8cc;
  color: #774224;
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.recipe-grid {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.8rem;
}

.recipe-card {
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #f1ece2;
  box-shadow: 0 6px 20px rgba(32, 48, 41, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recipe-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(24, 43, 36, 0.12);
}

.recipe-card.is-selected {
  border-color: rgba(18, 82, 62, 0.62);
  box-shadow: 0 0 0 3px rgba(18, 82, 62, 0.28), 0 18px 30px rgba(24, 43, 36, 0.2);
  transform: translateY(-3px);
}

.recipe-card.is-dimmed {
  opacity: 0.62;
  filter: saturate(0.72);
}

.recipe-card.is-dimmed:hover {
  opacity: 0.84;
}

.card-media-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}

.card-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.favorite-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.favorite-btn.is-on {
  color: #be4d2c;
}

.card-content {
  padding: 0.86rem;
}

.card-category {
  margin: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7f8f89;
  font-weight: 700;
}

.card-title {
  margin: 0.34rem 0;
  font-size: 1.12rem;
}

.card-meta {
  margin: 0;
  color: #50645c;
  font-size: 0.9rem;
}

.details-panel.empty {
  text-align: center;
  color: #5f756c;
}

.detail-cover {
  width: 100%;
  border-radius: 14px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.detail-header {
  margin-top: 0.8rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: start;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.45rem;
}

.btn-secondary-soft {
  background: #edf3ef;
  color: #2d4a3f;
  border: 1px solid #d6e2dc;
  padding: 0.55rem 0.95rem;
}

.btn-danger-soft {
  background: #ffe9e4;
  color: #8a2f22;
  border: 1px solid #f5cac0;
  padding: 0.55rem 0.95rem;
}

.detail-meta {
  margin: 0.45rem 0 0;
  display: grid;
  gap: 0.18rem;
  color: #567067;
  font-size: 0.92rem;
}

.detail-summary {
  margin: 0.42rem 0 0.2rem;
  color: #38574d;
  font-size: 0.98rem;
  line-height: 1.45;
}

.detail-meta-line {
  line-height: 1.35;
}

.detail-meta-total {
  font-weight: 800;
  color: #1b3a31;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7a4a29;
  background: #ffe6c6;
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
}

.servings {
  margin: 1rem 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.servings button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.ingredients,
.steps {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
}

.ingredients li,
.steps li {
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.ingredients li.ingredient-section {
  list-style: none;
  margin: 0.9rem 0 0.35rem -1rem;
  padding: 0.15rem 0;
  font-weight: 800;
  font-family: "Fraunces", serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1f4337;
  border-top: 1px solid rgba(15, 42, 35, 0.14);
}

.step-images {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.48rem;
}

.step-images img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(15, 42, 35, 0.12);
  object-fit: contain;
  background: #f3f5f4;
  max-height: 460px;
  cursor: zoom-in;
}

body.has-lightbox {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(9, 18, 15, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.image-lightbox[hidden] {
  display: none !important;
}

.image-lightbox img {
  max-width: min(1300px, 96vw);
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
  background: #0f1815;
}

.image-lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(14, 23, 19, 0.8);
  color: #f8fdfb;
  font-size: 1rem;
  cursor: pointer;
}

.modal {
  border: 0;
  border-radius: 18px;
  width: min(760px, calc(100% - 1rem));
  padding: 0;
  box-shadow: 0 24px 60px rgba(11, 26, 22, 0.28);
}

.modal::backdrop {
  background: rgba(12, 24, 20, 0.44);
  backdrop-filter: blur(2px);
}

.modal-content {
  padding: 1rem;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}

.icon-btn {
  border: 0;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
}

.form-grid {
  display: grid;
  gap: 0.7rem;
}

.full {
  margin-top: 0.7rem;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.8rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
}

.check-grid input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.modal-actions {
  margin-top: 0.9rem;
  display: flex;
  justify-content: end;
}

.help-text {
  margin: 0 0 0.7rem;
  color: #557067;
}

.formula-help {
  margin-top: -0.1rem;
  padding: 0.55rem 0.7rem;
  border: 1px dashed rgba(15, 58, 46, 0.2);
  border-radius: 10px;
  background: rgba(237, 245, 241, 0.65);
}

.step-media-block .help-text {
  margin-bottom: 0.45rem;
}

.step-media-manager {
  display: grid;
  gap: 0.55rem;
}

.step-media-empty {
  margin: 0;
  font-size: 0.88rem;
  color: #5d756b;
}

.step-media-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.6rem;
  display: grid;
  gap: 0.5rem;
}

.step-media-step {
  margin: 0;
  font-size: 0.88rem;
  color: #3d5a50;
}

.step-media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.step-media-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #d3e0d9;
  background: #eff6f2;
  color: #2f5145;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.36rem 0.78rem;
  cursor: pointer;
}

.step-media-actions input[type="file"] {
  display: none;
}

.step-media-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.45rem;
}

.step-media-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(15, 42, 35, 0.12);
  background: #fff;
}

.step-media-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.step-media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(30, 24, 24, 0.78);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}

.import-status {
  min-height: 1.2em;
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: #516860;
}

.recipe-page {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--bg);
  padding: 0.8rem 0.8rem 1.3rem;
  overflow: auto;
}

.recipe-page-head {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-bottom: 0.6rem;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
}

.recipe-page-content {
  margin-top: 0.2rem;
}

body.is-recipe-page {
  overflow: hidden;
}

@media (min-width: 720px) {
  .hero {
    padding-top: 3rem;
  }

  .hero-inner {
    padding: 2.3rem;
  }

  .controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout {
    gap: 1.2rem;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 979px) {
  .details-panel {
    display: none;
  }
}

@media (min-width: 980px) {
  .controls-grid {
    grid-template-columns: minmax(220px, 1.35fr) repeat(4, minmax(140px, 1fr));
    gap: 0.9rem 1rem;
  }

  .layout {
    max-width: 1480px;
    grid-template-columns: minmax(0, 1.45fr) minmax(420px, 1fr);
    align-items: start;
  }

  .controls-panel,
  .layout > section:nth-child(2) {
    grid-column: 1;
  }

  .details-panel {
    position: sticky;
    top: 1rem;
    grid-column: 2;
    grid-row: 1 / span 2;
    border: 2px solid rgba(18, 82, 62, 0.16);
    box-shadow: 0 16px 34px rgba(11, 26, 22, 0.16);
  }

  .recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipe-page {
    display: none;
  }
}
