/* ============================================================
 *  BioWA API | custom styles + animations (works with Tailwind)
 * ============================================================ */
:root { --wa: #25D366; --wa-dark: #075E54; --wa-mid: #128C7E; }
html { -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }

.loader-ring { width: 42px; height: 42px; border-radius: 50%; border: 4px solid #d1fae1; border-top-color: var(--wa); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Login screen ---------------- */
.login-bg { background: radial-gradient(1200px 600px at 10% 10%, #0b6b5e 0%, transparent 60%), radial-gradient(900px 500px at 90% 90%, #128C7E 0%, transparent 60%), #04332e; }
.grid-lines { background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 38px 38px; animation: gridMove 18s linear infinite; }
@keyframes gridMove { to { background-position: 38px 38px, 38px 38px; } }

.orb { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .35; animation: orb 14s ease-in-out infinite alternate; }
@keyframes orb { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(40px,-60px) scale(1.2); } }

.float-chip { animation: floaty 5s ease-in-out infinite; }
.float-chip.d2 { animation-delay: -1.5s; } .float-chip.d3 { animation-delay: -3s; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.code-win { background: rgba(2, 20, 18, .75); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.08); }
.code-line { white-space: pre; font-family: 'JetBrains Mono', monospace; }
.caret::after { content: '\258C'; color: var(--wa); animation: blink 1s steps(1) infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }

.wire { position: relative; height: 4px; border-radius: 4px; background: repeating-linear-gradient(90deg, rgba(37,211,102,.35) 0 10px, transparent 10px 18px); animation: wire 1s linear infinite; }
@keyframes wire { to { background-position: 18px 0; } }
.packet { position: absolute; top: 50%; left: 0; width: 34px; height: 18px; margin-top: -9px; border-radius: 6px; background: var(--wa); box-shadow: 0 0 18px var(--wa); color: #04332e; font-size: 9px; font-weight: 800; display: flex; align-items: center; justify-content: center; opacity: 0; }
.packet.go { animation: packetGo 1.1s cubic-bezier(.6,.05,.3,1) forwards; }
@keyframes packetGo { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 34px); opacity: 0; } }

.phone { width: 230px; height: 440px; border-radius: 34px; background: #111; padding: 10px; box-shadow: 0 25px 60px rgba(0,0,0,.45), inset 0 0 0 2px #2a2a2a; }
.phone-screen { border-radius: 26px; overflow: hidden; height: 100%; display: flex; flex-direction: column; background: #efeae2; }
.chat-bg { background-color: #efeae2; background-image: radial-gradient(rgba(0,0,0,.04) 1px, transparent 1px); background-size: 14px 14px; }
.bubble { max-width: 86%; padding: 6px 9px 4px; border-radius: 9px; font-size: 11px; line-height: 1.35; box-shadow: 0 1px 1px rgba(0,0,0,.08); background: #fff; color: #111b21; transform-origin: left bottom; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.4) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.bubble .meta { font-size: 9px; color: #667781; text-align: right; margin-top: 1px; }
.tick { color: #8696a0; transition: color .4s; } .tick.read { color: #53bdeb; }
.typing span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #8696a0; margin: 0 1px; animation: typing 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.pulse-ring { position: relative; }
.pulse-ring::before { content: ''; position: absolute; inset: -6px; border-radius: inherit; border: 2px solid var(--wa); animation: ring 2s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.9); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }

.auth-card { animation: cardIn .5s cubic-bezier(.2,.9,.3,1); }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.view-in { animation: viewIn .35s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.mini-bubbles .bubble { animation: pop .4s cubic-bezier(.2,1.4,.4,1) both; }

/* ---------------- Inputs ---------------- */
.inp { width: 100%; border: 1px solid #d5dde3; border-radius: .6rem; padding: .62rem .8rem; font-size: .9rem; background: #fff; outline: none; transition: border .15s, box-shadow .15s; }
.inp:focus { border-color: var(--wa-mid); box-shadow: 0 0 0 3px rgba(18,140,126,.15); }
.inp:disabled, .inp[readonly] { background: #f5f7f8; }
.inp-icon { position: relative; } .inp-icon > i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 1.05rem; } .inp-icon > .inp { padding-left: 2.4rem; }
.lbl { display: block; font-size: .78rem; font-weight: 600; color: #475569; margin-bottom: .3rem; }
.lbl .req { color: #ef4444; }
.otp-box { width: 2.8rem; height: 3.2rem; text-align: center; font-size: 1.35rem; font-weight: 700; border: 1px solid #d5dde3; border-radius: .6rem; outline: none; }
.otp-box:focus { border-color: var(--wa-mid); box-shadow: 0 0 0 3px rgba(18,140,126,.15); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-weight: 600; font-size: .875rem; border-radius: .6rem; padding: .6rem 1rem; transition: all .15s; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-wa { background: linear-gradient(135deg, #128C7E, #25D366); color: #fff; box-shadow: 0 4px 14px rgba(37,211,102,.3); }
.btn-wa:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.btn-dark { background: #075E54; color: #fff; } .btn-dark:hover { background: #0b6b5e; }
.btn-light { background: #fff; color: #334155; border: 1px solid #d5dde3; } .btn-light:hover { background: #f8fafc; }
.btn-red { background: #fee2e2; color: #b91c1c; } .btn-red:hover { background: #fecaca; }
.btn-sm { padding: .35rem .65rem; font-size: .78rem; border-radius: .5rem; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }

/* ---------------- Top bar ---------------- */
.topbar { background: linear-gradient(110deg, #04332e, #075E54, #128C7E, #0b6b5e, #04332e); background-size: 300% 100%; animation: topGrad 12s ease infinite, slideDown .5s ease; position: relative; overflow: hidden; }
@keyframes topGrad { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: none; } }
.topbar::after { content: ''; position: absolute; top: 0; bottom: 0; width: 120px; left: -150px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent); transform: skewX(-20deg); animation: shine 6s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 0%,70% { left: -150px; } 100% { left: 110%; } }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74,222,128,.7); animation: live 1.8s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.7); } 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
.marquee-wrap { overflow: hidden; }
.top-item { align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); font-size: .75rem; white-space: nowrap; }

/* ---------------- Menu bar ---------------- */
.menubar { background: #fff; border-bottom: 1px solid #e2e8f0; box-shadow: 0 2px 10px rgba(15,23,42,.04); }
.menu-link { display: flex; align-items: center; gap: .45rem; padding: .85rem .95rem; font-size: .86rem; font-weight: 600; color: #475569; border-bottom: 3px solid transparent; transition: color .15s, border-color .15s, background .15s; cursor: pointer; white-space: nowrap; }
.menu-link:hover { color: #075E54; background: #f0fdf6; }
.menu-link.active { color: #075E54; border-bottom-color: #25D366; }
.menu-drop { position: absolute; top: 100%; left: 0; min-width: 210px; background: #fff; border: 1px solid #e2e8f0; border-radius: .7rem; box-shadow: 0 12px 30px rgba(15,23,42,.12); padding: .35rem; opacity: 0; visibility: hidden; transform: translateY(6px); transition: all .16s; z-index: 50; }
.menu-group:hover .menu-drop, .menu-group.open .menu-drop { opacity: 1; visibility: visible; transform: none; }
.drop-link { display: flex; align-items: center; gap: .55rem; padding: .55rem .7rem; border-radius: .5rem; font-size: .84rem; color: #334155; font-weight: 500; }
.drop-link:hover { background: #f0fdf6; color: #075E54; }
.drop-link.active { background: #dcfce7; color: #075E54; font-weight: 600; }
@media (max-width: 1023px) {
  .menu-list { display: none; }
  .menu-list.show { display: block; animation: viewIn .2s ease; }
  .menu-link { border-bottom: 0; border-left: 3px solid transparent; }
  .menu-link.active { border-left-color: #25D366; background: #f0fdf6; }
  .menu-drop { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 .3rem 1.6rem; display: none; }
  .menu-group.open .menu-drop { display: block; }
  .menu-group:hover .menu-drop { opacity: 1; }
}

/* ---------------- Cards / tables ---------------- */
.card { background: #fff; border: 1px solid #e5e9ee; border-radius: 1rem; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.stat { position: relative; overflow: hidden; }
.stat .ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.stat::after { content: ''; position: absolute; right: -30px; bottom: -30px; width: 100px; height: 100px; border-radius: 50%; background: currentColor; opacity: .04; }
.tbl { width: 100%; font-size: .82rem; }
.tbl th { text-align: left; font-weight: 600; color: #64748b; background: #f8fafc; padding: .65rem .75rem; border-bottom: 1px solid #e5e9ee; white-space: nowrap; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; }
.tbl td { padding: .65rem .75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tr:hover td { background: #fafcfb; }
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 600; white-space: nowrap; }
.code { font-family: 'JetBrains Mono', monospace; font-size: .78rem; background: #0f172a; color: #e2e8f0; border-radius: .7rem; padding: 1rem; overflow-x: auto; white-space: pre; line-height: 1.55; }
.code .k { color: #7dd3fc; } .code .s { color: #86efac; } .code .c { color: #64748b; }
.kv { font-family: 'JetBrains Mono', monospace; font-size: .8rem; background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: .5rem; padding: .5rem .7rem; word-break: break-all; }
.tab-btn { padding: .45rem .9rem; font-size: .8rem; font-weight: 600; border-radius: .5rem; color: #64748b; }
.tab-btn.active { background: #075E54; color: #fff; }
.progress { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #25D366, #128C7E); transition: width .8s ease; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: #25D366; }
.switch input:checked + span::before { transform: translateX(18px); }

/* QR */
.qr-frame { position: relative; padding: 14px; border-radius: 18px; background: #fff; box-shadow: 0 10px 30px rgba(7,94,84,.15); }
.qr-frame::before, .qr-frame::after { content: ''; position: absolute; width: 34px; height: 34px; border: 4px solid #25D366; }
.qr-frame::before { top: -4px; left: -4px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.qr-frame::after { bottom: -4px; right: -4px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.scan-line { position: absolute; left: 14px; right: 14px; height: 3px; background: linear-gradient(90deg, transparent, #25D366, transparent); box-shadow: 0 0 12px #25D366; animation: scan 2.4s ease-in-out infinite; }
@keyframes scan { 0%,100% { top: 16px; } 50% { top: calc(100% - 18px); } }

/* Toast + modal */
.toast { animation: toastIn .3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.modal-bg { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box { animation: cardIn .25s ease; }

.footer-bar { background: #fff; border-top: 1px solid #e2e8f0; }
.heart { color: #ef4444; animation: beat 1.4s infinite; display: inline-block; }
@keyframes beat { 0%,100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } }

/* ---------------- Dashboard v1.1 ---------------- */
.grad-card { transition: transform .2s, box-shadow .2s; animation: cardRise .5s ease both; }
.grad-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(15,23,42,.18); }
.grad-card:nth-child(2) { animation-delay: .05s; } .grad-card:nth-child(3) { animation-delay: .1s; } .grad-card:nth-child(4) { animation-delay: .15s; }
.grad-card:nth-child(5) { animation-delay: .2s; } .grad-card:nth-child(6) { animation-delay: .25s; } .grad-card:nth-child(7) { animation-delay: .3s; } .grad-card:nth-child(8) { animation-delay: .35s; }
@keyframes cardRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.dash-hero { background: linear-gradient(120deg, #04332e 0%, #075E54 40%, #128C7E 75%, #25D366 100%); background-size: 200% 100%; animation: topGrad 14s ease infinite; position: relative; overflow: hidden; }
.dash-hero .bubble-deco { position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); animation: orb 10s ease-in-out infinite alternate; }
.dash-bg { background: radial-gradient(900px 300px at 0% 0%, rgba(37,211,102,.10), transparent 70%), radial-gradient(700px 300px at 100% 0%, rgba(99,102,241,.08), transparent 70%); }
.card { transition: box-shadow .2s; }
.card:hover { box-shadow: 0 8px 24px rgba(15,23,42,.06); }
.rank { width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; }
.help-step { counter-increment: hs; position: relative; padding-left: 2rem; min-height: 24px; }
.help-step::before { content: counter(hs); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: #d1fae1; color: #075E54; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
