/* ==========================================================================
   Bunga Florist — panel admin. CSS mandiri, tanpa build step.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=Lora:wght@400;500;600&display=swap');

:root {
  --a-bg: #f7f4f3;
  --a-surface: #ffffff;
  --a-sidebar: #2b2224;
  --a-sidebar-soft: #3a2e30;
  --a-text: #2b2224;
  --a-muted: #7b6e70;
  --a-line: #e7dedd;
  --a-accent: #b3283f;
  --a-accent-soft: #f7e1e6;
  --a-accent-dark: #7a1c2c;
  --a-green: #5f7a52;
  --a-green-soft: #e7ece1;
  --a-amber: #a4762a;
  --a-amber-soft: #fbf0dd;

  --a-radius: 8px;
  --a-radius-sm: 5px;
  --a-shadow: 0 1px 2px rgba(43, 34, 36, 0.06), 0 4px 16px rgba(43, 34, 36, 0.05);

  --a-heading: "Cormorant Garamond", Georgia, serif;
  --a-body: "Lora", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--a-bg);
  color: var(--a-text);
  font-family: var(--a-body);
  font-size: 14.5px;
  line-height: 1.6;
}

a { color: var(--a-accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--a-heading); font-weight: 600; line-height: 1.15; margin: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 2px; }

/* — kerangka — */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 246px;
  flex: none;
  background: var(--a-sidebar);
  color: #f4eeee;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: #fff;
  text-decoration: none;
}
.sidebar-brand b { font-family: var(--a-heading); font-weight: 600; font-size: 19px; display: block; text-transform: none; letter-spacing: 0; }
.sidebar-brand span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #b9a9ab; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group > h6 {
  font-family: var(--a-body);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9c8b8d;
  margin: 10px 8px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--a-radius-sm);
  color: #ddd2d3;
  text-decoration: none;
  font-size: 14px;
}
.nav-item:hover { background: var(--a-sidebar-soft); color: #fff; }
.nav-item.is-active { background: var(--a-accent); color: #fff; }
.nav-item svg { flex: none; opacity: 0.9; }
.nav-item .count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 8px;
}
.nav-item.is-active .count { background: rgba(0, 0, 0, 0.22); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 26px;
  background: var(--a-surface);
  border-bottom: 1px solid var(--a-line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .spacer { margin-left: auto; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--a-muted); }
.sidebar-toggle {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius-sm);
  cursor: pointer;
  color: var(--a-text);
}

.content { padding: 26px; max-width: 1220px; width: 100%; }

/* — kepala halaman — */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 30px; }
.page-head p { margin: 4px 0 0; color: var(--a-muted); font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* — kartu — */
.panel {
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  box-shadow: var(--a-shadow);
}
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--a-line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 20px; }
.panel-head .spacer { margin-left: auto; }
.panel-body { padding: 18px; }
.panel + .panel { margin-top: 20px; }

/* — statistik — */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  padding: 16px 18px;
  box-shadow: var(--a-shadow);
  text-decoration: none;
  color: inherit;
  display: block;
}
.stat:hover { border-color: var(--a-accent); }
.stat b { display: block; font-family: var(--a-heading); font-size: 34px; line-height: 1.1; color: var(--a-accent-dark); }
.stat span { display: block; font-size: 13px; color: var(--a-muted); }
.stat .label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--a-muted); margin-bottom: 4px; }

/* — tabel — */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--a-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--a-line);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--a-line); vertical-align: middle; }
.table tbody tr:hover { background: #faf7f7; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-actions { text-align: right; white-space: nowrap; }
.table .thumb {
  width: 52px; height: 52px; object-fit: cover;
  border-radius: var(--a-radius-sm); border: 1px solid var(--a-line);
}
.table .thumb-empty {
  width: 52px; height: 52px;
  border-radius: var(--a-radius-sm);
  border: 1px dashed var(--a-line);
  display: grid; place-items: center;
  color: var(--a-muted); font-size: 10px;
  background: var(--a-bg);
}
.row-title { font-weight: 600; color: var(--a-text); text-decoration: none; }
.row-title:hover { color: var(--a-accent); }
.row-sub { display: block; font-size: 12.5px; color: var(--a-muted); }

/* — tombol — */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--a-body);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  padding: 9px 15px;
  border-radius: var(--a-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--a-text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { flex: none; }
.btn-primary { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
.btn-primary:hover { background: var(--a-accent-dark); border-color: var(--a-accent-dark); color: #fff; }
.btn-outline { border-color: var(--a-line); background: var(--a-surface); }
.btn-outline:hover { border-color: var(--a-accent); color: var(--a-accent); }
.btn-ghost { color: var(--a-muted); }
.btn-ghost:hover { background: #f1eaea; color: var(--a-text); }
.btn-danger { color: var(--a-accent); border-color: transparent; }
.btn-danger:hover { background: var(--a-accent-soft); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* — lencana — */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-on { background: var(--a-green-soft); color: #33452c; }
.badge-off { background: #eee9e9; color: #6d6264; }
.badge-accent { background: var(--a-accent-soft); color: var(--a-accent-dark); }
.badge-warn { background: var(--a-amber-soft); color: #6d4c14; }

/* — formulir — */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

.field label.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #4a3f41;
}
.field .hint { display: block; font-size: 12px; color: var(--a-muted); margin-top: 5px; }
.field .error { display: block; font-size: 12px; color: var(--a-accent); margin-top: 5px; }

.input {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--a-text);
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius-sm);
}
.input:hover { border-color: #cfc3c2; }
.input:focus { outline: none; border-color: var(--a-accent); box-shadow: 0 0 0 3px var(--a-accent-soft); }
.input.is-invalid { border-color: var(--a-accent); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.6; }
textarea.input.tall { min-height: 340px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8a7c7e 50%), linear-gradient(135deg, #8a7c7e 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 40px; height: 22px; flex: none;
  background: #ded4d4; border-radius: 999px;
  position: relative; transition: background .15s ease;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s ease;
}
.switch input:checked + .track { background: var(--a-green); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--a-accent); outline-offset: 2px; }

.uploader { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.uploader-preview {
  width: 128px; height: 128px; flex: none;
  border-radius: var(--a-radius-sm);
  border: 1px solid var(--a-line);
  background: var(--a-bg);
  overflow: hidden;
  display: grid; place-items: center;
}
.uploader-preview img { width: 100%; height: 100%; object-fit: cover; }
.uploader-preview .empty { font-size: 11px; color: var(--a-muted); text-align: center; padding: 8px; }
.uploader-fields { flex: 1; min-width: 220px; }
input[type='file'].input { padding: 8px 10px; font-size: 13px; }

/* Galeri foto tambahan pada form produk. */
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.thumbs[hidden] { display: none; }
.thumb {
  margin: 0;
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius-sm);
  background: var(--a-bg);
  overflow: hidden;
}
.thumb img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.thumb-remove {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  border-top: 1px solid var(--a-line);
}
.thumb-remove input { margin: 0; accent-color: var(--a-accent); }
.thumb:has(.thumb-remove input:checked) { opacity: .45; }
.thumb:has(.thumb-remove input:checked) img { filter: grayscale(1); }
.thumb--new { border-style: dashed; }
.thumb--new figcaption { padding: 6px 8px; font-size: 11px; color: var(--a-muted); border-top: 1px dashed var(--a-line); }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 18px;
  border-top: 1px solid var(--a-line);
  background: #fdfbfb;
  border-radius: 0 0 var(--a-radius) var(--a-radius);
  flex-wrap: wrap;
}
.form-actions .spacer { margin-left: auto; }

/* — pemberitahuan — */
.alert {
  padding: 12px 15px;
  border-radius: var(--a-radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert-success { background: var(--a-green-soft); border-color: #c8d4bf; color: #33452c; }
.alert-error { background: var(--a-accent-soft); border-color: #eec3cd; color: var(--a-accent-dark); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

.empty-state { text-align: center; padding: 46px 20px; color: var(--a-muted); }
.empty-state h3 { font-size: 20px; color: var(--a-text); margin-bottom: 6px; }

/* — filter — */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input { min-width: 180px; width: auto; }

/* — paginasi — */
.pagination {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  list-style: none; padding: 14px 18px; margin: 0;
  border-top: 1px solid var(--a-line);
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 9px;
  font-size: 13.5px; text-decoration: none; color: var(--a-text);
  border: 1px solid var(--a-line); border-radius: var(--a-radius-sm);
  background: var(--a-surface);
}
.pagination a:hover { border-color: var(--a-accent); color: var(--a-accent); }
.pagination [aria-current='page'] span { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
.pagination .disabled span { opacity: 0.4; }

/* — tab pengaturan — */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  text-decoration: none;
  color: var(--a-text);
  border: 1px solid var(--a-line);
  background: var(--a-surface);
}
.tab:hover { border-color: var(--a-accent); color: var(--a-accent); }
.tab.is-active { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }

/* — masuk — */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(120% 90% at 15% 0%, var(--a-accent-soft) 0%, var(--a-bg) 60%);
}
.login-card {
  width: min(420px, 100%);
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  box-shadow: 0 18px 44px rgba(43, 34, 36, 0.10);
  padding: 30px;
}
.login-card h1 { font-size: 30px; margin-bottom: 4px; }
.login-card .sub { color: var(--a-muted); font-size: 14px; margin: 0 0 22px; }
.login-card .field + .field { margin-top: 14px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--a-muted); }

/* — responsif — */
@media (max-width: 1000px) {
  .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .content { padding: 18px; }
  .page-head h1 { font-size: 25px; }
  .scrim {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(43, 34, 36, 0.45);
  }
  .scrim[hidden] { display: none; }
}

/* Area tarik-lepas untuk unggahan gambar. */
.dropzone {
  position: relative;
  display: block;
  padding: 20px 16px;
  border: 1.5px dashed var(--a-line);
  border-radius: var(--a-radius-sm);
  background: var(--a-bg);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover,
.dropzone:focus-within { border-color: var(--a-accent); }
.dropzone.is-dragging {
  border-style: solid;
  border-color: var(--a-accent);
  background: var(--a-accent-soft);
}
.dropzone.is-invalid { border-color: var(--a-accent); }
.dropzone--compact { padding: 12px 14px; text-align: left; }

/* Input asli dibikin tembus pandang menutupi seluruh kotak: klik membuka
   dialog berkas, dan berkas yang dijatuhkan langsung diterima input. */
.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dropzone-text { display: block; font-size: 12.5px; color: var(--a-muted); pointer-events: none; }
.dropzone-text strong {
  display: block;
  margin-bottom: 2px;
  font-family: var(--a-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--a-text);
}

.thumb-drop {
  display: block;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-top: 1px solid var(--a-line);
  background: none;
  font: inherit;
  font-size: 11px;
  color: var(--a-muted);
  cursor: pointer;
}
.thumb-drop:hover { color: var(--a-accent); }

/* Kartu unggahan yang sedang berjalan. */
.thumb-bar {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--a-bg);
  position: relative;
  overflow: hidden;
}
.thumb-bar span {
  position: absolute;
  left: 0; bottom: 0;
  width: 0;
  height: 4px;
  background: var(--a-green);
  transition: width .2s ease;
}
.thumb--gagal { border-color: var(--a-accent); }
.thumb--gagal figcaption {
  padding: 10px 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--a-accent);
}

/* Tombol yang membuka WhatsApp, disamakan dengan situs publik. Hijau brand
   WhatsApp (#25D366) tidak dipakai karena teks putih di atasnya cuma 1.98:1. */
.btn-wa { background: #12833c; border-color: #12833c; color: #fff; }
.btn-wa:hover { background: #0f6b31; border-color: #0f6b31; color: #fff; }
.icon-wa { flex: none; }

/* ==========================================================================
   Editor artikel (WYSIWYG)
   ========================================================================== */

.editor {
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius-sm);
  background: var(--a-surface);
  overflow: hidden;
}
.editor.is-focus { border-color: var(--a-accent); box-shadow: 0 0 0 3px var(--a-accent-soft); }
.editor.is-invalid { border-color: var(--a-accent); }

.editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 5px 6px;
  background: #fbf8f8;
  border-bottom: 1px solid var(--a-line);
  position: sticky;
  top: 0;
  z-index: 2;
}

.editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #4a3f41;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--a-radius-sm);
  cursor: pointer;
}
.editor-btn:hover { background: #f1eaea; }
.editor-btn.is-aktif { background: var(--a-accent-soft); color: var(--a-accent-dark); }
.editor-btn[disabled] { opacity: .5; cursor: default; }
.editor-btn:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 1px; }
.editor-btn svg { pointer-events: none; }

.editor-pisah { width: 1px; height: 18px; margin: 0 4px; background: var(--a-line); }
.editor-dorong { margin-left: auto; }

.editor-area {
  min-height: 340px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.7;
}
.editor-area:focus { outline: none; }
.editor-area > :first-child { margin-top: 0; }
.editor-area > :last-child { margin-bottom: 0; }
.editor-area p { margin: 0 0 .9em; }
.editor-area h2 { font-family: var(--a-heading); font-size: 25px; font-weight: 600; margin: 1.1em 0 .4em; }
.editor-area h3 { font-size: 17px; font-weight: 600; margin: 1.1em 0 .35em; }
.editor-area ul, .editor-area ol { margin: 0 0 .9em; padding-left: 1.4em; }
.editor-area li { margin-bottom: .25em; }
.editor-area blockquote {
  margin: 0 0 .9em;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--a-accent-soft);
  color: #55494b;
  font-style: italic;
}
.editor-area a { color: var(--a-accent); }
.editor-area img { max-width: 100%; height: auto; border-radius: var(--a-radius-sm); margin: .4em 0; }
.editor-area img.is-terpilih { outline: 2px solid var(--a-accent); }

/* Kolom HTML mentah, dipakai saat tombol "HTML" ditekan. */
.editor textarea.input {
  border: 0;
  border-radius: 0;
  min-height: 340px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}
.editor textarea.input:focus { box-shadow: none; }

.editor-catatan {
  padding: 7px 12px;
  border-top: 1px solid var(--a-line);
  background: #fbf8f8;
  font-size: 12px;
  color: var(--a-muted);
}
.editor-catatan.is-galat { color: var(--a-accent); }
