/* ============================================================
   TOKOKU - Stylesheet
   Mobile-first, responsive, orange theme, sticky footer
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange: #f97316;
  --orange-dark: #ea580c;
  --orange-light: #fff7ed;
  --green: #22c55e;
  --red: #ef4444;
  --bg: #ffffff;
  --bg-soft: #f9fafb;
  --bg-muted: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --radius: 12px;
  --radius-sm: 8px;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

#app, #admin-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1152px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--orange);
  border-radius: 12px;
  font-size: 20px;
}
.brand-logo-sm { width: 36px; height: 36px; font-size: 18px; }
.brand-text h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--orange);
  letter-spacing: -0.02em;
}
.brand-text .tagline {
  font-size: 11px;
  color: var(--text-muted);
}
.admin-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.admin-link:hover { background: var(--bg-muted); color: var(--text); }
.admin-link .icon { font-size: 14px; }

/* ===== Search ===== */
.search-wrap {
  position: relative;
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 16px 12px;
}
.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: .5;
}
.search-wrap input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
  background: #fff;
}

/* ===== Category Bar ===== */
.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.6);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all .15s;
}
.cat-pill:hover { background: #e5e7eb; }
.cat-pill.active {
  background: var(--orange);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ===== Main Container ===== */
.container {
  max-width: 1152px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title h2 { font-size: 16px; font-weight: 700; }
.muted { color: var(--text-muted); font-size: 12px; }

/* ===== Product Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}

.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-muted);
  overflow: hidden;
  cursor: pointer;
  border: none;
  padding: 0;
}
.product-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.product-card:hover .product-thumb img { transform: scale(1.05); }
.product-thumb-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.3);
  opacity: 0;
  transition: opacity .2s;
  display: flex; align-items: center; justify-content: center;
}
.product-card:hover .product-thumb-overlay { opacity: 1; }
.view-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.cat-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(255,255,255,.95);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.see-detail-pill {
  background: rgba(255,255,255,.95);
  color: #000;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.product-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}
.product-desc {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  transition: all .15s;
}
.like-btn:hover { background: #e5e7eb; }
.like-btn.liked { background: #fef2f2; color: var(--red); }
.like-btn .heart { font-size: 12px; }
.like-btn.liked .heart::after { content: "❤"; }
.like-btn:not(.liked) .heart::after { content: "🤍"; }
.like-btn .heart { font-size: 0; }
.like-btn .heart::after { font-size: 12px; }
.view-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-muted);
}
.btn-buy {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  text-align: center;
  transition: background .15s;
}
.btn-buy:hover { background: var(--orange-dark); }
.btn-view {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}
.btn-view:hover { background: var(--bg-soft); }

/* ===== Empty / Loading ===== */
.empty-state, .loading-state {
  text-align: center;
  padding: 64px 20px;
}
.empty-icon { font-size: 48px; opacity: .4; margin-bottom: 12px; }
.empty-title { font-weight: 700; margin-bottom: 4px; }
.empty-desc { font-size: 13px; color: var(--text-muted); }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--bg-muted);
  border-top-color: var(--orange);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state p { color: var(--text-muted); font-size: 13px; }

/* ===== Footer ===== */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 24px 16px;
  text-align: center;
}
.footer-inner { max-width: 1152px; margin: 0 auto; }
.footer-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; }
.footer-logo { font-size: 18px; }
.footer-brand strong { color: var(--orange); }
.site-footer p { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.footer-admin {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-admin:hover { color: var(--text); }

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal-content-sm { max-width: 420px; }
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 14px;
  z-index: 5;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(0,0,0,.7); }
.modal-body { padding: 24px; }
.modal-body h3 { font-size: 18px; margin-bottom: 8px; }
.modal-body p { font-size: 14px; color: var(--text-muted); }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ===== Detail Modal Content ===== */
.detail-body { padding: 16px; }
@media (min-width: 640px) { .detail-body { padding: 24px; } }
.detail-gallery-main {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.detail-gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.detail-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.detail-nav:hover { background: rgba(0,0,0,.7); }
.detail-nav.prev { left: 8px; }
.detail-nav.next { right: 8px; }
.detail-counter {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}
.detail-view-badge {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
}
.detail-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 8px;
  scrollbar-width: thin;
}
.detail-thumb {
  flex-shrink: 0;
  width: 64px; height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: .7;
  cursor: pointer;
  background: none;
  padding: 0;
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumb.active { border-color: var(--orange); opacity: 1; }

.detail-info { margin-top: 16px; }
.detail-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.detail-title { font-size: 18px; font-weight: 700; line-height: 1.3; }
@media (min-width: 640px) { .detail-title { font-size: 20px; } }
.detail-cat-badge {
  background: var(--bg-muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.like-btn-full {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.like-btn-full:hover { background: var(--bg-soft); }
.like-btn-full.liked {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--red);
}
.like-btn-full .like-count {
  background: rgba(0,0,0,.06);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
}

.share-dropdown { position: relative; }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}
.share-btn:hover { background: #e5e7eb; }
.share-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: 6px;
  display: none;
  z-index: 10;
}
.share-menu.open { display: block; }
.share-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  text-align: left;
}
.share-menu-item:hover { background: var(--bg-soft); }

.share-full-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.detail-desc {
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 12px;
}
.detail-video-wrap {
  margin: 12px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.detail-video-wrap iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  display: block;
}
.detail-video-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #2563eb;
  margin-bottom: 12px;
}
.detail-video-link:hover { text-decoration: underline; }

.btn-buy-large {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  background: var(--orange);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  margin-top: 8px;
}
.btn-buy-large:hover { background: var(--orange-dark); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-soft); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-danger-text { color: var(--red); }
.btn-danger-text:hover { background: #fef2f2; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ===== Login ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--orange-light), #fff);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 24px;
}
.back-link {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.back-link:hover { color: var(--text); }
.login-header { text-align: center; margin-bottom: 24px; }
.login-logo {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  background: var(--orange);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.login-header h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-header p { font-size: 13px; color: var(--text-muted); }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.login-form input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}
.login-hint {
  margin-top: 16px;
  padding: 10px;
  background: var(--bg-muted);
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.login-hint code { font-weight: 700; color: var(--text); }

/* ===== Admin Dashboard ===== */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.admin-header-inner {
  max-width: 1152px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
@media (min-width: 640px) {
  .admin-header-inner { padding: 12px 16px; gap: 12px; }
}
.admin-header-inner .brand h1 { font-size: 15px; font-weight: 700; }
@media (min-width: 640px) { .admin-header-inner .brand h1 { font-size: 16px; } }
.admin-actions { display: flex; gap: 4px; }
@media (min-width: 640px) { .admin-actions { gap: 6px; } }
.admin-main {
  max-width: 1152px;
  width: 100%;
  margin: 0 auto;
  padding: 12px;
  flex: 1;
}
@media (min-width: 640px) {
  .admin-main { padding: 20px 16px; }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
@media (min-width: 640px) { .stat-card { padding: 16px; } }
.stat-card p { font-size: 10px; color: var(--text-muted); }
@media (min-width: 640px) { .stat-card p { font-size: 11px; } }
.stat-card .stat-value { font-size: 20px; font-weight: 700; margin-top: 4px; }
@media (min-width: 640px) { .stat-card .stat-value { font-size: 24px; } }
.stat-card .stat-value.orange { color: var(--orange); }

.admin-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 640px) {
  .admin-toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
}
.toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
@media (min-width: 640px) {
  .toolbar-left { flex-direction: row; }
  .admin-search { max-width: 320px; }
}
.select-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
@media (min-width: 640px) {
  .select-input { width: 200px; }
}

.admin-product-list {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
/* ===== Admin Product Row (mobile-friendly flex, semua ukuran) ===== */
.admin-product-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.admin-product-row:last-child { border-bottom: none; }
.admin-product-thumb {
  width: 48px; height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-muted);
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .admin-product-row { padding: 12px 16px; gap: 14px; }
  .admin-product-thumb { width: 56px; height: 56px; }
}
.admin-product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-product-info { flex: 1; min-width: 0; }
.admin-product-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.admin-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.admin-cat-badge {
  background: var(--bg-muted);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.admin-buy-badge {
  background: var(--orange-light);
  color: var(--orange-dark);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid #fed7aa;
  white-space: nowrap;
}
.admin-stats-badge {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
}
.admin-product-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 15px;
  color: var(--text-muted);
  touch-action: manipulation;
}
@media (min-width: 640px) {
  .icon-btn { width: 32px; height: 32px; font-size: 14px; }
}
.icon-btn:hover { background: var(--bg-muted); color: var(--text); }
.icon-btn.danger:hover { background: #fef2f2; color: var(--red); }

/* Table head tidak dipakai (pakai flex layout untuk semua ukuran) */
.table-head { display: none !important; }

/* ===== Drawer (Form) ===== */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}
.drawer.open { display: block; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
}
.drawer-content {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 480px;
  background: #fff;
  box-shadow: -8px 0 24px rgba(0,0,0,.1);
  display: flex;
  flex-direction: column;
}
.drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
@media (min-width: 640px) {
  .drawer-header { padding: 16px 20px; }
}
.drawer-header h2 { font-size: 16px; font-weight: 700; }
.drawer-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
@media (min-width: 640px) {
  .drawer-body { padding: 20px; }
}

.form-field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.req { color: var(--red); }
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}
.field-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.char-count { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 4px; }

/* Upload box */
.upload-box {
  width: 100%;
  aspect-ratio: 1;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, background .15s;
}
.upload-box:hover { border-color: var(--orange); background: var(--bg-muted); }
.upload-box.has-image { border-style: solid; }
.upload-box img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.upload-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
.upload-icon { font-size: 24px; display: block; margin-bottom: 4px; }
.upload-actions {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.upload-box.has-image:hover .upload-actions { display: flex; }
.upload-action-btn {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: rgba(255,255,255,.9);
  color: #000;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.upload-action-btn.danger { background: rgba(239,68,68,.9); color: #fff; }
.upload-box.uploading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.7) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f97316' stroke-width='3'><path d='M12 2v20M2 12h20' opacity='.3'/></svg>") center/24px no-repeat;
}

/* Gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (min-width: 640px) { .gallery-grid { grid-template-columns: repeat(4, 1fr); } }
.gallery-slot {
  aspect-ratio: 1;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  font-size: 11px;
  color: var(--text-muted);
}
.gallery-slot:hover { border-color: var(--orange); background: var(--bg-muted); }
.gallery-slot.filled {
  border-style: solid;
  border-color: transparent;
}
.gallery-slot.filled img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.gallery-slot .slot-actions {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.gallery-slot.filled:hover .slot-actions { display: flex; }

.form-actions {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #1f2937;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 200;
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: #16a34a; }
.toast.error { background: var(--red); }

/* ===== Helpers ===== */
.hide-sm { display: inline; }
@media (max-width: 639px) { .hide-sm { display: none; } }
