/* ====================================================================
   Đấu Giá Ngược — mobile-first webapp styling (pure CSS, no framework)
   Palette: deep navy base + behaviour-driving Red / Amber / Green accents.
   ==================================================================== */
:root {
  --bg: #0b0f1a;
  --bg-2: #121829;
  --card: #182033;
  --card-2: #1f2940;
  --line: #283450;
  --text: #eef2ff;
  --muted: #8a96b5;
  --red: #ff3b46;
  --red-2: #ff6b6b;
  --amber: #ffb020;
  --green: #21c97a;
  --green-2: #14e08a;
  --blue: #3b82f6;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Be Vietnam Pro", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 50% -10%, #1b2a4a 0, transparent 60%),
    radial-gradient(900px 500px at 100% 0, rgba(255, 59, 70, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* ---------------------------- Buttons ---------------------------- */
.btn {
  border: none; border-radius: 14px; padding: 14px 18px;
  font-size: 16px; font-weight: 700; color: #fff; cursor: pointer;
  font-family: inherit; transition: transform .08s ease, filter .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(.96); }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--blue), #2563eb); }
.btn-green { background: linear-gradient(135deg, var(--green), #0fa968); }
.btn-amber { background: linear-gradient(135deg, var(--amber), #f59e0b); color: #2a1b00; }
.btn-fire {
  background: linear-gradient(135deg, #ff5a3c, var(--red));
  font-size: 20px; padding: 18px; letter-spacing: .5px;
  box-shadow: 0 10px 24px rgba(255, 59, 70, 0.4);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(255, 59, 70, 0.35); }
  50% { box-shadow: 0 10px 34px rgba(255, 59, 70, 0.65); }
}
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 8px 12px; font-size: 18px; cursor: pointer;
}

/* ---------------------------- Auth ---------------------------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--card);
  border: 1px solid var(--line); border-radius: 24px; padding: 28px 22px;
  box-shadow: var(--shadow); text-align: center;
}
.brand-logo { font-size: 54px; line-height: 1; }
.brand-title { font-size: 26px; font-weight: 800; margin: 8px 0 4px; }
.brand-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.auth-tabs { display: flex; background: var(--bg-2); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 10px; border: none; background: transparent; color: var(--muted);
  font-weight: 700; border-radius: 9px; cursor: pointer; font-family: inherit; font-size: 14px;
}
.auth-tab.active { background: var(--card-2); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 16px; font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--blue); }
.auth-hint { color: var(--red-2); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* ---------------------------- Layout ---------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-brand { font-weight: 800; font-size: 18px; }
.container { max-width: 480px; margin: 0 auto; padding: 14px 14px 40px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-title { font-weight: 700; font-size: 16px; margin-bottom: 12px; }

/* ---------------------------- Wallet ---------------------------- */
.wallet-card { background: linear-gradient(135deg, #16233f, #102a22); }
.wallet-top { display: flex; align-items: center; justify-content: space-between; }
.wallet-balance { font-size: 34px; font-weight: 800; letter-spacing: .5px; }
.wallet-balance small { font-size: 18px; color: var(--amber); }
.wallet-emoji { font-size: 40px; }
.wallet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.wallet-actions.one { grid-template-columns: 1fr; }

/* ---------------------------- Session ---------------------------- */
.session-head { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pill { font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }
.pill-live { background: rgba(33, 201, 122, 0.15); color: var(--green-2); }
.pill-bids { background: rgba(255, 176, 32, 0.15); color: var(--amber); }
/* Product hero image — responsive, rounded, dark-mode friendly. */
.product-image-wrap {
  position: relative;
  width: 100%; aspect-ratio: 16 / 10; margin: 4px 0 14px;
  border-radius: 18px; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
/* "Mystery prize" placeholder shown when a session has no (or a broken) image. */
.product-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; padding: 12px;
  background: linear-gradient(135deg, #1a1140, #0f1830, #231447);
  background-size: 220% 220%; animation: phShift 6s ease infinite;
}
@keyframes phShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.product-placeholder .ph-gift {
  font-size: 64px; line-height: 1;
  animation: phFloat 2.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 22px rgba(140, 92, 255, 0.7));
}
@keyframes phFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.product-placeholder .ph-t1 { font-weight: 800; font-size: 19px; color: #cbb8ff; }
.product-placeholder .ph-t2 { font-size: 12px; color: #8b86c6; }
.product-placeholder .ph-spark {
  position: absolute; font-size: 14px; color: #ffd76b;
  animation: phTwinkle 1.8s ease-in-out infinite;
}
@keyframes phTwinkle {
  0%, 100% { opacity: .2; transform: scale(.7); }
  50% { opacity: 1; transform: scale(1.25); }
}
@media (prefers-reduced-motion: reduce) {
  .product-placeholder, .product-placeholder .ph-gift, .product-placeholder .ph-spark { animation: none; }
}
#product-image {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity .35s ease;
}
#product-image.loaded { opacity: 1; }
.session-name { font-size: 22px; font-weight: 800; margin: 4px 0 14px; }
.prize-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prize-box { background: var(--bg-2); border-radius: 14px; padding: 12px; }
.prize-value { font-size: 20px; font-weight: 800; color: var(--green-2); margin-top: 2px; }
.prize-value.alt { color: var(--amber); }
.countdown {
  margin-top: 14px; text-align: center; background: var(--bg-2);
  border-radius: 14px; padding: 12px; border: 1px dashed var(--line);
}
.countdown-clock {
  font-size: 30px; font-weight: 800; letter-spacing: 2px; color: var(--red-2);
  font-variant-numeric: tabular-nums; margin-top: 2px; transition: color .2s, transform .2s;
}
#end-vn { display: block; margin-top: 4px; }
/* Final 60s: the whole countdown box goes red and pulses for urgency. */
.countdown.urgent {
  border-color: var(--red); border-style: solid;
  background: rgba(255, 59, 70, 0.12);
  animation: urgentPulse 1s ease-in-out infinite;
}
.countdown.urgent .countdown-clock { color: var(--red); font-size: 34px; }
@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 70, 0); }
  50% { box-shadow: 0 0 22px 2px rgba(255, 59, 70, 0.55); }
}
.session-switch { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sess-chip {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.sess-chip.active { border-color: var(--blue); color: var(--text); }

/* ---------------------------- Density ---------------------------- */
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.dot.red { background: var(--red); } .dot.amber { background: var(--amber); } .dot.green { background: var(--green); }
.density-list { display: flex; flex-direction: column; gap: 10px; }
.density-row {
  display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px;
  background: var(--bg-2); border-radius: 12px; padding: 10px; border: 1px solid transparent;
  transition: border-color .15s ease, transform .08s ease;
}
.density-row.clickable { cursor: pointer; }
.density-row.clickable:active { transform: scale(.98); }
.density-row.clickable:hover { border-color: var(--green); }
.density-range { font-size: 12.5px; font-weight: 700; color: var(--text); }
.density-bar-track { height: 16px; background: #0c1322; border-radius: 8px; overflow: hidden; }
.density-bar-fill { height: 100%; border-radius: 8px; transition: width .4s ease; min-width: 6px; }
.fill-red { background: linear-gradient(90deg, #ff6b6b, var(--red)); }
.fill-amber { background: linear-gradient(90deg, #ffd56b, var(--amber)); }
.fill-green { background: linear-gradient(90deg, var(--green-2), var(--green)); }
.density-count { font-size: 13px; font-weight: 800; min-width: 26px; text-align: right; }
.density-tag { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.empty { text-align: center; padding: 18px; }

/* ---------------------------- Bid ---------------------------- */
.bid-result {
  border-radius: 12px; padding: 12px 14px; font-weight: 800; text-align: center;
  margin-bottom: 12px; font-size: 15px; animation: popin .25s ease;
}
.bid-result.win { background: rgba(33, 201, 122, 0.16); color: var(--green-2); border: 1px solid var(--green); }
.bid-result.dup { background: rgba(255, 59, 70, 0.16); color: var(--red-2); border: 1px solid var(--red); }
@keyframes popin { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.bid-input-wrap { position: relative; margin-bottom: 12px; }
.bid-input-wrap input {
  width: 100%; padding: 18px 44px 18px 16px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 26px; font-weight: 800; text-align: center;
  font-family: inherit;
}
.bid-input-wrap input:focus { outline: none; border-color: var(--red); }
.bid-unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }

/* ---------------------------- Prize banner ---------------------------- */
.prize-banner {
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  background: linear-gradient(135deg, #2a2010, #3a2c0c);
  border: 1px solid var(--amber); box-shadow: 0 10px 30px rgba(255, 176, 32, 0.25);
  animation: popin .3s ease;
}
.prize-item { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; }
.prize-item + .prize-item { border-top: 1px dashed rgba(255,176,32,.3); margin-top: 8px; padding-top: 12px; }
.prize-ico { font-size: 30px; line-height: 1; }
.prize-body { flex: 1; }
.prize-title { font-weight: 800; font-size: 16px; color: #ffe6a8; }
.prize-sub { font-size: 13px; color: #e6c48a; margin-top: 3px; line-height: 1.45; }
.prize-status-tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; margin-top: 6px; }
.prize-status-tag.pending { background: rgba(255,176,32,.2); color: var(--amber); }
.prize-status-tag.delivered { background: rgba(33,201,122,.18); color: var(--green-2); }
.prize-contact { color: #fff; font-weight: 700; }

.footer { text-align: center; padding: 18px 0 0; }

/* ---------------------------- Modal ---------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px);
}
.modal-card {
  width: 100%; max-width: 480px; background: var(--card); border: 1px solid var(--line);
  border-radius: 22px 22px 0 0; padding: 20px; box-shadow: var(--shadow);
  animation: slideup .25s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-x { background: var(--bg-2); border: none; color: var(--muted); width: 34px; height: 34px; border-radius: 10px; font-size: 16px; cursor: pointer; }
.qr-wrap { text-align: center; margin: 14px 0; }
.qr-wrap img { width: 220px; max-width: 70%; border-radius: 14px; background: #fff; padding: 8px; }
.bank-info { background: var(--bg-2); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bank-info .row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bank-info .row b { font-weight: 800; }
.copy-btn { background: var(--blue); border: none; color: #fff; border-radius: 8px; padding: 3px 9px; font-size: 12px; font-weight: 700; cursor: pointer; }
.deposit-note { margin-top: 12px; line-height: 1.5; }
/* "Mua Xu" conversion-rate banner — friendly points/coins vibe. */
.convert-rate {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  text-align: center; font-size: 14px; font-weight: 700; color: var(--amber);
  background: rgba(255, 176, 32, 0.12); border: 1px solid rgba(255, 176, 32, 0.4);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 14px;
}
.convert-rate b { color: var(--text); }

/* ---------------------------- Toast ---------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--card-2); color: var(--text); padding: 13px 18px; border-radius: 12px;
  border: 1px solid var(--line); font-weight: 700; font-size: 14px; z-index: 60;
  box-shadow: var(--shadow); max-width: 90%; text-align: center; animation: popin .2s ease;
}
.toast.ok { border-color: var(--green); }
.toast.err { border-color: var(--red); }
.toast.info { border-color: var(--blue); }
