* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --red: #dc2626;
  --red-dark: #b91c1c;
  --red-soft: #fee2e2;
  --accent: #f59e0b;
  --bg: #f6f8f7;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
}

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
.container { width: 100%; max-width: 1150px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }

/* ===== LOGIN / DAFTAR ===== */
.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(135deg, #dcfce7 0%, #fff 50%, #fee2e2 100%);
}
.auth-box { background: #fff; width: 100%; max-width: 420px; border-radius: 18px; padding: 26px; box-shadow: 0 10px 40px rgba(0,0,0,.12); border-top: 5px solid var(--red); }
.auth-logo { text-align: center; font-size: 1.8rem; font-weight: 800; }
.auth-logo .g { color: var(--primary); }
.auth-logo .r { color: var(--red); }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 16px; font-size: .95rem; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #f1f5f3; border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.tab { border: 0; background: none; padding: 9px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: .95rem; }
.tab.active { background: var(--primary); color: #fff; }
.auth form label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 10px; }
.photo-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.photo-pick img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); }
.photo-btn { margin: 0 !important; font-size: .85rem !important; padding: 8px 14px; cursor: pointer; }

/* ===== HEADER ===== */
.header { background: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 8px rgba(0,0,0,.06); border-top: 4px solid var(--red); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 62px; gap: 10px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 1.4rem; font-weight: 700; text-decoration: none; color: var(--primary); }
.logo span { color: var(--red); }
.cart-btn { background: var(--primary); color: #fff; border: 0; padding: 9px 16px; border-radius: 30px; cursor: pointer; font-weight: 600; font-size: .95rem; }
.badge { background: var(--red); color: #fff; border-radius: 50%; padding: 1px 8px; margin-left: 4px; font-size: .8rem; }

/* AKUN */
.account { position: relative; }
.acc-btn { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 30px; padding: 4px 12px 4px 4px; cursor: pointer; font-size: .9rem; font-weight: 600; }
.acc-btn img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.acc-btn span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-menu { position: absolute; right: 0; top: 48px; width: 250px; background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 8px; z-index: 60; }
.acc-info { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.acc-info img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.acc-info strong { display: block; font-size: .95rem; word-break: break-word; }
.acc-info small { color: var(--muted); font-size: .8rem; word-break: break-all; }
.acc-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px; border-radius: 8px; cursor: pointer; font-size: .95rem; }
.acc-menu button:hover { background: #f1f5f3; }
.acc-menu button.danger { color: var(--red); font-weight: 600; }
.acc-menu button.danger:hover { background: var(--red-soft); }

/* ===== HERO ===== */
.hero { background: linear-gradient(135deg, #dcfce7 0%, #fef9c3 55%, #fee2e2 100%); padding: 36px 0; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; }
.hero h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 10px; }
.hero p { color: var(--muted); }
.hero-img { border-radius: 16px; width: 100%; height: 240px; object-fit: cover; box-shadow: 0 8px 24px rgba(0,0,0,.12); }

/* ===== BUTTONS ===== */
.btn { display: inline-block; padding: 11px 20px; border-radius: 10px; border: 0; cursor: pointer; font-weight: 600; font-size: 1rem; text-decoration: none; text-align: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #eef2f0; color: var(--text); margin-top: 8px; }
.full { width: 100%; }

/* ===== PRODUK ===== */
.section-title { margin: 28px 0 12px; font-size: 1.5rem; border-left: 5px solid var(--red); padding-left: 10px; }
.search-box input {
  width: 100%; padding: 13px 18px; border: 2px solid var(--border); border-radius: 30px; font-size: 1rem; font-family: inherit; background: #fff;
}
.search-box input:focus { outline: none; border-color: var(--primary); }
.no-result { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 0; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin: 16px 0 40px; }
.card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.06); display: flex; flex-direction: column; transition: transform .2s; }
.card:hover { transform: translateY(-4px); }
.card img { width: 100%; height: 150px; object-fit: cover; background: #e5e7eb; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cat { font-size: .75rem; color: var(--primary); font-weight: 600; text-transform: uppercase; }
.card h4 { font-size: 1rem; }
.unit { color: var(--muted); font-size: .85rem; }
.price { font-weight: 700; font-size: 1.1rem; margin-top: auto; color: var(--red); }
.add-btn { margin-top: 8px; background: var(--primary); color: #fff; border: 0; padding: 9px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.add-btn:hover { background: var(--primary-dark); }

/* ===== OVERLAY & CART ===== */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: .25s; z-index: 30; }
.overlay.show { opacity: 1; pointer-events: auto; }

.cart { position: fixed; top: 0; right: -420px; width: 400px; max-width: 100%; height: 100%; background: #fff; z-index: 40; display: flex; flex-direction: column; transition: right .3s; box-shadow: -4px 0 20px rgba(0,0,0,.15); }
.cart.open { right: 0; }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 3px solid var(--red); }
.close { background: none; border: 0; font-size: 1.8rem; cursor: pointer; line-height: 1; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; }
.empty { text-align: center; color: var(--muted); margin-top: 40px; }
.cart-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.cart-item h5 { font-size: .95rem; }
.cart-item small { color: var(--red); font-weight: 600; }
.qty { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.qty button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.remove { background: var(--red-soft); border: 0; color: var(--red); cursor: pointer; font-size: .85rem; padding: 5px 10px; border-radius: 6px; font-weight: 600; }
.cart-foot { padding: 16px; border-top: 1px solid var(--border); }
.total-row { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 1.05rem; }
.total-row strong { color: var(--red); }
.total-row.big { margin-top: 14px; font-size: 1.15rem; }

/* ===== MODAL ===== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: none; align-items: center; justify-content: center; padding: 12px; }
.modal.show { display: flex; }
.modal-box { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; padding: 22px; position: relative; }
.modal-close { position: absolute; top: 10px; right: 14px; }
.modal h3 { margin-bottom: 12px; }
.modal h4 { margin: 16px 0 8px; }

form label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 10px; }
input[type="text"], input[type="tel"], input[type="email"], input[type="password"], textarea {
  width: 100%; margin-top: 4px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; font-family: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pay-group { margin-bottom: 10px; }
.pay-title { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; margin-bottom: 6px; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pay-option { display: flex !important; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 500 !important; margin: 0 !important; }
.pay-option:has(input:checked) { border-color: var(--primary); background: #f0fdf4; }
.error { color: var(--red); font-size: .9rem; min-height: 18px; margin-bottom: 6px; }

.pay-info { background: #f0fdf4; border: 1px dashed var(--primary); border-radius: 12px; padding: 16px; margin-bottom: 14px; text-align: center; }
.pay-info .big-num { font-size: 1.4rem; font-weight: 700; letter-spacing: 1px; margin: 6px 0; word-break: break-all; }
.pay-info img { margin: 10px auto; width: 190px; height: 190px; border-radius: 8px; }

/* ===== SUKSES ===== */
.success { text-align: center; }
.success-img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; margin: 0 auto 8px; }
.check { width: 56px; height: 56px; background: var(--primary); color: #fff; border-radius: 50%; font-size: 1.8rem; display: flex; align-items: center; justify-content: center; margin: -34px auto 10px; position: relative; border: 4px solid #fff; }
.summary { text-align: left; background: #f9fafb; border-radius: 12px; padding: 14px; margin: 14px 0; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.summary div:last-child { border: 0; }
.summary span { color: var(--muted); }
.summary strong { text-align: right; }
.eta { background: var(--red-soft); border-radius: 8px; padding: 8px !important; margin-top: 6px; }

.footer { text-align: center; padding: 20px; color: var(--muted); font-size: .9rem; background: #fff; border-top: 4px solid var(--red); }

/* ===== TABLET ===== */
@media (max-width: 900px) {
  .hero h1 { font-size: 1.7rem; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ===== HP ===== */
@media (max-width: 640px) {
  .logo { font-size: 1.15rem; }
  .cart-btn { padding: 8px 12px; font-size: .85rem; }
  .acc-btn { padding: 3px; }
  .acc-btn span { display: none; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-img { height: 180px; order: -1; }
  .hero h1 { font-size: 1.4rem; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card img { height: 110px; }
  .form-grid { grid-template-columns: 1fr; }
  .cart { width: 100%; }
  .modal-box { padding: 16px; }
  .auth-box { padding: 20px; }
}

/* ===== LOADING ===== */
.loading { position: fixed; inset: 0; background: #fff; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.spinner { width: 42px; height: 42px; border: 4px solid var(--red-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ===== RIWAYAT PESANAN ===== */
.hist-card { border: 1px solid var(--border); border-left: 5px solid var(--primary); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.hist-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist-id { font-weight: 700; }
.hist-date { color: var(--muted); font-size: .82rem; }
.status { background: #dcfce7; color: var(--primary-dark); font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.hist-items { list-style: none; margin: 8px 0; font-size: .9rem; }
.hist-items li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.hist-meta { font-size: .85rem; color: var(--muted); }
.hist-meta strong { color: var(--text); }
.hist-total { display: flex; justify-content: space-between; margin-top: 8px; font-weight: 700; }
.hist-total span:last-child { color: var(--red); }
.hist-eta { background: var(--red-soft); border-radius: 8px; padding: 6px 10px; margin-top: 8px; font-size: .85rem; }
.hist-empty { text-align: center; color: var(--muted); padding: 30px 0; }