/* ===============================
   PRODUCT DETAIL PAGE - GOENJOY
   =============================== */

/* Root Variables */
:root {
  --blue: #1e40af;
  --border: #e5e7eb;
  --muted: #6b7280;
  --bg: #f8fafc;
  --green: #28a745; /* Warna untuk Tambah ke Keranjang */
  --sky: #17a2b8;  /* Warna untuk Buy Now */
}

/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0; /* Menghapus margin bawaan semua elemen */
  padding: 0; /* Menghapus padding bawaan semua elemen */
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #fff;
  color: #0b1220;
}

/* Container */
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
  margin-bottom: 0;
}

/* Card */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}
@media (max-width: 480px) {
  .card {
    padding: 12px; /* Padding lebih kecil di mobile */
  }
}

/* Grid Layout */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* Header */
.header {
  margin-top: 68px; /* Jarak untuk desktop */
  background: var(--blue);
  color: #fff;
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 10;
}
@media (max-width: 768px) {
  .header {
    margin-top: 0;
    padding: 12px;
    min-height: 60px; /* Tinggi minimum untuk menampung badge dan title */
  }
}

/* Product Title dan Badge */
.header .pd-title {
  font-size: clamp(18px, 4vw, 22px);
  line-height: 1.4;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  text-align: left;
  color: #fff;
}
.header .badge {
  position: relative;
  z-index: 2;
  margin-bottom: 8px; /* Jarak dari judul */
}
@media (max-width: 768px) {
  .header .pd-title {
    font-size: clamp(16px, 4vw, 18px);
    margin: 0 0 8px;
    color: #fff;
  }
}
@media (max-width: 480px) {
  .header .pd-title {
    font-size: clamp(14px, 3.5vw, 16px);
    line-height: 1.5;
    margin: 0 0 8px;
    color: #fff;
  }
}

/* Badge */
.badge {
  display: inline-block;
  background: #eaf2ff;
  color: #1e40af;
  border: 1px solid #c7d7fe;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
}

/* Button */
.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  box-sizing: border-box;
  transition: background-color 0.2s;
  height: auto; /* Memastikan tinggi menyesuaikan konten */
}
.btn-green {
  background: var(--green);
  color: #fff;
}
.btn-sky {
  background: var(--sky);
  color: #fff;
}
.btn:disabled {
  background: #ccc;
  opacity: 0.6;
  cursor: not-allowed;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.1); /* Efek hover untuk tombol aktif */
}

/* Muted Text */
.muted {
  color: var(--muted);
}

/* Horizontal Rule */
.hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 14px 0;
}

/* Toast Notification */
.toast {
  position: sticky;
  top: 0;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
  border-radius: 10px;
}
.toast-err {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

/* ===============================
   IMAGE & MEDIA GALLERY
   =============================== */
.media-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 2;
}
.media-main {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 320px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #fff;
  display: block;
}

/* Thumbnail Grid */
.thumbs-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, 1fr);
  position: relative;
  z-index: 2;
}
.thumbs-grid .thumb,
.thumbs-grid .thumb * {
  pointer-events: auto !important;
  cursor: pointer;
}
@media (max-width: 768px) {
  .thumbs-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.thumb {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-active,
.thumb:focus {
  outline: 2px solid #1e40af;
  outline-offset: 2px;
}

/* ===============================
   LIGHTBOX
   =============================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.lightbox.open {
  display: flex;
}
.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  background: #000;
}
.lightbox .close,
.lightbox .prev,
.lightbox .next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  user-select: none;
}
.lightbox .close {
  top: 24px;
  right: 24px;
  transform: none;
}
.lightbox .prev {
  left: 24px;
}
.lightbox .next {
  right: 24px;
}

/* ===============================
   STORE & REVIEW SECTION
   =============================== */
.review-card {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  background: #fff;
}
.store-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  text-decoration: none;
  color: #0f172a;
}
.store-card:hover {
  background: #f1f5f9;
}
.store-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.store-meta {
  display: flex;
  flex-direction: column;
}
.store-badge {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

/* ===============================
   HEADER/NAV ANTI-OVERLAY
   =============================== */
.product-header,
.header-nav {
  position: relative;
  z-index: 3;
}

/* ===============================
   FORM ELEMENTS
   =============================== */
.pd-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}
.pd-select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
}
.pd-btn-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  margin-top: 12px;
}
.pd-btn-row form {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  height: 100%;
  width: auto;
}
.pd-btn-row form input[type="hidden"] {
  display: none;
}
.pd-btn-row .btn {
  flex: 1 1 auto;
  height: 100%;
  min-width: 0;
  padding: 10px 20px;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .pd-btn-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .pd-btn-row .btn {
    min-width: 140px;
    padding: 8px 16px;
  }
}
@media (max-width: 480px) {
  .pd-btn-row {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    justify-content: center;
  }
  .pd-btn-row form {
    width: 100%;
    height: auto;
  }
  .pd-btn-row .btn {
    width: 100%;
    min-width: unset;
    padding: 12px; /* Padding sedikit lebih besar untuk fokus di mobile */
    height: auto;
    box-sizing: border-box;
  }
  .pd-btn-row form {
    width: 100%; /* Pastikan form mengisi lebar penuh */
    margin: 0 0 8px 0; /* Jarak antar form */
  }
  .pd-btn-row form:last-child {
    margin-bottom: 0; /* Hapus margin bawah pada form terakhir */
  }
}

/* ===============================
   RATING & DESCRIPTION
   =============================== */
.pd-rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.pd-stars {
  color: #f59e0b;
}
.pd-desc {
  line-height: 1.6;
}

/* Main Header Adjustment */
.main-header {
  margin-bottom: 0;
  padding-bottom: 0;
}

.btn-actions {
  display: flex;
  gap: 10px; /* jarak antar tombol */
  justify-content: center; /* posisi rata tengah */
  flex-wrap: wrap; /* agar tetap responsif di layar kecil */
}

.btn-actions form {
  flex: 1; /* agar kedua tombol punya lebar sama */
}

.btn-actions button {
  width: 100%;
}
