/* css/12-editor-restyle.css — Recipe editor full-screen redesign
 * Match mockup #6 from the original design canvas.
 * Targets the sheet that opens when user clicks an existing recipe
 * (title starts with "แก้ไขสูตร" / "แก้สูตร" / "เพิ่มสูตร").
 *
 * Activated when JS sets data-redesign="editor" on the .sheet element.
 */

/* ── Full-screen sheet ── */
.sheet[data-redesign="editor"] {
  max-height: 100vh !important;
  min-height: 100vh !important;
  border-radius: 0 !important;
  top: 0; bottom: 0;
  background: #F6F7F4;
}
.sheet-root.is-open .sheet[data-redesign="editor"] {
  transform: translate(-50%, 0) !important;
}

.sheet[data-redesign="editor"] .sheet-handle { display: none; }

.sheet[data-redesign="editor"] .sheet-head {
  background: #fff;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #EEF0EA;
  position: sticky; top: 0; z-index: 5;
}
.sheet[data-redesign="editor"] .sheet-head h3 {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.01em;
  color: #064E3B;
}
.sheet[data-redesign="editor"] .sheet-close {
  width: 32px; height: 32px;
  background: #F1F2EE;
  border: 0; border-radius: 50%;
  font-size: 22px; line-height: 1;
  color: #6B7280;
}

.sheet[data-redesign="editor"] .sheet-body {
  padding: 16px 14px 100px;
  background: #F6F7F4;
}

.sheet[data-redesign="editor"] .sheet-foot {
  background: #fff;
  padding: 12px 16px calc(12px + var(--safe-bottom, 0px));
  border-top: 1px solid #EEF0EA;
  box-shadow: 0 -8px 24px rgba(15,23,42,0.08);
}

/* ── Hero card (injected) ── */
.red-hero-card {
  display: flex; align-items: center; gap: 12px;
  background: #fff;
  border: 1px solid #EEF0EA;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}
.red-hero-photo {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 18px;
  background: #FEE2E2; color: #B91C1C;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800;
  flex-shrink: 0;
  background-size: cover; background-position: center;
}
.red-hero-photo-cam {
  position: absolute; bottom: -6px; right: -6px;
  width: 26px; height: 26px;
  background: #16A34A; color: #fff;
  border: 2px solid #fff; border-radius: 50%;
  font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(22,163,74,0.4);
  cursor: pointer;
}
.red-hero-body { flex: 1; min-width: 0; }
.red-hero-eyebrow {
  font-size: 10px; font-weight: 700;
  color: #16A34A; letter-spacing: 0.14em;
  margin-bottom: 2px;
}
.red-hero-name {
  font-size: 18px; font-weight: 800;
  color: #111827;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.red-hero-tags {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.red-hero-tag {
  font-size: 10.5px; font-weight: 600;
  padding: 3px 9px;
  background: #F1F2EE;
  border: 0; border-radius: 6px;
  color: #374151;
}
.red-hero-tag.is-primary { background: #DCFCE7; color: #14532D; }
.red-hero-tag.is-amber   { background: #FEF3C7; color: #92400E; }

/* ── Summary card (re-skin "สรุปสูตรแบบ real-time") ── */
.sheet[data-redesign="editor"] .form-section.summary-section,
.sheet[data-redesign="editor"] [class*="summary"] {
  display: none; /* hide legacy summary panel — we render our own */
}

.red-summary-card {
  background: linear-gradient(135deg, #064E3B 0%, #0F7A35 100%);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(6,95,70,0.2);
}
.red-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.red-summary-cell {
  padding: 0 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.red-summary-cell + .red-summary-cell {
  border-left: 1px solid rgba(255,255,255,0.16);
}
.red-summary-lbl {
  font-size: 9.5px;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.red-summary-val {
  font-family: "Inter", "IBM Plex Sans Thai", sans-serif;
  font-size: 18px; font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.red-summary-val span {
  font-size: 10px; font-weight: 600; opacity: 0.65;
  margin-left: 1px;
}
.red-summary-val.is-good { color: #6EE7B7; }

/* ── Generic section cards ── */
.sheet[data-redesign="editor"] .form-section {
  background: #fff;
  border: 1px solid #EEF0EA;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}
.sheet[data-redesign="editor"] .form-section h4 {
  font-size: 14px; font-weight: 700;
  margin: 0 0 10px;
  color: #111827;
  letter-spacing: -0.005em;
}
.sheet[data-redesign="editor"] .field-label {
  font-size: 11.5px; font-weight: 600;
  color: #6B7280;
  letter-spacing: 0;
  text-transform: none;
}
.sheet[data-redesign="editor"] .input,
.sheet[data-redesign="editor"] .select,
.sheet[data-redesign="editor"] .textarea {
  background: #FAFAF8;
  border: 1px solid #E7E9E3;
  border-radius: 10px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.sheet[data-redesign="editor"] .input:focus,
.sheet[data-redesign="editor"] .select:focus,
.sheet[data-redesign="editor"] .textarea:focus {
  background: #fff;
  border-color: #16A34A;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}

/* "ขนาด & การเสิร์ฟ" highlight card (unit_size_g block from P4) */
.red-unit-section {
  /* Already styled in 04-editor.css — boost contrast */
  background: linear-gradient(135deg, #FFFBEB 0%, #fff 100%) !important;
  border: 1.5px solid #FDE68A !important;
}

/* Footer save bar */
.sheet[data-redesign="editor"] .sheet-foot .btn {
  min-height: 48px;
  font-size: 15px;
  font-weight: 700;
}
.sheet[data-redesign="editor"] .sheet-foot .btn-primary {
  background: linear-gradient(135deg, #16A34A, #0F7A35);
  box-shadow: 0 4px 14px rgba(22,163,74,0.32);
}
