/* --- Navbar Styles --- */
.navbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 247, 242, 0.98));
  border-bottom: 1px solid rgba(47, 36, 29, 0.1);
  box-shadow: 0 10px 24px rgba(47, 36, 29, 0.08);
  position: sticky;
  top: 0;
  z-index: 300;
  margin: 0 calc(var(--page-pad) * -1) 1.25rem;
}
.navbar-content {
  max-width: 1420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem var(--page-pad);
  gap: 0.8rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--accent-2);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.navbar-logo {
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent-2);
}
.navbar-title {
  letter-spacing: 0.01em;
}
.navbar-auth {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
}
.navbar-auth input[type="email"],
.navbar-auth input[type="password"] {
  width: 8.8rem;
  padding: 0.46rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(47, 36, 29, 0.2);
  font: inherit;
  background: #fff;
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.navbar-auth input[type="email"]:focus,
.navbar-auth input[type="password"]:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-2), white 10%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 26%, white);
}
.navbar-auth .btn {
  border-radius: 10px;
  padding: 0.46rem 0.68rem;
  font-size: 0.92rem;
  line-height: 1;
  min-height: 2.2rem;
  min-width: 4.9rem;
  white-space: nowrap;
  box-shadow: none;
  transition: transform 0.15s, filter 0.2s;
}
.navbar-auth #signInBtn {
  background: color-mix(in srgb, var(--accent-2) 92%, #000 8%);
  color: #fff;
}
.navbar-auth #signUpBtn,
.navbar-auth #signOutBtn {
  background: #f7f1e6;
  color: var(--text);
  border: 1px solid rgba(47, 36, 29, 0.18);
}
.navbar-auth .btn:hover,
.navbar-auth .btn:focus-visible {
  transform: translateY(-1px);
  filter: brightness(0.98);
}
.navbar-auth #signInBtn:hover,
.navbar-auth #signInBtn:focus-visible {
  filter: brightness(0.94);
}
.navbar-status {
  margin-right: 0.25rem;
  max-width: 14.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 900px) {
  .navbar-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 0.7rem var(--page-pad);
  }
  .navbar-auth {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.4rem;
  }
  .navbar-brand {
    font-size: 1.1rem;
  }
  .navbar-status {
    max-width: none;
    width: 100%;
    margin-right: 0;
  }
  .navbar-auth input[type="email"],
  .navbar-auth input[type="password"] {
    width: min(100%, 14rem);
  }
}
:root {
  --page-pad: clamp(1rem, 3vw, 2.4rem);
  --bg: #f8efe3;
  --bg-soft: #fff9f0;
  --panel: #fffdf8;
  --text: #2f241d;
  --text-muted: #725e4f;
  --accent: #c84327;
  --accent-2: #2f7f6d;
  --chip: #f4e5cf;
  --danger: #9f2d2d;
  --shadow: 0 12px 26px rgba(47, 36, 29, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 20%, #fff8df 0, transparent 35%),
    radial-gradient(circle at 90% 0%, #f7dfcd 0, transparent 28%), var(--bg);
  line-height: 1.45;
  padding: 0 var(--page-pad) 3rem;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.45;
  pointer-events: none;
}

.bg-orb-1 {
  width: 270px;
  height: 270px;
  background: #efb086;
  right: -60px;
  top: -20px;
}

.bg-orb-2 {
  width: 220px;
  height: 220px;
  background: #96d6c3;
  left: -90px;
  bottom: -70px;
}

.site-header {
  display: flex;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  margin: 0 auto 1.3rem;
  max-width: 1160px;
  animation: rise-in 520ms ease-out;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent-2);
  font-size: 0.8rem;
}

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

h1 {
  margin-top: 0.3rem;
  font-size: clamp(1.75rem, 5vw, 2.7rem);
}

.intro {
  margin: 0.6rem 0 0;
  color: var(--text-muted);
  max-width: 66ch;
}

.layout {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(270px, 300px) 1fr;
}

.auth-panel {
  max-width: 1160px;
  margin: 0 auto 1rem;
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 1.2fr 2fr;
  align-items: end;
}

.auth-copy p {
  margin-bottom: 0;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.auth-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.panel {
  background: color-mix(in srgb, var(--panel), white 22%);
  border: 1px solid rgba(47, 36, 29, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.filters-panel,
.recipes-panel,
.data-panel {
  padding: 1rem;
}

.filters-panel {
  align-self: start;
  position: sticky;
  top: 1rem;
}

.filters-panel h2,
.recipes-panel h2,
.data-panel h2 {
  margin-bottom: 0.9rem;
}

.filters-panel section {
  margin-bottom: 0.9rem;
}

.filters-panel h3 {
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
}

.search-wrap {
  margin-bottom: 0.8rem;
}

.search-wrap label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(47, 36, 29, 0.22);
  padding: 0.6rem 0.7rem;
  font: inherit;
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  outline-offset: 1px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(47, 36, 29, 0.15);
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  padding: 0.34rem 0.62rem;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

.chip.active {
  background: var(--accent-2);
  color: #fff;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 0.62rem 0.9rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--accent-2);
  color: #fff;
}

.btn-ghost {
  background: #f5efe4;
  color: var(--text);
  border: 1px solid rgba(47, 36, 29, 0.22);
}

.btn-danger {
  background: #fbe4e4;
  color: var(--danger);
  border: 1px solid rgba(159, 45, 45, 0.35);
}

.recipes-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

#resultCount {
  margin: 0;
  color: var(--text-muted);
  font-weight: 700;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.8rem;
  align-items: stretch;
}

.recipe-card {
  border: 1px solid rgba(47, 36, 29, 0.11);
  border-radius: 16px;
  background: #fff;
  padding: 0.8rem;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 0.8rem;
  animation: rise-in 380ms ease both;
}

.card-top h3 {
  margin-bottom: 0.25rem;
}

.added-by {
  margin: 0 0 0.25rem;
  color: var(--accent-2);
  font-weight: 800;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.added-by-name {
  line-height: 1.1;
}

.recipe-author-avatar {
  width: 1.3rem;
  height: 1.3rem;
  min-width: 1.3rem;
  font-size: 0.62rem;
}

.description {
  margin: 0;
  color: var(--text-muted);
}

.rating-block {
  display: grid;
  gap: 0.2rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(47, 36, 29, 0.09);
  border-radius: 12px;
  background: #fff9ef;
}

.rating-summary {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: #7a5a1f;
}

.rating-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rating-input {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.star-btn {
  border: 0;
  background: transparent;
  color: #d3c2a0;
  font-size: 1.05rem;
  padding: 0.08rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s, color 0.2s;
}

.star-btn.active {
  color: #f2b21d;
}

.star-btn:hover,
.star-btn:focus-visible {
  color: #e2a516;
  transform: translateY(-1px);
}

.star-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.52rem;
  line-height: 1;
  font-size: 0.76rem;
  font-weight: 700;
  background: #f2ebe0;
}

.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  align-items: center;
}

.recipe-actions .btn {
  padding: 0.5rem 0.72rem;
}

.recipe-actions .details-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  text-decoration: none;
}

.data-panel {
  max-width: 1160px;
  margin: 1rem auto 0;
}

.data-panel p {
  margin: 0.4rem 0;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.status {
  min-height: 1.1rem;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.dialog {
  border: 0;
  border-radius: 18px;
  width: min(860px, 94vw);
  max-height: 90vh;
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.3);
}

.dialog::backdrop {
  background: rgba(24, 14, 7, 0.48);
}

.dialog-shell {
  margin: 0;
}

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

.icon-btn {
  border: 0;
  background: #f0ece4;
  color: var(--text);
  border-radius: 10px;
  padding: 0.38rem 0.56rem;
  cursor: pointer;
  font-weight: 800;
}

.add-dialog form {
  padding: 1rem;
}

.add-dialog {
  width: min(940px, 96vw);
}

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

.form-grid > label,
.form-grid > fieldset {
  display: grid;
  gap: 0.35rem;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.chip-list label.chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

legend {
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.full {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.steps,
.ingredients {
  padding-left: 1rem;
}

.empty-state {
  border: 1px dashed rgba(47, 36, 29, 0.3);
  border-radius: 16px;
  padding: 1.2rem;
  text-align: center;
  color: var(--text-muted);
  background: #fffaf1;
}

@keyframes rise-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-form {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .filters-panel {
    position: static;
  }

  .site-header {
    align-items: start;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .recipe-modal-sections {
    grid-template-columns: 1fr;
  }
}
