/* v2 frontend starts by reusing v1 styling verbatim */
@import url("/static/styles.v1.css");

.verify-hint {
  margin-top: 0.35rem;
  max-width: 100%;
}

.verify-feedback.verify-feedback--success {
  margin-top: 0.5rem;
  color: #4a5d3a;
  font-weight: 600;
  font-style: normal;
}

.verify-feedback.verify-feedback--error {
  margin-top: 0.5rem;
  color: #8b1e1e;
  font-weight: 600;
  font-style: normal;
}

/* ——— Left navigation ——— */
:root {
  --nav-w: 220px;
}

.site-shell {
  min-height: 100dvh;
}

.content-shell {
  padding-left: var(--nav-w);
}

.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-w);
  height: 100dvh;
  z-index: 60;
  padding: 1rem 0.75rem;
  background: rgba(250, 246, 240, 0.98);
  border-right: 1px solid rgba(139, 58, 47, 0.18);
  box-shadow: 8px 0 32px rgba(61, 47, 38, 0.08);
  overflow-y: auto;
  transform: translateX(0);
  transition: transform 0.22s ease;
}

.side-nav--closed {
  transform: translateX(-102%);
}

.nav-closed .content-shell {
  padding-left: 0;
}

.side-nav__brand {
  display: block;
  margin: 0.25rem 0 0.75rem;
}

.side-nav__brand img {
  display: block;
  width: 100%;
  height: auto;
}

.nav-collapsed-brand {
  display: none;
  position: fixed;
  top: 0.72rem;
  left: 4.95rem;
  z-index: 64;
  width: 186px;
  background: rgba(250, 246, 240, 0.96);
  border: 1px solid rgba(139, 58, 47, 0.18);
  border-radius: 12px;
  padding: 0.48rem 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(61, 47, 38, 0.08);
}

.nav-collapsed-brand img {
  display: block;
  width: 122%;
  max-width: none;
  height: auto;
  margin-left: -6px;
}

.nav-closed .nav-collapsed-brand {
  display: block;
}

.nav-open .nav-collapsed-brand {
  display: none;
}

.side-nav__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.side-nav__link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  width: 100%;
  min-height: 46px;
  padding: 0.62rem 0.78rem;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(139, 58, 47, 0.18);
  background: rgba(255, 255, 255, 0.35);
  color: #3d2f26;
  text-decoration: none;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  font: 700 1.08rem/1.2 "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}

.side-nav__link[hidden] {
  display: none !important;
}

.side-nav__link:hover {
  background: rgba(250, 246, 240, 1);
}

/* Ensure `hidden` always wins over layout classes */
.access-controls[hidden],
.header-popover[hidden] {
  display: none !important;
}

.side-nav__link[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.nav-toggle {
  display: inline-flex;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 65;
  border-radius: 12px;
  border: 1px solid rgba(139, 58, 47, 0.25);
  background: rgba(250, 246, 240, 0.98);
  padding: 0.5rem 0.65rem;
  font-weight: 800;
  color: #3d2f26;
}

.nav-open .nav-toggle {
  /* Keep it visible so user can collapse again; park it inside the open nav. */
  left: calc(var(--nav-w) - 3.25rem);
}

@media (max-width: 860px) {
  .nav-open .nav-toggle {
    /* On mobile, put the close button on the right edge of the sidebar. */
    left: calc(min(86vw, 320px) - 3.25rem);
  }
  .nav-collapsed-brand {
    /* Mobile: hide the collapsed logo badge to avoid covering content.
       The logo remains visible inside the opened menu. */
    display: none !important;
  }
}

@media (max-width: 860px) {
  :root { --nav-w: 0px; }
  .content-shell { padding-left: 0; }
  .side-nav {
    width: min(86vw, 320px);
  }
}

/* ——— Support modal ——— */
.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(23, 18, 14, 0.45);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-scrim[hidden] {
  display: none !important;
}

.modal-card {
  width: min(680px, 100%);
  background: rgba(250, 246, 240, 0.98);
  border: 1px solid rgba(139, 58, 47, 0.22);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
  padding: 1rem;
}

.modal-card input,
.modal-card textarea {
  width: 100%;
}

/* ——— Password reveal toggle ——— */
.pw-field {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.pw-field input {
  flex: 1;
}

.pw-toggle {
  min-width: 5.25rem;
  white-space: nowrap;
}

/* ——— Account panel cleanup ——— */
#account-panel .access-controls {
  display: grid;
  gap: 0.5rem;
}

#account-panel .access-controls input,
#account-panel .access-controls select,
#account-panel .access-controls button {
  width: 100%;
  min-height: 42px;
}

#account-panel .pw-field {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

#account-panel .pw-toggle {
  min-width: 5.25rem;
}

#account-panel #verify-status,
#account-panel #login-status,
#account-panel #forgot-status {
  margin-top: 0.35rem;
  min-height: 1.2em;
}

/* ——— Admin page ——— */
.admin-wrap {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.admin-main {
  padding: 0 0 3rem;
  display: grid;
  gap: 1rem;
}

.admin-card {
  background: rgba(250, 246, 240, 0.92);
  border: 1px solid rgba(74, 93, 58, 0.22);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 12px 28px rgba(61, 47, 38, 0.08);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
  margin-top: 0.75rem;
}

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

.admin-user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-recipe-list {
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(74, 93, 58, 0.22);
  border-radius: 12px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.4);
}

.admin-recipe-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(139, 58, 47, 0.22);
  background: rgba(250, 246, 240, 0.98);
  color: #3d2f26;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  margin: 0.35rem 0;
  cursor: pointer;
}

.admin-recipe-item:hover {
  background: rgba(250, 246, 240, 1);
}

.admin-markdown {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(139, 58, 47, 0.25);
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.65);
}

.admin-preview-wrap {
  border: 1px solid rgba(74, 93, 58, 0.22);
  border-radius: 12px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.4);
  min-height: 420px;
}

/* Recipe detail — inline editor (admin / contributor) */
.recipe-editor {
  width: 100%;
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1.15rem;
  box-sizing: border-box;
}

.recipe-editor .recipe-page-header {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
}

.recipe-editor > .access-controls {
  justify-content: center;
}

.recipe-edit-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.recipe-edit-form .recipe-section__label {
  margin-top: 0.5rem;
}

.recipe-edit-form .recipe-section__label:first-child {
  margin-top: 0;
}

.recipe-edit-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(139, 58, 47, 0.25);
  padding: 0.55rem 0.65rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.75);
  color: #3d2f26;
}

.recipe-edit-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(139, 58, 47, 0.25);
  padding: 0.65rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  resize: vertical;
  background: rgba(255, 255,  255, 0.75);
  color: #3d2f26;
}

.recipe-edit-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  font-weight: 600;
  color: #3d2f26;
  cursor: pointer;
}

.recipe-edit-check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--terracotta, #8b3a2f);
}

/* Recipe detail — alphabetical prev / next */
.recipe-alpha-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0.35rem 1.15rem 0.65rem;
  box-sizing: border-box;
}

.recipe-alpha-nav__position {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(61, 47, 38, 0.55);
  white-space: nowrap;
  flex: 1;
  text-align: center;
}

.recipe-nav-arrow {
  flex-shrink: 0;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(139, 58, 47, 0.28);
  background: rgba(250, 246, 240, 0.95);
  color: var(--terracotta, #8b3a2f);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.recipe-nav-arrow:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(139, 58, 47, 0.45);
}

.recipe-nav-arrow:focus-visible {
  outline: 2px solid var(--terracotta, #8b3a2f);
  outline-offset: 2px;
}

.recipe-nav-arrow:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

