/* ═══════════════════════════════════════════════
   css/components.css — Reusable UI Components
═══════════════════════════════════════════════ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--dur-fast);
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
}
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--gold);
  color: #0B0B0B;
}
.btn-primary:hover:not(:disabled) {
  background: var(--gold-light);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border2);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border3);
}
.btn-dark {
  background: var(--dark5);
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-dark:hover:not(:disabled) {
  border-color: var(--border3);
}
.btn-danger {
  background: rgba(239,68,68,.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.25);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,.2);
}
.btn-sm  { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg  { padding: 12px 24px; font-size: 14px; border-radius: 10px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.card-pad      { padding: 18px 20px; }
.card-heading  { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 14px; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 600; margin-bottom: 4px; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.stat-sub   { font-size: 11px; color: var(--text-dim); }

/* ── Toggle switch ── */
.toggle-wrap  { display: inline-flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.toggle-track {
  width: 36px; height: 20px;
  background: #444;
  border-radius: 10px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-track.on { background: var(--green); }
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s var(--ease-spring);
}
.toggle-track.on .toggle-thumb { transform: translateX(16px); }

/* ── Tags ── */
.tag    { display: inline-flex; align-items: center; border-radius: 20px; font-size: 10px; font-weight: 600; padding: 2px 8px; white-space: nowrap; }
.tag-sm { font-size: 9px; padding: 2px 6px; }

/* ── Badge ── */
.badge       { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.badge-green { background: rgba(34,197,94,.12); color: #4ade80; }
.badge-dim   { background: var(--dark5); color: var(--text-dim); }
.badge-gold  { background: var(--gold-pale); color: var(--gold); border: 1px solid var(--gold-border); }

/* ── Stars ── */
.stars      { display: inline-flex; align-items: center; gap: 2px; }
.star-icon  { color: #f59e0b; font-size: 12px; line-height: 1; }
.star-icon.empty { color: rgba(245,158,11,.25); }

/* ── Spice dots ── */
.spice-dots { display: inline-flex; align-items: center; gap: 2px; }
.spice-dot  { width: 7px; height: 7px; border-radius: 50%; background: rgba(239,68,68,.2); }
.spice-dot.on { background: var(--ef4444, #ef4444); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--dur-base);
}
.modal-overlay.open { opacity: 1; }
.modal-box {
  background: var(--dark2);
  border: 1px solid var(--border2);
  border-radius: var(--r-xl);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(18px) scale(.97);
  transition: transform .28s var(--ease-spring);
  box-shadow: 0 32px 80px rgba(0,0,0,.7);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.modal-close {
  padding: 4px;
  color: var(--text-muted);
  transition: color var(--dur-fast);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; }

/* ── Form helpers ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-row   { display: grid; gap: 12px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Tab bar ── */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: 8px 14px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all var(--dur-fast);
  margin-bottom: -1px;
  font-family: var(--font-body);
}
.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  border-bottom-color: var(--surface);
}
.tab-btn:hover:not(.active) { color: var(--text-muted); }

/* ── Tag selector ── */
.tag-selector { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-opt {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all .14s;
  font-family: var(--font-body);
}

/* ── Photo grid (item form) ── */
.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-thumb {
  position: relative;
  width: 72px; height: 72px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--dark4);
  flex-shrink: 0;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb-remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  border: none;
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.photo-thumb:hover .photo-thumb-remove { opacity: 1; }
.photo-add-btn {
  width: 72px; height: 72px;
  border-radius: 9px;
  border: 2px dashed var(--border2);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast);
  font-family: var(--font-body);
}
.photo-add-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ── Upload section── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Image library ── */
.img-library-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.img-lib-item {
  border-radius: 9px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4/3;
  background: var(--dark4);
  border: 2px solid transparent;
  transition: border-color .15s, transform .12s;
}
.img-lib-item:hover { border-color: var(--gold); transform: scale(1.03); }
.img-lib-item img  { width: 100%; height: 100%; object-fit: cover; }

/* ── Upload zone ── */
.img-upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--r-lg);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.img-upload-zone:hover { border-color: var(--gold); background: var(--gold-pale); }
.img-upload-zone input[type="file"] { display: none; }

/* ── Featured toggle row ── */
.featured-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--dark3);
  border-radius: 9px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* ── Activity feed ── */
.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.activity-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-top: 5px; flex-shrink: 0; }

/* ── Progress bar ── */
.progress-bar  { height: 5px; background: var(--dark4); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .5s var(--ease); }

/* ── Icon buttons ── */
.icon-btn {
  padding: 4px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast), background var(--dur-fast);
  color: var(--text-dim);
}
.icon-btn:hover         { color: var(--text); background: rgba(255,255,255,.06); }
.icon-btn.danger:hover  { color: #f87171; }
.icon-btn.gold:hover    { color: var(--gold); }
.icon-btn.active        { color: var(--gold); }

/* ── Section label ── */
.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.section-heading {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
}

/* ── Page structure ── */
.page { display: none; padding: 32px; min-height: 100%; animation: fadeUp .25s var(--ease); }
.page.active { display: block; }
.page-title  { font-family: var(--font-display); font-size: 32px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.page-sub    { font-size: 13px; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .stats-grid   { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .page         { padding: 20px; }
  .stats-grid   { grid-template-columns: 1fr 1fr; }
  .form-row-3   { grid-template-columns: 1fr; }
}
