/* Sulit Spot Admin */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1c2027;
  --muted: #6b7280;
  --brand: #d6482b;
  --brand-dark: #b03a20;
  --brand-soft: #fdece8;
  --ok: #12805c;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --info-bg: #eaf2ff;
  --danger: #c62828;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 12px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.125rem; }
p { margin: 0; }
code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef0f3; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }

/* ---------------------------------------------------------- gate ---- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 32px 28px; box-shadow: var(--shadow); text-align: center;
}
.gate-title { font-size: 1.5rem; color: var(--brand); }
.gate-sub { margin: 8px 0 24px; color: var(--muted); font-size: .9375rem; }
.gate-form { text-align: left; display: grid; gap: 14px; }
.gate-form label { display: grid; gap: 6px; font-size: .875rem; font-weight: 550; }
.gate-err { color: var(--danger); font-size: .875rem; }

/* -------------------------------------------------------- topbar ---- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-size: 1.25rem; color: var(--brand); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.count-pill {
  background: var(--brand-soft); color: var(--brand-dark);
  padding: 4px 11px; border-radius: 999px; font-size: .8125rem; font-weight: 600;
  white-space: nowrap;
}

.tabs {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 4px; overflow-x: auto;
}
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 10px 14px 12px; font-size: .9375rem; font-weight: 550;
  color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }

/* --------------------------------------------------------- layout --- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 80px; }
.panel { display: none; }
.panel.is-active { display: block; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px;
}
.card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.card-head h2 { margin-bottom: 3px; }
.step-num {
  flex: 0 0 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: .8125rem; font-weight: 700;
}
.card-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 18px; flex-wrap: wrap;
}

.banner {
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
  font-size: .9375rem; border: 1px solid transparent;
}
.banner-warn { background: var(--warn-bg); color: var(--warn); border-color: #f0dca6; }
.banner-info { background: var(--info-bg); color: #1e40af; border-color: #c9dcfb; }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: inherit; font: inherit; text-decoration: underline;
}

/* -------------------------------------------------------- buttons --- */

.btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; text-decoration: none;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  padding: 8px 15px; font-size: .9375rem; font-weight: 550;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: #f7f8fa; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: #eef0f3; color: var(--text); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: #fdeaea; }
.btn-lg { padding: 11px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-tiny { padding: 4px 10px; font-size: .8125rem; }

/* --------------------------------------------------------- inputs --- */

input[type=text], input[type=password], input[type=search],
input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 9px 11px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.55; }

.field { display: grid; gap: 6px; margin-top: 14px; font-size: .875rem; font-weight: 550; }
.field > small { font-weight: 400; }

.status { font-size: .875rem; color: var(--muted); }
.status.is-error { color: var(--danger); }
.status.is-ok { color: var(--ok); }

/* ------------------------------------------------------- dropzone --- */

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; cursor: pointer;
  background: #fafbfc; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.dz-icon { font-size: 30px; margin-bottom: 6px; }
.dropzone-inner p { margin: 2px 0; }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.thumb { position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 3px; right: 3px; width: 21px; height: 21px;
  border: 0; border-radius: 50%; cursor: pointer; line-height: 1;
  background: rgba(0, 0, 0, .62); color: #fff; font-size: 13px;
}

/* -------------------------------------------------------- matches --- */

.search-row { display: flex; gap: 8px; margin-bottom: 14px; }
.search-row input { flex: 1; }

.matches {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.match {
  border: 2px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; background: #fff;
  display: flex; flex-direction: column; text-align: left;
  padding: 0; font: inherit; transition: border-color .12s, box-shadow .12s;
}
.match:hover { border-color: var(--brand-dark); box-shadow: var(--shadow); }
.match.is-selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.match-img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #f6f7f9; display: block; }
.match-body { padding: 10px 11px 12px; display: grid; gap: 5px; }
.match-title { font-size: .875rem; font-weight: 600; line-height: 1.35; }
.match-desc { font-size: .8125rem; color: var(--muted); line-height: 1.45; }
.match-src { font-size: .75rem; color: var(--muted); }
.match-badge {
  display: inline-block; font-size: .6875rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--brand-dark); background: var(--brand-soft);
  padding: 2px 7px; border-radius: 4px; width: fit-content;
}
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------- review form --- */

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid label { display: grid; gap: 6px; font-size: .875rem; font-weight: 550; }
.form-section-title {
  grid-column: 1 / -1; font-size: .75rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
  border-top: 1px solid var(--border); padding-top: 14px; margin-top: 2px;
}
.form-grid .form-section-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.preview-strip { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.preview-strip img {
  width: 76px; height: 76px; object-fit: contain;
  background: #f6f7f9; border: 1px solid var(--border); border-radius: 8px;
}

/* ----------------------------------------------------------- list --- */

.list-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.list-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list-actions input[type=search] { width: 230px; }

.table-scroll { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: .875rem; }
.grid th, .grid td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
.grid tbody tr:hover { background: #fafbfc; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.col-img { width: 52px; }
.col-act { width: 120px; }
.grid td.col-act { text-align: right; white-space: nowrap; }
.row-img {
  width: 40px; height: 40px; object-fit: contain;
  background: #f6f7f9; border: 1px solid var(--border); border-radius: 6px; display: block;
}
.row-name { font-weight: 600; }
.row-sub { color: var(--muted); font-size: .8125rem; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); display: grid; gap: 14px; justify-items: center; }

/* ---------------------------------------------------------- modal --- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .48);
  display: grid; place-items: center; padding: 20px; z-index: 60;
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: 0 20px 50px rgba(16, 24, 40, .22);
  width: 100%; max-width: 820px; max-height: 90vh; display: flex; flex-direction: column;
}
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; align-items: center;
}

/* ---------------------------------------------------------- misc --- */

.settings-form fieldset {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px 18px 20px; margin: 0 0 18px;
}
.settings-form legend { font-size: .875rem; font-weight: 650; padding: 0 8px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #1c2027; color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: .9375rem; z-index: 90; box-shadow: 0 8px 24px rgba(16, 24, 40, .28);
}
.toast.is-error { background: var(--danger); }

.spinner {
  display: inline-block; width: 13px; height: 13px; vertical-align: -2px;
  border: 2px solid rgba(0, 0, 0, .18); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .list-actions { width: 100%; }
  .list-actions input[type=search] { width: 100%; }
  .wrap { padding: 16px 14px 70px; }
  .card { padding: 16px; }
}

/* ---- category picker (review step) ---- */
.cat-field { display: block; margin-top: 4px; }
.cat-field-label {
  display: block;
  font-weight: 600;
  font-size: .875rem;
  margin-bottom: 6px;
}
.cat-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
  border: 1px solid #dfe3e8;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fafbfc;
  max-height: 360px;
  overflow-y: auto;
}
.cat-picker .cat-group { min-width: 0; }
.cat-picker .cat-group-title {
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  margin-bottom: 8px;
}
/* Overrides the .form-grid label rules, which stack inputs under their text. */
.cat-picker label.cat-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  margin: 0 0 5px 0;
  padding: 0;
  font-size: .875rem;
  font-weight: 400;
  cursor: pointer;
}
.cat-picker label.cat-item input[type="checkbox"] {
  display: inline-block !important;
  width: 15px !important;
  height: 15px;
  min-width: 15px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: #c0392b;
}
.cat-picker label.cat-item > span {
  display: inline !important;
  font-weight: 400;
  line-height: 1.35;
}
.cat-picker label.cat-item:hover > span { color: #c0392b; }

/* ---- password confirmation overlay ---- */
.pw-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 28, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.pw-box {
  background: #fff;
  border-radius: 14px;
  padding: 24px 26px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.pw-box h3 { margin: 0 0 8px; font-size: 1.1rem; }
.pw-box p { margin: 0 0 16px; color: #5b6472; font-size: .9rem; line-height: 1.5; }
.pw-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd5dd;
  border-radius: 8px;
  font-size: .95rem;
}
.pw-box input:focus { outline: 2px solid #c0392b; outline-offset: 1px; border-color: #c0392b; }
.pw-err { color: #c62828; margin: 10px 0 0 !important; font-size: .85rem; }
.pw-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
