/* Recipe detail, editor, comments, modals and media blocks. */
.detail-hero,
.detail-card {
  padding: 14px 16px;
}

.detail-hero {
  display: grid;
  gap: 6px;
}

.detail-hero .eyebrow {
  margin-bottom: 0;
}

.detail-hero h1 {
  font-size: clamp(1.08rem, 1.55vw, 1.45rem);
  line-height: 1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-hero .chip-row {
  gap: 4px;
}

.detail-hero .chip {
  padding: 3px 8px;
  font-size: 0.74rem;
}

.detail-hero .detail-meta {
  gap: 6px;
  margin-top: 2px;
  font-size: 0.78rem;
}

.detail-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid rgba(24, 48, 45, 0.08);
}

.detail-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.detail-toolbar-group-end {
  justify-content: flex-end;
}

.detail-toolbar-group form {
  margin: 0;
}

.detail-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(24, 48, 45, 0.14);
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  box-shadow: none;
  font-weight: 700;
  font-size: 0.84rem;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.detail-action-button:hover {
  transform: translateY(-1px);
  background: white;
  border-color: rgba(220, 107, 66, 0.28);
  color: var(--accent);
}

.detail-action-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.detail-action-button svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.detail-action-button-danger {
  background: linear-gradient(135deg, var(--danger), #d46858);
  border-color: rgba(178, 76, 64, 0.4);
  color: white;
}

.detail-action-button-danger:hover {
  background: linear-gradient(135deg, #a94439, #cb5d4f);
  border-color: rgba(178, 76, 64, 0.48);
  color: white;
}

.recipe-edit-layout {
  gap: 14px;
}

.recipe-edit-form,
.recipe-edit-section,
.recipe-edit-grid label,
.recipe-edit-nutrition-grid label,
.recipe-edit-cover-controls,
.recipe-edit-section > label {
  display: grid;
  gap: 10px;
}

.recipe-edit-form {
  gap: 14px;
}

.recipe-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 14px;
}

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

.recipe-edit-span {
  grid-column: 1 / -1;
}

.recipe-edit-nutrition-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.recipe-edit-textarea-tall {
  min-height: 260px;
  resize: vertical;
}

.recipe-edit-cover {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.recipe-edit-cover-image,
.recipe-edit-cover-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  border: 1px solid rgba(24, 48, 45, 0.12);
  background: rgba(255, 255, 255, 0.7);
}

.recipe-edit-cover-image {
  display: block;
  object-fit: cover;
}

.recipe-edit-cover-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.recipe-edit-cover-area-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.recipe-edit-cover-area-actions button:disabled,
.recipe-edit-crop-modal-card button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.recipe-edit-crop-tool {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(24, 48, 45, 0.08);
}

.recipe-edit-crop-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-card.recipe-edit-crop-modal-card {
  width: min(1120px, 100%);
  max-height: min(900px, calc(100dvh - 48px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.recipe-edit-crop-modal-body {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.modal-card.recipe-edit-crop-modal-card .modal-actions {
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid rgba(24, 48, 45, 0.08);
  background: inherit;
}

.recipe-edit-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.recipe-edit-source-item {
  display: grid;
  gap: 8px;
  margin: 0;
}

.recipe-edit-crop-frame {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(24, 48, 45, 0.12);
  background: rgba(255, 255, 255, 0.7);
  cursor: crosshair;
  touch-action: none;
}

.recipe-edit-crop-frame img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.recipe-edit-crop-frame-active {
  border-color: rgba(220, 107, 66, 0.62);
}

.recipe-edit-crop-selection {
  position: absolute;
  border: 2px solid white;
  outline: 2px solid var(--accent);
  background: rgba(220, 107, 66, 0.16);
  box-shadow: 0 0 0 9999px rgba(24, 48, 45, 0.22);
  pointer-events: none;
}

.recipe-edit-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 2px;
}

.document-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 48, 45, 0.34);
  backdrop-filter: blur(6px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  background: #fffdf8;
  border-radius: 22px;
  border: 1px solid rgba(24, 48, 45, 0.1);
  box-shadow: 0 24px 80px rgba(24, 48, 45, 0.18);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.modal-card h3 {
  margin: 0;
  font-family: "Georgia", serif;
  font-size: 1.3rem;
}

.modal-copy {
  display: grid;
  gap: 8px;
}

.modal-copy p {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-actions form {
  margin: 0;
}

.back-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.list-block,
.step-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.list-block li {
  display: grid;
  gap: 4px;
}

.comment-form {
  margin-top: 14px;
}

.comment-form-actions {
  display: flex;
  justify-content: flex-start;
}

.comment-feedback,
.comment-summary {
  margin: 0;
  color: var(--muted);
}

.comment-feedback-success {
  color: #30451d;
}

.comment-feedback-error {
  color: #6f2c24;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.comment-item {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(24, 48, 45, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.comment-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.comment-item-top strong {
  font-size: 0.92rem;
}

.comment-item-top span,
.comment-empty {
  color: var(--muted);
}

.comment-item p {
  margin: 0;
  white-space: pre-wrap;
}

.comment-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.comment-pagination {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.comment-page-button {
  min-width: 40px;
  padding: 10px 12px;
  font-size: 1rem;
  line-height: 1;
}

.comment-page-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.comment-page-indicator {
  color: var(--muted);
  font-weight: 600;
}

.raw-text {
  white-space: pre-wrap;
  background: rgba(24, 48, 45, 0.05);
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
}

.detail-card-media {
  padding: 12px;
}

.detail-card-media .recipe-image-link {
  height: 100%;
}

.detail-grid-spacer {
  min-height: 1px;
}

.recipe-image-grid {
  display: grid;
  width: 100%;
  max-width: 900px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.recipe-image-link {
  display: block;
  width: 100%;
}

.recipe-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(24, 48, 45, 0.1);
  box-shadow: 0 12px 28px rgba(24, 48, 45, 0.12);
}

.chat-result-card {
  border-top: 1px solid rgba(24, 48, 45, 0.08);
  padding-top: 10px;
  margin-top: 10px;
}

.chat-result-card h3 {
  margin: 0;
}

.chat-search-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
}

.recipe-grid-loading {
  margin: 12px 0 0;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

.recipe-grid-loading-error {
  color: var(--danger);
}

.recipe-grid-sentinel {
  height: 1px;
}

.table-link {
  font-weight: 700;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}
