/* ============================================================
   style.css – Mua Cho Tôi Một Ly Cà Phê · khahdihdz
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Nunito:wght@700;800;900&display=swap');

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --bg:          #0d0d0f;
  --surface:     #15151a;
  --surface2:    #1c1c24;
  --border:      rgba(255,255,255,0.07);
  --accent:      #f5a623;
  --accent2:     #ff7c4d;
  --text:        #f0ede8;
  --muted:       #7a7887;
  --green:       #3ecf8e;
  --card-radius: 18px;
}

/* ── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Be Vietnam Pro', 'Segoe UI', Tahoma, Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient glow */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 20% 10%, rgba(245,166,35,.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(255,124,77,.06) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}

/* Noise texture */
body::after {
  content: '';
  position: fixed; inset: 0;
  opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0;
}

/* ── Layout ─────────────────────────────────────────────────── */
.wrapper {
  position: relative; z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 60px 20px 80px;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeUp .6s ease both;
}

.avatar-ring {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  box-shadow: 0 0 0 4px rgba(245,166,35,.15), 0 8px 32px rgba(245,166,35,.2);
  animation: pulseRing 3s ease-in-out infinite;
}
@keyframes pulseRing {
  0%,100% { box-shadow: 0 0 0 4px rgba(245,166,35,.15), 0 8px 32px rgba(245,166,35,.2); }
  50%      { box-shadow: 0 0 0 8px rgba(245,166,35,.08), 0 8px 40px rgba(245,166,35,.3); }
}

.header h1 {
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif;
  font-size: 1.75rem; font-weight: 800; line-height: 1.2;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}
.header p {
  font-size: .92rem; color: var(--muted); line-height: 1.6;
  max-width: 360px; margin: 0 auto;
}

/* ── Section Label ──────────────────────────────────────────── */
.section-label {
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}

/* ── Coffee Buttons ─────────────────────────────────────────── */
.coffee-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 10px; margin-bottom: 14px;
  animation: fadeUp .6s .1s ease both;
}
.coffee-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px; text-align: center;
  cursor: pointer; transition: all .2s;
  color: var(--text);
}
.coffee-btn:hover { border-color: rgba(245,166,35,.4); transform: translateY(-2px); }
.coffee-btn.active {
  border-color: var(--accent);
  background: rgba(245,166,35,.08);
  box-shadow: 0 0 0 3px rgba(245,166,35,.12);
}
.coffee-btn .emoji { font-size: 1.4rem; display: block; margin-bottom: 6px; }
.coffee-btn .label {
  font-size: .72rem; color: var(--muted);
  display: block; margin-bottom: 4px; font-weight: 500;
}
.coffee-btn .price {
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif;
  font-weight: 700; font-size: .95rem; color: var(--accent);
}

/* ── Custom Amount ──────────────────────────────────────────── */
.custom-wrap { position: relative; margin-bottom: 6px; animation: fadeUp .6s .15s ease both; }
.custom-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px; padding: 13px 16px;
  color: var(--text);
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: .95rem; outline: none;
  transition: border-color .2s;
}
.custom-wrap input::placeholder { color: var(--muted); }
.custom-wrap input:focus { border-color: rgba(245,166,35,.5); }

.amount-words {
  font-size: .78rem; color: var(--accent);
  text-align: center; min-height: 20px;
  margin-bottom: 24px; opacity: .8;
}

/* ── QR Card ────────────────────────────────────────────────── */
.qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 28px 24px; text-align: center;
  margin-bottom: 14px;
  animation: fadeUp .6s .2s ease both;
  position: relative;
}
.qr-card::before {
  content: '';
  position: absolute; top: -1px; left: -1px; right: -1px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: var(--card-radius) var(--card-radius) 0 0;
}
.qr-card img {
  width: 220px; height: 220px;
  border-radius: 12px; object-fit: cover;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
  margin-bottom: 16px; transition: opacity .3s;
}
.qr-card img.loading { opacity: .5; }
.qr-amount {
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif;
  font-size: 1.4rem; font-weight: 800; color: var(--accent);
}
.qr-hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ── Bank Card ──────────────────────────────────────────────── */
.bank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 22px 24px; margin-bottom: 14px;
  animation: fadeUp .6s .25s ease both;
}
.bank-header {
  display: flex; align-items: center;
  gap: 10px; margin-bottom: 18px;
}
.bank-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .75rem;
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif; color: #fff;
  letter-spacing: -.02em;
}
.bank-name { font-family: 'Nunito', 'Be Vietnam Pro', sans-serif; font-weight: 700; font-size: 1rem; }
.bank-sub  { font-size: .76rem; color: var(--muted); }
.bank-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.bank-row:first-of-type { border-top: none; padding-top: 0; }
.bank-row-label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.bank-row-value { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 8px; }

/* ── Copy Button ────────────────────────────────────────────── */
.copy-btn {
  background: rgba(245,166,35,.12); border: none; color: var(--accent);
  width: 28px; height: 28px; border-radius: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; transition: all .2s; flex-shrink: 0;
}
.copy-btn:hover  { background: rgba(245,166,35,.22); }
.copy-btn.copied { background: rgba(62,207,142,.15); color: var(--green); }

/* ── SePay Status Banner ────────────────────────────────────── */
.payment-status {
  display: none;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  text-align: center;
  animation: fadeUp .4s ease both;
}
.payment-status.checking {
  display: block;
  background: rgba(245,166,35,.07);
  border: 1px solid rgba(245,166,35,.25);
}
.payment-status.success {
  display: block;
  background: rgba(62,207,142,.07);
  border: 1px solid rgba(62,207,142,.3);
}
.payment-status.timeout {
  display: block;
  background: rgba(245,158,11,.07);
  border: 1px solid rgba(245,158,11,.25);
}
.payment-status.error {
  display: block;
  background: rgba(248,113,113,.07);
  border: 1px solid rgba(248,113,113,.25);
}
.payment-status.failed {
  display: block;
  background: rgba(255,80,80,.07);
  border: 1px solid rgba(255,80,80,.25);
}
.payment-status .status-title {
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif; font-weight: 700; font-size: 1.05rem;
  margin-bottom: 4px;
}
.payment-status.checking .status-title { color: var(--accent); }
.payment-status.success  .status-title { color: var(--green); }
.payment-status.failed   .status-title { color: #ff6b6b; }
.payment-status.timeout  .status-title { color: #f59e0b; }
.payment-status.error    .status-title { color: #f87171; }
.payment-status .status-msg { font-size: .85rem; color: var(--muted); }

/* Spinner */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(245,166,35,.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 12px 22px;
  border-radius: 999px; font-size: .85rem; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: all .3s; z-index: 999; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(62,207,142,.3); color: var(--green); }
.toast.error   { border-color: rgba(255,80,80,.3); color: #ff6b6b; }

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  text-align: center; font-size: .78rem; color: var(--muted);
  margin-top: 40px;
  animation: fadeUp .6s .35s ease both; line-height: 1.7;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── Thank-you Overlay ──────────────────────────────────────── */
#thankYouOverlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(13,13,15,.92);
  z-index: 200;
  align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
#thankYouOverlay.active { display: flex; animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.thankyou-card {
  background: var(--surface);
  border: 1px solid rgba(62,207,142,.25);
  border-radius: 24px;
  padding: 48px 36px;
  max-width: 400px; width: calc(100% - 40px);
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(62,207,142,.1);
  animation: slideUp .5s .1s cubic-bezier(.22,.68,0,1.2) both;
  position: relative; overflow: hidden;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.thankyou-card::before {
  content: '';
  position: absolute; top: -1px; left: -1px; right: -1px; height: 2px;
  background: linear-gradient(90deg, var(--green), #4ade80, var(--green));
}
.thankyou-emoji { font-size: 4rem; display: block; margin-bottom: 16px; animation: bounceIn .6s .3s both; }
@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(.4); }
  60%  { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}
.thankyou-title {
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif;
  font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg, var(--green), #4ade80);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.thankyou-name {
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif;
  font-size: 1rem; font-weight: 700;
  color: var(--accent); margin-bottom: 16px;
}
.thankyou-msg {
  font-size: .9rem; color: var(--muted);
  line-height: 1.7; margin-bottom: 28px;
}
.thankyou-amount {
  display: inline-block;
  background: rgba(62,207,142,.1);
  border: 1px solid rgba(62,207,142,.25);
  color: var(--green);
  font-family: 'Nunito', 'Be Vietnam Pro', sans-serif; font-weight: 700; font-size: 1.1rem;
  padding: 8px 20px; border-radius: 999px;
  margin-bottom: 28px;
}
.thankyou-btn {
  background: linear-gradient(135deg, var(--green), #4ade80);
  color: #0d1f17; font-family: 'Nunito', 'Be Vietnam Pro', sans-serif;
  font-weight: 800; font-size: .95rem;
  padding: 14px 32px; border: none;
  border-radius: 12px; cursor: pointer;
  transition: opacity .2s, transform .2s;
}
.thankyou-btn:hover { opacity: .9; transform: translateY(-1px); }

/* Confetti canvas */
#confettiCanvas {
  position: fixed; inset: 0; pointer-events: none; z-index: 201;
  display: none;
}
#confettiCanvas.active { display: block; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 420px) {
  .wrapper { padding: 50px 16px 70px; }
  .coffee-grid { grid-template-columns: repeat(2,1fr); }
  .coffee-btn .emoji { font-size: 1.6rem; }
  .qr-card img { width: 190px; height: 190px; }
  .thankyou-card { padding: 36px 24px; }
}
