/* ── Variables ── */
:root {
  --rose: #F08CA0;
  --rose-dark: #D4607A;
  --rose-light: #FADADF;
  --rose-pale: #FFF8FA;
  --charcoal: #4A4040;
  --text: #3D2830;
  --text-muted: #A07080;
  --border: #F5D5E0;
  --white: #FFFFFF;
  --wa-green: #25D366;
  --wa-dark: #1DA851;
  --danger: #C0392B;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(74,64,64,0.08);
  --shadow-hover: 0 6px 24px rgba(74,64,64,0.14);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text); background: var(--rose-pale); line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Header ── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(74,64,64,0.06);
  overflow: hidden;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* Clip the built-in whitespace from the square JPG */
.logo-link { display: inline-block; text-decoration: none; overflow: hidden; height: 90px; }
.logo-img { height: 260px; width: auto; display: block; margin-top: -58px; }
.brand { font-size: 1.7rem; font-weight: 700; color: var(--rose); }
.tagline { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.5px; }

/* ── Category filters ── */
.categories {
  display: flex;
  gap: 8px;
  padding: 24px 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.categories::-webkit-scrollbar { display: none; }

.cat-btn {
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--white);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  white-space: nowrap;
  transition: all 0.18s ease;
}
.cat-btn:hover { border-color: var(--rose); color: var(--rose); }
.cat-btn.active { background: var(--rose); color: var(--white); border-color: var(--rose); }

/* ── Products grid ── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding-bottom: 60px;
}
@media (max-width: 1100px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .products-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (max-width: 480px)  { .products-grid { grid-template-columns: 1fr; } }

/* ── Product card ── */
.product-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.product-image {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--rose-light);
}
.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.product-card:hover .product-image img { transform: scale(1.04); }

.category-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(44,16,32,0.65);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
}

.product-info { padding: 16px; display: flex; flex-direction: column; flex: 1; gap: 6px; }
.product-name { font-size: 1rem; font-weight: 600; line-height: 1.3; }
.product-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.product-price { font-size: 1.1rem; font-weight: 700; color: var(--rose); margin-top: 4px; }

.wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 11px 16px;
  background: var(--wa-green);
  color: var(--white);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.18s ease;
}
.wa-btn:hover { background: var(--wa-dark); }
.wa-btn svg { flex-shrink: 0; }

/* ── Empty / loading ── */
.empty, .loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 1rem;
}
.loading::after {
  content: '';
  display: block;
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 16px auto 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ────────────────────────────────────────────
   ADMIN STYLES
──────────────────────────────────────────── */
.admin-body {
  background: var(--rose-pale);
  min-height: 100vh;
}

/* Login */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 36px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-hover);
  text-align: center;
  border-top: 4px solid var(--rose);
}
.login-logo { display: block; overflow: hidden; height: 100px; margin: 0 auto 4px; }
.login-logo .logo-img { height: 280px; margin-top: -62px; margin-left: auto; margin-right: auto; }
.login-card p { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 24px; }

/* Form elements */
.field { margin-bottom: 16px; text-align: left; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--rose); }
.field textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.18s ease;
}
.btn-primary { background: var(--rose); color: var(--white); }
.btn-primary:hover { background: var(--rose-dark); }
.btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-danger { background: #FFF0EE; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--white); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--rose); color: var(--rose); }

.error-msg { color: var(--danger); font-size: 0.82rem; margin-top: 8px; display: none; }
.error-msg.show { display: block; }

/* Admin top bar */
.admin-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 1px 8px rgba(74,64,64,0.06);
}
.admin-bar .container { display: flex; align-items: center; justify-content: space-between; }
.admin-bar-logo { display: inline-block; overflow: hidden; height: 60px; }
.admin-bar-logo .logo-img { height: 175px; margin-top: -39px; }
.admin-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--white);
  background: var(--rose);
  padding: 3px 9px;
  border-radius: 999px;
}

/* Admin main */
.admin-main { padding: 32px 0 60px; }
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-toolbar h2 { font-size: 1.2rem; font-weight: 700; }

/* Products table */
.products-table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.products-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--rose-pale);
  border-bottom: 1px solid var(--border);
}
.products-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.products-table tr:last-child td { border-bottom: none; }
.products-table tr:hover td { background: var(--rose-pale); }

.table-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--rose-light);
}
.table-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--rose-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rose);
  font-size: 1.2rem;
}
.actions { display: flex; gap: 6px; }

.empty-table {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 20px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,16,32,0.4);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(44,16,32,0.2);
  transform: translateY(16px);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-wide { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Image upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}
.upload-area:hover, .upload-area.drag { border-color: var(--rose); background: var(--rose-pale); }
.upload-area input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-area p { font-size: 0.85rem; color: var(--text-muted); }
.upload-area strong { color: var(--rose); }
.upload-preview {
  margin-top: 12px;
  position: relative;
  display: inline-block;
}
.upload-preview img {
  max-height: 140px;
  border-radius: 6px;
  object-fit: cover;
}
.upload-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1A1A1A;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s ease;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #1A5C34; }
.toast.error { background: #8B1A1A; }

/* ────────────────────────────────────────────
   PRODUCT PAGE
──────────────────────────────────────────── */
.product-page { padding: 28px 0 60px; }

.product-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 28px;
  transition: color 0.15s;
}
.product-back:hover { color: var(--rose); }

.product-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 760px) {
  .product-layout { grid-template-columns: 1fr; gap: 24px; }
}

/* Gallery */
.gallery-main {
  background: var(--rose-light);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-main.has-image { cursor: zoom-in; }
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}
.gallery-main.has-image:hover img { transform: scale(1.03); }
.gallery-placeholder {
  font-size: 5rem;
  color: var(--rose);
  opacity: 0.4;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.gallery-thumb {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  border: 2.5px solid var(--border);
  cursor: pointer;
  padding: 0;
  background: var(--rose-light);
  transition: border-color 0.15s;
  flex-shrink: 0;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb.active { border-color: var(--rose); }
.gallery-thumb:hover { border-color: var(--rose-dark); }

/* Product info panel */
.product-page-badge {
  display: inline-block;
  background: var(--rose-light);
  color: var(--rose-dark);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.product-page-name {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--charcoal);
  margin-bottom: 14px;
}
@media (max-width: 480px) { .product-page-name { font-size: 1.4rem; } }
.product-page-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rose-dark);
  margin-bottom: 16px;
}
.product-page-desc {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 28px;
  white-space: pre-line;
}
.product-page-wa {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--wa-green);
  color: var(--white);
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.18s, transform 0.18s;
  box-shadow: 0 4px 16px rgba(37,211,102,0.28);
}
.product-page-wa:hover { background: var(--wa-dark); transform: translateY(-2px); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(16, 6, 12, 0.93);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.lightbox.open { opacity: 1; pointer-events: all; }
.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 8px;
  transition: color 0.15s;
}
.lightbox-close:hover { color: white; }
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s;
  user-select: none;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.2); }
@media (max-width: 480px) {
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
  .lightbox-prev, .lightbox-next { padding: 8px 12px; font-size: 2rem; }
}

/* Product card — clickable image + name */
.product-image-link { display: block; }
.product-name-link { display: block; color: inherit; text-decoration: none; }
.product-name-link:hover .product-name { color: var(--rose); }

/* Admin gallery thumbnails */
.gallery-admin-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 32px;
  align-items: flex-start;
}
.gallery-admin-thumb {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.gallery-admin-thumb img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid var(--border);
}
.gallery-admin-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  border: none;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

/* Bulk upload */
.bulk-preview-wrap {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.bulk-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.bulk-preview-table th {
  position: sticky;
  top: 0;
  padding: 9px 12px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--rose-pale);
  border-bottom: 1px solid var(--border);
}
.bulk-preview-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulk-preview-table tr:last-child td { border-bottom: none; }
.bulk-progress-bar {
  height: 8px;
  background: var(--rose-light);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.bulk-progress-fill {
  height: 100%;
  background: var(--rose);
  border-radius: 999px;
  transition: width 0.3s ease;
}
