/* Master Prompt Dolz — Minimalist Classic */

:root {
  --bg: #FAFAF7;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --muted: #6B6B6B;
  --faint: #9A9A9A;
  --border: #EBEBEB;
  --border-strong: #D6D6D6;
  --accent: #1A1A1A;
  --accent-soft: #F0F0EC;
  --success: #1F7A3F;
  --danger: #B42318;
  --star: #C9A227;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --shadow-hover: 0 2px 4px rgba(0,0,0,.05), 0 12px 28px rgba(0,0,0,.07);
  --radius: 14px;
  --radius-sm: 10px;
  --max: 1180px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 247, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding-block: 10px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.logo-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.logo-text { font-size: 15px; }
.logo-text span { color: var(--muted); font-weight: 500; }

.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--faint);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-input::placeholder { color: var(--faint); }
.search-input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0,0,0,.05);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-btn {
  border: 0;
  background: transparent;
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-btn:hover { background: var(--accent-soft); color: var(--text); }
.nav-btn.is-active { background: var(--accent); color: #fff; }

/* ---------- Layout ---------- */
.page { padding: 28px 0 64px; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-title {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.page-sub { color: var(--muted); font-size: 14.5px; margin-top: 6px; }

.layout-split {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 84px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.sidebar h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
  margin-bottom: 10px;
  font-weight: 600;
}
.filter-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.filter-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
  transition: background .15s;
}
.filter-btn:hover { background: var(--accent-soft); }
.filter-btn.is-active { background: var(--accent); color: #fff; }
.filter-btn .count {
  font-size: 11px;
  color: var(--faint);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 7px;
  min-width: 22px;
  text-align: center;
}
.filter-btn.is-active .count { background: rgba(255,255,255,.15); color: #fff; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  transition: all .15s;
}
.tag-chip:hover { border-color: var(--border-strong); color: var(--text); }
.tag-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.card-media {
  aspect-ratio: 16/10;
  background: #F2F2EE;
  overflow: hidden;
  position: relative;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.card-media-fallback {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: var(--faint);
  font-size: 13px;
  background:
    linear-gradient(135deg, #F7F7F3 25%, #EFEFEA 25%, #EFEFEA 50%, #F7F7F3 50%, #F7F7F3 75%, #EFEFEA 75%);
  background-size: 20px 20px;
}
.badge-featured {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(26,26,26,.88);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
}
.badge-draft {
  position: absolute;
  top: 10px; right: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.card-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-title {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.card-desc {
  font-size: 13.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--faint);
}
.cat-pill {
  background: var(--accent-soft);
  color: var(--text);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 11.5px;
}
.rating {
  margin-left: auto;
  color: var(--star);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.card-tags span {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 999px;
}
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #333; }
.btn-secondary {
  background: var(--card);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--accent-soft); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--accent-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #912018; }
.btn-copied { background: var(--success) !important; color: #fff !important; border-color: var(--success) !important; }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-copied svg { width: 14px; height: 14px; }

.fav-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .15s;
  z-index: 2;
}
.fav-btn:hover { background: #fff; border-color: var(--border-strong); }
.fav-btn.is-active { background: #fff; border-color: #E8B4B4; }
.fav-btn svg { width: 16px; height: 16px; color: var(--muted); }
.fav-btn.is-active svg { color: #C23B3B; fill: #C23B3B; }
.card-media .badge-featured + .fav-btn { right: 10px; }

/* ---------- Featured strip ---------- */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 8px 0 14px;
}

/* ---------- Empty ---------- */
.empty {
  text-align: center;
  padding: 56px 20px;
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20,20,20,.45);
  animation: fadeIn .18s ease;
}
.modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,.18);
  animation: popIn .2s ease;
  z-index: 1;
}
.modal-panel.modal-wide { width: min(860px, 100%); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 16px;
  z-index: 2;
}
.modal-close:hover { background: var(--accent-soft); }

.detail-hero {
  aspect-ratio: 21/9;
  background: #F2F2EE;
  overflow: hidden;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-body { padding: 28px; }
.detail-title {
  font-family: var(--serif);
  font-size: clamp(24px, 3.5vw, 34px);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  padding-right: 36px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-bottom: 18px;
  font-size: 13.5px;
  color: var(--muted);
}
.detail-meta .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
  display: block;
  margin-bottom: 2px;
}
.detail-section { margin-bottom: 18px; }
.detail-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
  margin-bottom: 8px;
}
.detail-section p { color: var(--muted); font-size: 14.5px; }
.content-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  z-index: 200;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Admin ---------- */
.admin-bar {
  background: var(--text);
  color: #fff;
  font-size: 13px;
}
.admin-bar .header-inner { min-height: 48px; }
.admin-bar .nav-btn { color: rgba(255,255,255,.75); }
.admin-bar .nav-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.admin-bar .nav-btn.is-active { background: #fff; color: var(--text); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
  margin-bottom: 8px;
}
.stat-card .value {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  background: var(--bg);
  font-weight: 600;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FCFCFA; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.pill-ok { background: #EAF6EE; color: var(--success); border-color: #C9E8D4; }
.pill-draft { background: var(--accent-soft); color: var(--muted); }
.pill-yes { background: #FFF6E0; color: #8A6A00; border-color: #F0E0B0; }

/* Forms */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  max-width: 760px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field input, .field select, .field textarea {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 160px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
  background: #fff;
}
.field-hint { font-size: 12px; color: var(--faint); }
.field-hint code { background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }
.img-preview {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-top: 10px;
}
.img-preview[hidden] { display: none; }
.img-preview img {
  max-width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.img-preview-note { font-size: 12px; color: var(--faint); }
.img-preview-note[hidden] { display: none; }
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.form-msg {
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 500;
  min-height: 20px;
}
.form-msg.ok { color: var(--success); }
.form-msg.err { color: var(--danger); }

/* Login */
.login-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow-hover);
}
.login-card h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  margin-bottom: 6px;
}
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 14px; }

/* Category manage */
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.cat-row .name { flex: 1; font-weight: 500; font-size: 14px; }
.cat-row .count { color: var(--faint); font-size: 12.5px; }
.inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.inline-form input { flex: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout-split { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; gap: 10px; }
  .search-wrap { order: 3; max-width: none; width: 100%; }
  .header-nav { margin-left: auto; }
  .nav-btn { padding: 8px 10px; font-size: 12.5px; }
  .logo-text span { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .detail-body { padding: 20px; }
  .page { padding-top: 20px; }
}

@media (max-width: 400px) {
  .header-nav .hide-xs { display: none; }
  .card-actions { flex-direction: column; }
  .card-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
