/* ═══════════════════════════════════════════════════════════
   BestA Mall — Application Stylesheet
   ═══════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  --primary-dark:  #5C0B18;
  --primary-main:  #8B1A2C;
  --primary-light: #B44A5E;
  --accent:        #C17F8C;
  --accent-light:  #E8C4CC;
  --bg:            #fdf5f6;
  --card:          #ffffff;
  --text:          #1A1A1A;
  --muted:         #4A4A4A;
  --border:        #e8d0d4;
  --success:       #2d6a4f;
  --success-bg:    #d8f3dc;
  --error:         #c62828;
  --error-bg:      #ffebee;
  --warn:          #b45309;
  --warn-bg:       #fef3c7;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── SITE HEADER ────────────────────────────────────────────── */
.site-header {
  background: var(--primary-main);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.logo               { display: flex; align-items: center; gap: 10px; }
.logo img           { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.logo-text strong   { display: block; font-size: 0.95rem; font-weight: 800; }
.logo-text span     { font-size: 0.7rem; opacity: 0.8; }

.header-right   { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-name      { font-size: 0.8rem; opacity: 0.9; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-lang {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,0.45);
  background: transparent;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-lang.active { background: rgba(255,255,255,0.22); }

.btn-signout {
  padding: 6px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,0.45);
  background: transparent;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-signout:hover { background: rgba(255,255,255,0.15); }

/* ── AUTH PAGE ──────────────────────────────────────────────── */
#page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(92,11,24,0.12);
  border-top: 4px solid var(--primary-main);
}

.login-logo             { text-align: center; margin-bottom: 24px; }
.login-logo img         { width: 72px; height: 72px; border-radius: 16px; }
.login-logo h2          { font-size: 1.4rem; font-weight: 800; color: var(--primary-dark); margin-top: 10px; }
.login-logo p           { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

/* Auth action button row — [secondary] [primary] side by side */
.auth-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.auth-btn-row .btn-primary,
.auth-btn-row .btn-secondary { flex: 1; }

.btn-secondary {
  padding: 13px;
  background: transparent;
  color: var(--primary-main);
  border: 2px solid var(--primary-main);
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-secondary:hover { background: var(--accent-light); }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Verify email page ───────────────────────────────────────── */
#page-verify {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px 16px;
}
.verify-icon {
  text-align: center;
  margin: 8px 0 16px;
}
.verify-body {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 4px;
}
.verify-email-addr {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
  word-break: break-all;
  margin-bottom: 12px;
}
.verify-hint {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  white-space: pre-line;
  line-height: 1.5;
  margin-bottom: 4px;
}
.btn-text-link {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--primary-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  padding: 6px;
  text-decoration: underline;
}
.btn-text-link:hover { color: var(--primary-dark); }

/* Form fields */
.form-group               { margin-bottom: 15px; }
.form-group label         { display: block; font-size: 0.83rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  background: #fafafa;
}
.form-group input:focus   { border-color: var(--primary-main); background: #fff; }

/* Password strength bar */
.pw-strength {
  height: 4px;
  border-radius: 4px;
  margin-top: 6px;
  background: var(--border);
  overflow: hidden;
}
.pw-strength-bar {
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

/* Shared error message */
.err-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
  background: var(--error-bg);
  color: var(--error);
  display: none;
}

/* Primary button */
.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--primary-main);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover    { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Auth footer notes */
.auth-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 14px;
  text-align: center;
}
.auth-link {
  color: var(--primary-main);
  text-decoration: none;
  font-weight: 600;
}
.auth-link:hover { text-decoration: underline; }
.btn-text-link {
  background: none;
  border: none;
  color: var(--primary-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── DASHBOARD ──────────────────────────────────────────────── */
#page-dashboard { display: none; }

.nav-tabs {
  display: flex;
  gap: 6px;
  background: var(--card);
  padding: 12px 16px;
  border-bottom: 2px solid var(--accent-light);
  flex-wrap: wrap;
}
.nav-tab {
  padding: 8px 18px;
  border-radius: 20px;
  border: 2px solid var(--primary-main);
  background: transparent;
  color: var(--primary-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-tab.active,
.nav-tab:hover { background: var(--primary-main); color: #fff; }

.tab-content {
  max-width: 680px;
  margin: 24px auto;
  padding: 0 16px 80px;
}
.tab-pane         { display: none; }
.tab-pane.active  { display: block; }

/* ── ITEM CARDS ─────────────────────────────────────────────── */
.item-card {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 2px 10px rgba(92,11,24,0.05);
}
.item-num {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-main);
  color: #fff;
  font-weight: 800;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.item-info  { flex: 1; min-width: 0; }
.item-title { font-weight: 700; font-size: 0.9rem; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.item-price { font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }

/* Class card — full-width image at top, body below */
.cls-card {
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.cls-poster-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #111;
  border-radius: 0;
  flex-shrink: 0;
}
.cls-card-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
}
.cls-card .item-num { margin-top: 2px; flex-shrink: 0; }
.cls-card .item-info { flex: 1; min-width: 0; }

/* WhatsApp hint + action row */
.wa-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 10px;
  font-style: italic;
}
.cls-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--primary-main);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-wa:hover { background: var(--primary-dark); }

.badge-owned {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: #fff;
  font-size: 0.77rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
}
.badge-soon {
  display: inline-flex;
  align-items: center;
  background: #e8e8e8;
  color: #888;
  font-size: 0.77rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  font-style: italic;
}
.btn-buy {
  padding: 7px 16px;
  background: var(--primary-main);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-buy:hover { background: var(--primary-dark); }

/* ── BUY MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 520px;
  padding: 28px 24px 40px;
  max-height: 92vh;
  overflow-y: auto;
}
.modal-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.modal-title  { font-size: 1rem; font-weight: 800; color: var(--primary-dark); line-height: 1.4; }
.modal-close  { background: none; border: none; font-size: 1.5rem; color: var(--muted); cursor: pointer; flex-shrink: 0; padding: 0; line-height: 1; }

.price-box {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.price-label              { font-size: 0.78rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.price-amount             { font-size: 1.5rem; font-weight: 800; color: var(--primary-dark); }
.price-amount.free-color  { color: var(--primary-dark); }
.price-original           { font-size: 0.83rem; color: var(--muted); text-decoration: line-through; margin-top: 2px; }

.field-label  { font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; display: block; }
.field-input  { width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 0.9rem; outline: none; margin-bottom: 14px; }
.field-input:focus  { border-color: var(--primary-main); }
.field-select { width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 0.9rem; background: #fff; margin-bottom: 14px; outline: none; }

.voucher-row              { display: flex; gap: 8px; margin-bottom: 6px; }
.voucher-row .field-input { margin-bottom: 0; flex: 1; }

.btn-apply {
  padding: 10px 16px;
  background: var(--primary-light);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.btn-apply:hover    { background: var(--primary-main); }
.btn-apply:disabled { opacity: 0.5; cursor: not-allowed; }

.v-msg          { font-size: 0.82rem; font-weight: 600; margin-bottom: 10px; min-height: 18px; }
.v-msg.ok       { color: var(--primary-main); }
.v-msg.err      { color: var(--error); }

.suggestions  { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sug-chip {
  padding: 4px 12px;
  border: 1.5px solid var(--primary-main);
  border-radius: 8px;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--primary-main);
  cursor: pointer;
  background: #fff;
  transition: background 0.15s;
}
.sug-chip:hover { background: var(--accent-light); }

.modal-err {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
  background: var(--error-bg);
  color: var(--error);
  display: none;
}

/* ── VOUCHER TAB ────────────────────────────────────────────── */
.claim-box {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1.5px solid var(--border);
}
.section-title  { font-size: 0.88rem; font-weight: 700; color: var(--muted); margin-bottom: 12px; }

.v-card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.v-code { font-size: 0.95rem; font-weight: 700; color: var(--primary-dark); letter-spacing: 0.3px; }
.v-scope{ font-size: 0.77rem; color: var(--muted); margin-top: 2px; }

.badge            { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 0.73rem; font-weight: 700; }
.badge-claimed    { background: var(--primary-light); color: #ffffff; }
.badge-redeemed   { background: var(--success-bg); color: var(--success); }

/* ── PAYMENT HISTORY ────────────────────────────────────────── */
.receipt {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1.5px solid var(--border);
}
.receipt-name           { font-weight: 700; font-size: 0.9rem; margin-bottom: 10px; color: var(--text); }
.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 5px 0;
  border-bottom: 1px solid #f0e6e8;
}
.receipt-row:last-child { border-bottom: none; font-weight: 700; }
.receipt-amount         { font-weight: 800; color: var(--primary-dark); font-size: 0.95rem; }
.receipt-free           { color: var(--primary-dark); font-weight: 700; }
.receipt-ok             { color: var(--primary-dark); font-weight: 700; }

/* ── LOADING OVERLAY ────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.88);
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.overlay.show { display: flex; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--accent-light);
  border-top-color: var(--primary-main);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.overlay-msg { font-size: 0.9rem; font-weight: 600; color: var(--primary-dark); }

/* ── TOAST NOTIFICATION ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 300;
  display: none;
  max-width: 92vw;
  text-align: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.toast.show   { display: block; animation: fadeup 0.25s ease; }
.toast.t-ok   { background: var(--success); }
.toast.t-err  { background: var(--error); }
.toast.t-info { background: var(--primary-dark); }

@keyframes fadeup {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 0.88rem; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .login-card { padding: 28px 18px; }
  .item-card  { flex-direction: column; }
  .modal      { padding: 24px 18px 36px; }
  .nav-tab    { padding: 7px 12px; font-size: 0.77rem; }
}
