/* ============================================================
   mdise.iai.or.id — tema merah tua
   ============================================================ */
:root {
  --maroon-900: #450a0a;
  --maroon-800: #5c1111;
  --maroon-700: #8a1616;
  --maroon-600: #a31515;
  --maroon-500: #c02020;
  --cream-50:   #faf7f5;
  --cream-100:  #f4ecea;
  --ink-900:    #291716;
  --ink-600:    #6b5553;
  --line:       #eadcd8;
  --white:      #ffffff;
  --ok:         #15803d;
  --warn:       #b45309;
  --radius:     14px;
  --shadow-sm:  0 1px 2px rgba(69,10,10,.08);
  --shadow-md:  0 8px 24px rgba(69,10,10,.12);
  --shadow-lg:  0 20px 48px rgba(69,10,10,.18);
  --font-head:  'Poppins', system-ui, sans-serif;
  --font-body:  'Inter', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--cream-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.container { width: min(1160px, 92%); margin-inline: auto; }
.section { padding-block: 56px 24px; }
.ic { vertical-align: -0.28em; }

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px;
  padding: 10px 22px; font-weight: 600; font-size: .95rem;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--maroon-700), var(--maroon-600)); color: #fff; box-shadow: 0 4px 14px rgba(127,29,29,.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(127,29,29,.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-outline { background: transparent; color: var(--maroon-700); box-shadow: inset 0 0 0 2px var(--maroon-700); }
.btn-outline:hover { background: var(--maroon-700); color: #fff; transform: translateY(-2px); }
.btn-lg { padding: 14px 30px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px 12px; background: var(--maroon-700); color: #fff; border-radius: 11px; }
.btn-icon:hover:not(:disabled) { background: var(--maroon-500); transform: scale(1.06); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--white); color: var(--maroon-700);
  transition: background .15s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--cream-100); transform: scale(1.05); }
.icon-btn.danger { color: var(--maroon-500); }
.btn-ghost-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: .9rem; font-weight: 600; color: var(--maroon-700); }
.btn-ghost-link:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(250,247,245,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  animation: slideDown .5s ease both;
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.header-inner { display: flex; align-items: center; gap: 28px; height: 66px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  display: block; flex-shrink: 0;
  height: 42px; width: auto;
}
.brand-divider { width: 1px; height: 30px; background: var(--line); flex-shrink: 0; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--maroon-700), var(--maroon-900));
  color: #fff; box-shadow: var(--shadow-md);
}
.brand-text { font-family: var(--font-head); font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.brand-text small { font-size: .68rem; font-weight: 500; color: var(--ink-600); margin-left: 4px; letter-spacing: 0; }
.brand-accent { color: var(--maroon-500); }
.main-nav { display: flex; gap: 26px; margin-left: auto; }
.main-nav a { font-weight: 600; font-size: .93rem; position: relative; padding: 6px 0; }
.main-nav a::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
  background: var(--maroon-600); border-radius: 2px; transition: width .25s ease;
}
.main-nav a:hover::after { width: 100%; }
.btn-cart-toggle { position: relative; }
.cart-badge {
  min-width: 21px; height: 21px; padding: 0 5px;
  display: inline-grid; place-items: center;
  background: var(--cream-50); color: var(--maroon-700);
  border-radius: 999px; font-size: .75rem; font-weight: 700;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.cart-badge.bump { transform: scale(1.45); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(185,28,28,.25), transparent 60%),
    linear-gradient(160deg, var(--maroon-900) 0%, var(--maroon-800) 55%, var(--maroon-700) 100%);
  color: #fff; padding: 96px 0 88px;
}
.hero-blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35;
  animation: blobFloat 12s ease-in-out infinite alternate;
}
.hero-blob-1 { width: 420px; height: 420px; background: #b91c1c; top: -140px; right: -80px; }
.hero-blob-2 { width: 320px; height: 320px; background: #ef4444; bottom: -160px; left: -60px; animation-delay: -6s; }
@keyframes blobFloat { from { transform: translate(0,0) scale(1); } to { transform: translate(-40px, 30px) scale(1.15); } }
.hero-inner { position: relative; z-index: 1; max-width: 720px; }
.hero-eyebrow {
  display: inline-block; font-size: .82rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: #fecaca; border: 1px solid rgba(254,202,202,.4); border-radius: 999px; padding: 6px 16px;
  margin-bottom: 20px; animation: fadeUp .7s ease both;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: -.02em; animation: fadeUp .7s .1s ease both; }
.grad-text { background: linear-gradient(90deg, #fecaca, #fca5a5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { margin-top: 16px; font-size: 1.06rem; color: #fee2e2; max-width: 54ch; animation: fadeUp .7s .2s ease both; }
.hero-search {
  display: flex; align-items: center; gap: 10px; margin-top: 30px; max-width: 520px;
  background: rgba(255,255,255,.97); border-radius: 999px; padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow-lg); animation: fadeUp .7s .3s ease both;
}
.search-ic { color: var(--maroon-700); flex-shrink: 0; }
.hero-search input { flex: 1; border: none; outline: none; font: inherit; color: var(--ink-900); background: transparent; min-width: 0; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 26px; font-size: .9rem; font-weight: 500; color: #fecaca; animation: fadeUp .7s .4s ease both; }
.hero-badges span { display: inline-flex; align-items: center; gap: 7px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Chip kategori & pencarian ---------- */
.result-note { margin-top: 26px; color: var(--ink-600); }
.result-note a { color: var(--maroon-700); font-weight: 600; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 30px; }
.chip {
  padding: 8px 20px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  background: var(--white); border: 1px solid var(--line); color: var(--ink-600);
  transition: all .2s ease;
}
.chip:hover { border-color: var(--maroon-600); color: var(--maroon-700); transform: translateY(-1px); }
.chip.active { background: var(--maroon-700); border-color: var(--maroon-700); color: #fff; box-shadow: 0 4px 12px rgba(127,29,29,.3); }

/* ---------- Grid produk ---------- */
.section-title { font-size: 1.65rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 26px; position: relative; padding-left: 16px; }
.section-title::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 5px; border-radius: 4px; background: linear-gradient(var(--maroon-600), var(--maroon-900)); }
.section-title-sm { font-family: var(--font-head); font-size: 1.2rem; margin-bottom: 12px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.product-card {
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  transition: transform .28s ease, box-shadow .28s ease;
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.reveal { opacity: 0; transform: translateY(18px); animation: revealIn .6s ease forwards; animation-delay: var(--d, 0ms); }
@keyframes revealIn { to { opacity: 1; transform: translateY(0); } }
.card-media { position: relative; display: block; aspect-ratio: 1/1; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.product-card:hover .card-media img { transform: scale(1.06); }
.stock-out, .stock-low {
  position: absolute; top: 10px; left: 10px; padding: 4px 12px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
}
.stock-out { background: var(--ink-900); color: #fff; }
.stock-low { background: #fef3c7; color: var(--warn); }
.card-body { padding: 15px 17px 17px; }
.card-cat { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--maroon-500); }
.card-title { font-size: 1rem; font-weight: 600; margin: 5px 0 12px; min-height: 2.5em; }
.card-title a:hover { color: var(--maroon-700); }
.card-foot { display: flex; align-items: center; justify-content: space-between; }
.price { font-family: var(--font-head); font-weight: 700; color: var(--maroon-700); }
.price-lg { font-size: 1.7rem; margin: 10px 0 6px; }

.empty-state {
  text-align: center; padding: 70px 20px; color: var(--ink-600);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.empty-state .ic { color: #d8c2bd; }

/* ---------- Cara beli ---------- */
.how-section { padding-bottom: 60px; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.how-card {
  position: relative; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 22px 22px; box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease;
}
.how-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.how-num {
  position: absolute; top: 18px; right: 20px; font-family: var(--font-head);
  font-size: 1.9rem; font-weight: 800; color: var(--cream-100);
}
.how-ic { color: var(--maroon-700); background: var(--cream-100); padding: 10px; border-radius: 12px; }
.how-card h3 { font-size: 1.02rem; margin: 14px 0 8px; }
.how-card p { font-size: .9rem; color: var(--ink-600); }

/* ---------- Drawer keranjang ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(41,23,22,.5); backdrop-filter: blur(2px);
  animation: fadeIn .25s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
  width: min(400px, 94vw); background: var(--white);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: drawerIn .32s cubic-bezier(.32,.72,.36,1) both;
}
@keyframes drawerIn { from { transform: translateX(105%); } to { transform: translateX(0); } }
.cart-drawer.closing { animation: drawerOut .25s ease both; }
@keyframes drawerOut { from { transform: translateX(0); } to { transform: translateX(105%); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; color: var(--maroon-700); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.drawer-foot { padding: 16px 20px; border-top: 1px solid var(--line); }
.subtotal-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; font-size: .95rem; }
.subtotal-row strong { font-family: var(--font-head); color: var(--maroon-700); font-size: 1.1rem; }
.total-row { border-top: 2px dashed var(--line); padding-top: 10px; margin-top: 6px; }
.mini-cart-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); animation: fadeUp .3s ease both; }
.mini-cart-row img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.mini-cart-info { flex: 1; min-width: 0; }
.mini-cart-info h4 { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-cart-info span { font-size: .78rem; color: var(--ink-600); }
.mini-cart-price { font-weight: 700; color: var(--maroon-700); font-size: .86rem; }
.empty-note { color: var(--ink-600); text-align: center; padding: 40px 0; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--maroon-900); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.34,1.4,.64,1) both;
}
.toast.err { background: #7c2d12; }
.toast.out { animation: toastOut .3s ease both; }
.toast .ic { color: #fca5a5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Halaman produk detail ---------- */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-600); padding-top: 26px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--maroon-700); }
.product-page { padding-bottom: 60px; }
.product-detail {
  display: grid; grid-template-columns: minmax(280px, 480px) 1fr;
  gap: 46px; margin-top: 26px; align-items: start;
}
.detail-media {
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md);
  aspect-ratio: 1/1; background: var(--white); border: 1px solid var(--line);
}
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-info h1 { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.01em; }
.stock-note { display: inline-flex; align-items: center; gap: 6px; font-size: .87rem; color: var(--ok); background: #f0fdf4; border: 1px solid #bbf7d0; padding: 5px 13px; border-radius: 999px; }
.qty-row { display: flex; align-items: center; gap: 14px; margin: 20px 0 22px; }
.qty-row label { font-weight: 600; font-size: .92rem; }
.qty-stepper {
  display: inline-flex; align-items: center; border: 1.5px solid var(--line);
  border-radius: 999px; overflow: hidden; background: var(--white);
}
.qty-stepper button {
  width: 34px; height: 34px; border: none; background: transparent; color: var(--maroon-700);
  display: grid; place-items: center; transition: background .15s;
}
.qty-stepper button:hover:not(:disabled) { background: var(--cream-100); }
.qty-stepper button:disabled { color: #ccc; cursor: not-allowed; }
.qty-stepper input {
  width: 44px; text-align: center; border: none; font: inherit; font-weight: 600;
  color: var(--ink-900); background: transparent; -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.detail-info .btn-block { margin-bottom: 10px; }
.detail-desc p { color: var(--ink-600); max-width: 72ch; }

/* ---------- Keranjang & checkout ---------- */
.page-title { font-size: 1.7rem; letter-spacing: -.01em; }
.page-sub { color: var(--ink-600); margin: 6px 0 26px; }
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 26px; margin-top: 24px; align-items: start; }
.cart-list { display: flex; flex-direction: column; gap: 14px; }
.cart-row {
  display: grid; grid-template-columns: 74px 1fr auto; gap: 16px; align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow-sm);
}
.cart-row img { width: 74px; height: 74px; border-radius: 11px; object-fit: cover; }
.cart-info h3 { font-size: .98rem; }
.cart-info h3 a:hover { color: var(--maroon-700); }
.cart-actions { display: flex; align-items: center; gap: 12px; }
.cart-summary {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); position: sticky; top: 90px;
}
.cart-summary h2 { font-size: 1.15rem; margin-bottom: 14px; }
.muted-small { font-size: .8rem; color: var(--ink-600); margin: 10px 0; }
.checkout-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow-sm);
}
.form-group { margin-bottom: 22px; }
.form-group label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 8px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .input-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--maroon-500); pointer-events: none; }
.input-icon-wrap input {
  width: 100%; padding: 12px 16px 12px 44px; border: 1.5px solid var(--line); border-radius: 12px;
  font: inherit; outline: none; transition: border-color .2s, box-shadow .2s; background: var(--cream-50);
}
.input-icon-wrap input:focus { border-color: var(--maroon-600); box-shadow: 0 0 0 4px rgba(153,27,27,.12); background: #fff; }
.member-result { margin-top: 9px; font-size: .88rem; min-height: 1.4em; }
.member-result.ok { color: var(--ok); }
.member-result.bad { color: var(--maroon-500); }
.member-result.loading { color: var(--ink-600); }
.form-error { color: var(--maroon-500); font-size: .88rem; margin-top: 12px; font-weight: 500; }
.spinner {
  display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; vertical-align: -.25em;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#checkoutBtn.loading { opacity: .75; pointer-events: none; }

/* ---------- Pembayaran ---------- */
.payment-page { padding-bottom: 70px; }
.payment-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-md); padding: 34px; max-width: 900px; margin-inline: auto;
}
.payment-head h1 { font-size: 1.5rem; margin-bottom: 6px; }
.order-code { font-family: monospace; font-size: 1.02em; color: var(--maroon-700); }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 6px 16px; border-radius: 999px; font-size: .84rem; font-weight: 700;
}
.status-pill.warn { background: #fef3c7; color: var(--warn); }
.status-pill.ok { background: #dcfce7; color: var(--ok); }
.status-pill.bad { background: #fee2e2; color: var(--maroon-600); }
.payment-grid { display: grid; grid-template-columns: 1fr 320px; gap: 30px; margin-top: 26px; align-items: start; }
.qris-box h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin-bottom: 14px; color: var(--maroon-700); }
.qris-frame {
  width: min(260px, 100%); padding: 12px; background: #fff;
  border: 2px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.qr-note { font-size: .83rem; color: var(--ink-600); margin-top: 10px; }
.pay-steps { margin: 14px 0 0 18px; font-size: .88rem; color: var(--ink-600); display: grid; gap: 5px; }
.paid-box { text-align: center; padding: 40px 0; color: var(--ok); }
.paid-box h2 { justify-content: center; color: var(--ok); }
.payment-foot { margin-top: 28px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--maroon-900); color: #e7c8c8; margin-top: 60px; }
.footer-inner { display: flex; justify-content: space-between; gap: 40px; padding: 44px 0 30px; flex-wrap: wrap; }
.footer-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.footer-brand .brand-logo { border-radius: 10px; }
.footer-brand .brand-text { color: #fff; }
.footer-brand .brand-text small { color: #d8a5a5; }
.footer-brand p { font-size: .88rem; margin-top: 10px; line-height: 1.7; }
.footer-links { display: flex; flex-direction: column; gap: 9px; font-size: .9rem; }
.footer-links a:hover { color: #fff; }
.footer-copy { padding: 16px 0 26px; border-top: 1px solid rgba(231,200,200,.18); font-size: .8rem; }

/* ---------- Responsif ---------- */
@media (max-width: 900px) {
  .cart-layout, .payment-grid { grid-template-columns: 1fr; }
  .product-detail { grid-template-columns: 1fr; gap: 26px; }
  .cart-summary { position: static; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .main-nav { display: none; }
  .hero { padding: 66px 0 60px; }
  .cart-row { grid-template-columns: 60px 1fr; }
  .cart-actions { grid-column: 1 / -1; justify-content: space-between; }
  .cart-row img { width: 60px; height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
