/* =========================================================
   components.css - Reusable UI components
   Cleaned & Refactored (NO visual changes)
   
   Section Organization:
   - Button base styles (primary, WhatsApp)
   - Navigation toggle button
   - Card types (generic, product, mobile grid)
   - Product grid layout
   - Badge components
   - Modal dialog & interactions
   - Form components & inputs
   - Hero icons & utilities
   - Dark mode theme overrides
   - Responsive breakpoints
   ========================================================= */


/* ================= BUTTON BASE STYLES ================= */

.btn-primary,
.btn-wa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), background var(--transition);
}


/* ================= PRIMARY BUTTON ================= */

.btn-primary {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  opacity: 0.98;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary:focus-visible {
  outline: 3px solid var(--primary-soft);
  outline-offset: 2px;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}


/* ================= WHATSAPP BUTTON ================= */

.btn-wa {
  min-width: 44px;
  padding: 0.6rem 1rem;
  background: var(--whatsapp);
  color: var(--text-light);
  font-weight: 700;
  text-decoration: none;
}

.btn-wa:hover {
  background: var(--whatsapp-dark);
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.btn-wa:active {
  transform: translateY(0) scale(1);
}

.btn-wa:focus-visible {
  outline: 3px solid rgba(0, 0, 0, 0.12);
  outline-offset: 3px;
}


/* ================= NAV TOGGLE ================= */

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 2px solid var(--text-dark);
  border-radius: var(--radius);
  color: var(--text-dark);
  font-size: 1.5rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.nav-toggle:hover {
  background: var(--bg-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.nav-toggle:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.nav-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-light);
}


/* ================= BASE CARD ================= */

.card,
.product-card,
.produk-card {
  background: var(--bg-light);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}


/* ================= CARD ================= */

.card {
  box-shadow: var(--shadow-sm);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}


/* ================= PRODUCT CARD (DESKTOP) ================= */

.product-card {
  display: flex;
  flex-direction: column;
  min-height: 340px;
  border-radius: calc(var(--radius) * 1.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.07);
}

.product-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--radius) * 0.85);
}

.product-card .content {
  padding: var(--spacing-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.product-card .harga {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.product-card .kategori {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-top: auto;
}


/* ================= PRODUCT CARD (MOBILE GRID) ================= */

.produk-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  border-radius: 12px;
  color: var(--text-dark);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.produk-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.produk-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 6px;
  display: block;
}

.produk-card h4 {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.produk-card .harga {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
}

.produk-card p {
  font-size: 0.65rem;
  opacity: 0.75;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  line-clamp: 1;
  -webkit-line-clamp: 1;
}

/* ================= PRODUCT GRID ================= */

.produk-grid {
  display: grid;
  width: 100%;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  /* Mobile-first: 3 columns fixed for small screens */
}


/* ================= BADGE ================= */

.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-dark);
}

.badge--primary {
  background: var(--primary);
  color: var(--text-light);
}


/* ================= MODAL ================= */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.65);
  align-items: center;
  justify-content: center;
  padding: 16px;
  scroll-behavior: smooth;
}

.modal.is-open {
  display: flex;
}

body.modal-open {
  overflow: hidden;
}

@keyframes modalFade {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-content {
  position: relative;
  width: min(100%, 420px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-light);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: modalFade var(--transition);
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.modal-content img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-md);
}

.modal-actions {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  margin-top: var(--spacing-md);
}

.close {
  position: sticky;
  top: 0;
  right: 0;
  z-index: 10;
  margin-left: auto;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.close:hover {
  color: var(--primary);
}

.harga-modal {
  font-weight: 700;
  margin: 0.8rem 0;
  color: var(--primary);
}

.modal-benefit {
  margin: 1rem 0;
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

/* Modal button context */
.modal-content .btn-wa {
  position: sticky;
  bottom: 0;
  width: 100%;
  margin-top: 20px;
  padding: 12px 16px;
  box-sizing: border-box;
}


/* ================= FORMS ================= */

.input-field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.input-field__label {
  font-size: 0.95rem;
  font-weight: 500;
}

.input-field__input,
.input-field__textarea,
.input-field__select {
  padding: 0.75rem 1rem;
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-field__input:focus,
.input-field__textarea:focus,
.input-field__select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(78, 52, 46, 0.1);
}


/* ================= HERO ICON ================= */

.hero-icons {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: var(--spacing-lg) 0 var(--spacing-xl);
}

.hero-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  min-width: 70px;
}

.hero-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.hero-icon span {
  font-size: 13px;
  line-height: 1.2;
}


/* ================= DARK MODE ================= */

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .product-card,
:root[data-theme="dark"] .modal-content {
  background: var(--bg-light);
}

:root[data-theme="dark"] .badge {
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .input-field__input,
:root[data-theme="dark"] .input-field__textarea,
:root[data-theme="dark"] .input-field__select {
  border-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .hero-icon img {
  filter: brightness(0) invert(1);
}

:root[data-theme="dark"] .produk-card {
  background: #1f1f1f;
  color: #ffffff;
}

:root[data-theme="light"] .hero-icon img {
  filter: none;
}


/* ================= RESPONSIVE MODAL ================= */

@media (min-width: var(--bp-md)) {
  /* Modal Tablet */
  .modal-content {
    width: min(100%, 500px);
  }
}

@media (min-width: var(--bp-lg)) {
  /* Modal Desktop */
  .modal-content {
    width: min(100%, 600px);
  }
}
