/* ==========================================================================
   Form design system
   Components: resources/views/components/form/*  -  behaviour: public/js/forms.js
   Tokens (--brand-*, --ink, --muted, --shadow-*) come from app.css.
   ========================================================================== */

:root {
  --ff-border: #dbe5e1;
  --ff-border-hover: #bccfc8;
  --ff-bg: #fbfdfc;
  --ff-radius: .8rem;
  --ff-ring: 0 0 0 .22rem rgba(15, 110, 79, .14);
  --ff-danger: #d6293e;
}

/* ---------- Page chrome ---------- */
.fs-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .9rem;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s ease, transform .15s ease;
}

.fs-back:hover { color: var(--brand-green); transform: translateX(-2px); }

.fs-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.15rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 110, 79, .06), 0 14px 34px -22px rgba(15, 60, 45, .28);
}

.fs-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-gold));
}

.fs-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.7rem 2rem 1.4rem;
  border-bottom: 1px solid #edf2f0;
  background: linear-gradient(180deg, #fafdfc 0%, #fff 100%);
}

.fs-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: .95rem;
  background: linear-gradient(135deg, var(--brand-green), var(--brand-green-dark));
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 10px 18px -10px rgba(15, 110, 79, .75);
}

.fs-title { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.fs-subtitle { margin: .15rem 0 0; font-size: .9rem; color: var(--muted); }

.fs-body { padding: 1.9rem 2rem 2rem; }

/* ---------- Sections ---------- */
.fs-section + .fs-section {
  margin-top: 2rem;
  padding-top: 1.8rem;
  border-top: 1px solid #edf2f0;
}

.fs-section-head {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.fs-section-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: .6rem;
  background: var(--brand-green-light);
  color: var(--brand-green);
  font-size: 1rem;
}

.fs-section-title {
  margin: 0;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--brand-green-dark);
}

.fs-section-desc { margin: .1rem 0 0; font-size: .85rem; color: var(--muted); }

/* ---------- Sticky action bar ---------- */
.fs-foot {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: 1rem 2rem;
  border-top: 1px solid #edf2f0;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.fs-state {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .84rem;
  color: var(--muted);
}

.fs-state .dot { width: .55rem; height: .55rem; border-radius: 50%; background: #b7c7c2; transition: background-color .2s ease; }
.fs-card.is-dirty .fs-state .dot { background: #e0a21b; box-shadow: 0 0 0 .25rem rgba(224, 162, 27, .18); }
.fs-card.is-dirty .fs-state-text::before { content: "Perubahan belum disimpan"; }
.fs-card:not(.is-dirty) .fs-state-text::before { content: "Semua tersimpan"; }

.fs-actions { display: flex; align-items: center; gap: .6rem; margin-left: auto; }

.fs-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.8rem;
  padding: 0 1.4rem;
  border-radius: .8rem;
  font-weight: 700;
}

.fs-actions .btn-brand { box-shadow: 0 10px 20px -12px rgba(15, 110, 79, .9); }
.fs-actions .btn-brand:hover { transform: translateY(-1px); }
.fs-actions .btn-ghost { border: 1.5px solid var(--ff-border); background: #fff; color: var(--ink); }
.fs-actions .btn-ghost:hover { border-color: var(--brand-green); color: var(--brand-green); background: var(--brand-green-light); }

.fs-hint { margin-right: .4rem; color: var(--muted); font-size: .8rem; white-space: nowrap; }

.fs-hint kbd {
  padding: .1rem .45rem;
  border: 1px solid var(--ff-border);
  border-bottom-width: 2px;
  border-radius: .35rem;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: .72rem;
  font-weight: 700;
}

/* ---------- Field ---------- */
.ff { margin-bottom: 1.3rem; }
.ff:last-child { margin-bottom: 0; }

.ff-labelrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .45rem;
}

.ff-label {
  margin: 0;
  font-size: .88rem;
  font-weight: 700;
  color: var(--ink);
}

.ff-label .req { color: var(--ff-danger); margin-left: .15rem; }

.ff-tag {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
}

.ff-hint {
  margin-top: .4rem;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--muted);
}

.ff-hint i { color: var(--brand-green); margin-right: .25rem; }

/* The bordered shell around icon + control + suffix, so focus rings the whole thing. */
.ff-group {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--ff-border);
  border-radius: var(--ff-radius);
  background: var(--ff-bg);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.ff-group:hover { border-color: var(--ff-border-hover); }

.ff-group:focus-within {
  border-color: var(--brand-green);
  background: #fff;
  box-shadow: var(--ff-ring);
}

.ff-group.is-invalid {
  border-color: var(--ff-danger);
  box-shadow: 0 0 0 .22rem rgba(214, 41, 62, .12);
}

.ff-group .form-control,
.ff-group .form-select {
  flex: 1;
  min-width: 0;
  height: 2.8rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--ff-radius);
  background-color: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: .95rem;
}

.ff-group .form-select { padding-right: 2.4rem; cursor: pointer; }
.ff-group textarea.form-control { height: auto; min-height: 6.2rem; padding: .75rem 1rem; resize: vertical; line-height: 1.55; }
.ff-group .form-control::placeholder { color: #9aaba5; }

.ff-group .form-control:focus,
.ff-group .form-select:focus { box-shadow: none; background: transparent; }

.ff-addon {
  display: flex;
  align-items: center;
  padding: 0 .95rem;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
}

.ff-addon.is-before { padding-right: 0; }
.ff-addon.is-after { padding-left: 0; font-size: .88rem; }
.ff-group:focus-within .ff-addon i { color: var(--brand-green); }

.ff .invalid-feedback { margin-top: .4rem; font-size: .8rem; font-weight: 600; }

.ff-count { font-size: .75rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.ff-count.is-near { color: #b45309; }
.ff-count.is-full { color: var(--ff-danger); }

/* Quick-pick chips under a field */
.ff-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }

.ff-chip {
  padding: .25rem .7rem;
  border: 1px solid var(--ff-border);
  border-radius: 2rem;
  background: #fff;
  color: var(--brand-green-dark);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.ff-chip:hover { border-color: var(--brand-green); background: var(--brand-green-light); }

/* ---------- Switch row ---------- */
.ff-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .95rem 1.1rem;
  border: 1.5px solid var(--ff-border);
  border-radius: var(--ff-radius);
  background: var(--ff-bg);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.ff-switch:hover { border-color: var(--ff-border-hover); }
.ff-switch.is-on { border-color: rgba(15, 110, 79, .45); background: var(--brand-green-light); }
.ff-switch-title { font-size: .92rem; font-weight: 700; color: var(--ink); }
.ff-switch-desc { margin-top: .1rem; font-size: .8rem; color: var(--muted); }
.ff-switch .form-check-input { flex-shrink: 0; width: 2.6rem; height: 1.4rem; margin: 0; cursor: pointer; }
.ff-switch .form-check-input:checked { background-color: var(--brand-green); border-color: var(--brand-green); }
.ff-switch .form-check-input:focus { box-shadow: var(--ff-ring); border-color: var(--brand-green); }

/* ---------- Choice cards (radio) ---------- */
.ff-choices { display: grid; gap: .7rem; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }

.ff-choice input { position: absolute; opacity: 0; pointer-events: none; }

.ff-choice label {
  display: flex;
  align-items: center;
  gap: .8rem;
  height: 100%;
  padding: .85rem 1rem;
  border: 1.5px solid var(--ff-border);
  border-radius: var(--ff-radius);
  background: var(--ff-bg);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.ff-choice label:hover { border-color: var(--ff-border-hover); }

.ff-choice-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: .7rem;
  background: #eef3f1;
  color: var(--muted);
  font-size: 1.15rem;
  transition: background-color .15s ease, color .15s ease;
}

.ff-choice-title { font-size: .92rem; font-weight: 700; color: var(--ink); }
.ff-choice-desc { font-size: .78rem; color: var(--muted); }

.ff-choice input:focus-visible + label { box-shadow: var(--ff-ring); }

.ff-choice input:checked + label { border-color: var(--tone, var(--brand-green)); background: var(--tone-bg, var(--brand-green-light)); }
.ff-choice input:checked + label .ff-choice-icon { background: var(--tone, var(--brand-green)); color: #fff; }

.ff-choice.tone-in { --tone: #198754; --tone-bg: #eef8f2; }
.ff-choice.tone-out { --tone: #d6293e; --tone-bg: #fdf0f2; }

/* ---------- Star rating ---------- */
.ff-rating { display: inline-flex; flex-direction: row-reverse; gap: .25rem; }
.ff-rating input { position: absolute; opacity: 0; pointer-events: none; }

.ff-rating label {
  font-size: 2rem;
  line-height: 1;
  color: #d5dfdb;
  cursor: pointer;
  transition: color .12s ease, transform .12s ease;
}

.ff-rating label:hover,
.ff-rating label:hover ~ label,
.ff-rating input:checked ~ label { color: #f2b01e; }

.ff-rating label:hover { transform: scale(1.12); }
.ff-rating input:focus-visible + label { outline: 2px solid var(--brand-green); outline-offset: 2px; border-radius: .3rem; }

.ff-rating-text { margin-left: .8rem; font-size: .85rem; font-weight: 600; color: var(--muted); align-self: center; }

/* ---------- Live preview ---------- */
.fs-aside { position: sticky; top: 5.5rem; }

.pv-card {
  overflow: hidden;
  border-radius: 1.15rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 110, 79, .06), 0 14px 34px -22px rgba(15, 60, 45, .28);
}

.pv-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1.2rem;
  border-bottom: 1px solid #edf2f0;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--brand-green-dark);
}

.pv-head .live { margin-left: auto; display: inline-flex; align-items: center; gap: .35rem; font-size: .68rem; color: #198754; }
.pv-head .live::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: #22c55e; animation: pv-pulse 1.6s ease infinite; }

@keyframes pv-pulse { 50% { opacity: .35; } }

.pv-body { padding: 1.2rem; }
.pv-note { padding: 0 1.2rem 1.2rem; font-size: .8rem; color: var(--muted); }

/* A miniature of the signage board's dark panel */
.pv-board {
  padding: 1.1rem;
  border-radius: .95rem;
  background: radial-gradient(circle at 90% 0%, rgba(227, 179, 81, .2) 0, transparent 50%), linear-gradient(160deg, #0b4a37, #06261d);
  color: #f3f7f5;
}

.pv-item { display: flex; gap: .8rem; }

.pv-item-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
  background: rgba(227, 179, 81, .18);
  color: #e3b351;
  font-size: 1.2rem;
}

.pv-k { font-size: .8rem; color: rgba(243, 247, 245, .65); }
.pv-v { font-size: 1.1rem; font-weight: 700; line-height: 1.3; word-break: break-word; }
.pv-sub { margin-top: .3rem; font-size: .85rem; color: rgba(243, 247, 245, .75); word-break: break-word; }
.pv-empty { opacity: .45; font-style: italic; font-weight: 500; }

.pv-ticker { display: flex; align-items: stretch; overflow: hidden; border-radius: .7rem; background: rgba(0, 0, 0, .35); }
.pv-ticker-label { display: flex; align-items: center; padding: .55rem .9rem; background: linear-gradient(150deg, #e0ae48, #b07d1c); color: #1d1403; font-size: .72rem; font-weight: 800; letter-spacing: .1em; }
.pv-ticker-text { padding: .55rem .9rem; font-size: .9rem; font-weight: 600; word-break: break-word; }

.pv-badge { display: inline-block; padding: .15rem .6rem; border-radius: 2rem; font-size: .72rem; font-weight: 700; }
.pv-badge.on { background: rgba(34, 197, 94, .18); color: #4ade80; }
.pv-badge.off { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .6); }

.pv-money { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pv-money.is-in { color: #4ade80; }
.pv-money.is-out { color: #f87171; }

/* ---------- File drop inside the system ---------- */
.ff .file-drop-zone { border-radius: var(--ff-radius); }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .fs-head { padding: 1.3rem 1.25rem 1.1rem; }
  .fs-body { padding: 1.4rem 1.25rem 1.5rem; }
  .fs-foot { padding: .9rem 1.25rem; }
  .fs-state { width: 100%; }
  .fs-actions { width: 100%; }
  .fs-actions .btn { flex: 1; }
  .fs-actions .btn-ghost { flex: 0 0 auto; }
  .ff-choices { grid-template-columns: 1fr; }
  .fs-aside { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  .fs-back, .ff-group, .ff-chip, .ff-choice label, .ff-rating label { transition: none; }
  .pv-head .live::before { animation: none; }
}

/* Bootstrap draws its own "!" icon inside invalid inputs; the red border already says it. */
.ff-group .form-control.is-invalid {
  background-image: none;
  padding-right: 1rem;
}

/* A row of fields: the gutter spaces them when they stack on a phone. */
.ff-row { margin-bottom: 1.3rem; }
.ff-row:last-child { margin-bottom: 0; }
.ff-row > [class*="col"] > .ff { margin-bottom: 0; }

/* Bootstrap input-groups (e.g. the password field with its eye button) get the same look as .ff-group. */
.ff .input-group {
  flex-wrap: nowrap;
  border: 1.5px solid var(--ff-border);
  border-radius: var(--ff-radius);
  background: var(--ff-bg);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.ff .input-group:hover { border-color: var(--ff-border-hover); }
.ff .input-group:focus-within { border-color: var(--brand-green); background: #fff; box-shadow: var(--ff-ring); }
.ff .input-group.is-invalid { border-color: var(--ff-danger); box-shadow: 0 0 0 .22rem rgba(214, 41, 62, .12); }

.ff .input-group > .form-control {
  height: 2.8rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--ff-radius);
  background: transparent;
  box-shadow: none;
}

.ff .input-group > .form-control.is-invalid { background-image: none; }

.ff .input-group > .btn {
  border: 0;
  border-radius: var(--ff-radius);
  background: transparent;
  color: var(--muted);
}

.ff .input-group > .btn:hover,
.ff .input-group > .btn:focus { background: var(--brand-green-light); color: var(--brand-green); box-shadow: none; }

.pv-sub i { margin-right: .45rem; opacity: .75; }

/* Caps-lock warning, used by any field that contains a password input. */
.ff .caps-hint { display: none; margin-top: .4rem; font-size: .8rem; font-weight: 600; color: #b45309; }
.ff.caps-on .caps-hint { display: block; }

/* ==========================================================================
   Blog editor: Markdown editor skin, Google preview, SEO checklist, list helpers
   ========================================================================== */

/* EasyMDE sits inside the same bordered .ff-group as every other field. */
.ff-group .EasyMDEContainer { flex: 1; min-width: 0; }

.EasyMDEContainer .editor-toolbar {
  padding: .4rem .55rem;
  border: 0;
  border-bottom: 1px solid var(--ff-border);
  border-radius: var(--ff-radius) var(--ff-radius) 0 0;
  background: #f6faf8;
  opacity: 1;
}

.EasyMDEContainer .editor-toolbar::before,
.EasyMDEContainer .editor-toolbar::after { display: none; }

.EasyMDEContainer .editor-toolbar button {
  width: 2.05rem;
  height: 2.05rem;
  margin: 0 .05rem;
  border: 0;
  border-radius: .5rem;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 2.05rem;
  text-align: center;
}

.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active { background: var(--brand-green-light); color: var(--brand-green-dark); }
.EasyMDEContainer .editor-toolbar i.separator { margin: 0 .35rem; border-left: 1px solid #dbe5e1; border-right: 0; }

.EasyMDEContainer .CodeMirror {
  min-height: 24rem;
  padding: .5rem .25rem;
  border: 0;
  border-radius: 0 0 var(--ff-radius) var(--ff-radius);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink);
}

.EasyMDEContainer .CodeMirror-scroll { min-height: 24rem; }
.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected { background: rgba(15, 110, 79, .16); }

.EasyMDEContainer .editor-statusbar {
  padding: .45rem 1rem;
  border-top: 1px solid #eef3f1;
  color: var(--muted);
  font-size: .78rem;
}

.EasyMDEContainer .editor-preview,
.EasyMDEContainer .editor-preview-side { padding: 1.3rem 1.5rem; background: #fff; font-size: 1rem; line-height: 1.8; }
.EasyMDEContainer .editor-preview h2, .EasyMDEContainer .editor-preview-side h2 { font-size: 1.45rem; font-weight: 800; margin: 1.4rem 0 .7rem; }
.EasyMDEContainer .editor-preview h3, .EasyMDEContainer .editor-preview-side h3 { font-size: 1.2rem; font-weight: 800; margin: 1.2rem 0 .6rem; }

/* Google search result preview */
.serp { font-family: Arial, 'Segoe UI', sans-serif; }
.serp-site { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }

.serp-fav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--brand-green);
  color: #fff;
  font-size: .8rem;
  flex-shrink: 0;
}

.serp-name { font-size: .86rem; line-height: 1.2; color: #202124; }
.serp-url { font-size: .76rem; line-height: 1.3; color: #4d5156; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 17rem; }

.serp-title {
  margin-bottom: .2rem;
  overflow: hidden;
  color: #1a0dab;
  font-size: 1.2rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.serp-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #4d5156;
  font-size: .86rem;
  line-height: 1.55;
}

.serp .pv-empty { opacity: .55; font-style: normal; }

/* SEO checklist */
.seo-score { margin-left: auto; padding: .1rem .6rem; border-radius: 2rem; background: #eef3f1; color: var(--muted); font-size: .72rem; letter-spacing: 0; }
.seo-score.is-good { background: #e3f5ea; color: #146c43; }
.seo-score.is-mid { background: #fff3d6; color: #8a5a00; }

.seo-checks { list-style: none; margin: 0; padding: 0; }
.seo-checks li { display: flex; gap: .6rem; padding: .5rem 0; font-size: .85rem; color: var(--muted); }
.seo-checks li + li { border-top: 1px dashed #e3ebe8; }
.seo-checks li i { margin-top: .15rem; flex-shrink: 0; }
.seo-checks li.is-ok { color: #146c43; }
.seo-checks li em { display: block; font-style: normal; font-size: .76rem; opacity: .85; }

/* Article list */
.post-thumb { width: 3.6rem; height: 2.5rem; flex-shrink: 0; border-radius: .55rem; object-fit: cover; background: var(--brand-green-light); }
.post-thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--brand-green); font-size: 1.1rem; }

.filter-chips { display: flex; flex-wrap: wrap; gap: .45rem; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .95rem;
  border: 1.5px solid var(--ff-border);
  border-radius: 2rem;
  background: #fff;
  color: var(--ink);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.filter-chip:hover { border-color: var(--brand-green); }
.filter-chip .n { padding: .02rem .5rem; border-radius: 2rem; background: #eef3f1; color: var(--muted); font-size: .74rem; font-weight: 700; }
.filter-chip.is-active { border-color: var(--brand-green); background: var(--brand-green); color: #fff; }
.filter-chip.is-active .n { background: rgba(255, 255, 255, .22); color: #fff; }
