/* BIRMAKON LOTTERY CLUB - App styles. Mobile-first, responsive, modern. */

:root {
    --bg-0: #0b0f1a;
    --bg-1: #111827;
    --card: rgba(255, 255, 255, 0.06);
    --card-2: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.10);
    --text: #f4f6fb;
    --muted: #9aa4bf;
    --brand: #7c5cff;
    --brand-2: #22d3ee;
    --accent: #ffb020;
    --ok: #34d399;
    --err: #fb7185;
    --ring: rgba(124, 92, 255, 0.45);
    --radius: 18px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    color: var(--text);
    min-height: 100vh;
    background:
        radial-gradient(1200px 700px at 15% -10%, rgba(124, 92, 255, 0.30), transparent 60%),
        radial-gradient(900px 600px at 100% 0%, rgba(34, 211, 238, 0.18), transparent 55%),
        linear-gradient(180deg, var(--bg-0), var(--bg-1));
    background-attachment: fixed;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 40px;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Decorative floating orbs (subtle, behind content) */
.orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orbs i { position: absolute; border-radius: 50%; filter: blur(64px); opacity: 0.4;
    animation: float 15s ease-in-out infinite; }
.orbs i:nth-child(1) { width: 300px; height: 300px; left: -90px; top: 4%;
    background: radial-gradient(circle, rgba(124,92,255,0.5), transparent 70%); }
.orbs i:nth-child(2) { width: 240px; height: 240px; right: -70px; top: 46%;
    background: radial-gradient(circle, rgba(34,211,238,0.4), transparent 70%); animation-delay: -6s; }
@keyframes float { 0%,100% { transform: translateY(0) translateX(0); } 50% { transform: translateY(-22px) translateX(12px); } }
.topbar, .container { position: relative; z-index: 1; }

/* Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(11, 15, 26, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--card-border);
}
.topbar .logo {
    width: 36px; height: 36px; border-radius: 10px;
    display: grid; place-items: center; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    flex: 0 0 auto;
}
.topbar .title { font-weight: 700; letter-spacing: 0.06em; font-size: 0.95rem; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 0.8rem; }

.container { max-width: 960px; margin: 0 auto; padding: 18px 16px; }
.container.narrow { max-width: 520px; }

h1.page { font-size: 1.4rem; margin: 6px 0 4px; }
p.sub { color: var(--muted); margin: 0 0 18px; font-size: 0.9rem; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 20px 18px;
    margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }

/* Stat grid */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
    background: var(--card-2);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
}
.stat .num {
    font-size: 2rem; font-weight: 800; line-height: 1.1;
    background: linear-gradient(135deg, var(--brand-2), var(--accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat .lbl { color: var(--muted); font-size: 0.78rem; margin-top: 6px; letter-spacing: 0.04em; }

/* Countdown */
.countdown { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.countdown .box {
    background: var(--card-2); border: 1px solid var(--card-border); border-radius: 12px;
    padding: 10px 12px; min-width: 58px; text-align: center;
}
.countdown .box b { font-size: 1.4rem; font-family: var(--mono); }
.countdown .box span { display: block; color: var(--muted); font-size: 0.66rem; margin-top: 2px; letter-spacing: 0.06em; }

/* Fields & buttons */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 7px; }
.field .hint { font-size: 0.72rem; color: var(--muted); opacity: 0.85; margin-top: 5px; }
.input, select.input {
    width: 100%; background: rgba(0,0,0,0.25); border: 1px solid var(--card-border);
    border-radius: 12px; color: var(--text); font-size: 1rem; padding: 13px 14px;
    transition: border-color .15s, box-shadow .15s; font-family: var(--font);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }

.btn {
    display: inline-block; width: 100%; text-align: center; border: 0; border-radius: 13px;
    padding: 15px 18px; font-size: 1rem; font-weight: 700; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 12px 28px var(--ring); transition: transform .12s, box-shadow .12s; margin-top: 4px;
    font-family: var(--font);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn.secondary { background: rgba(255,255,255,0.08); box-shadow: none; border: 1px solid var(--card-border); }
.btn.small { width: auto; padding: 9px 14px; font-size: 0.85rem; }

.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.row-actions .btn { width: auto; flex: 1; min-width: 130px; }

/* Alerts */
.alert { border-radius: 12px; padding: 12px 14px; font-size: 0.9rem; margin-bottom: 14px; border: 1px solid transparent; }
.alert.err { background: rgba(251,113,133,0.12); border-color: rgba(251,113,133,0.4); color: #ffd7de; }
.alert.ok  { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.4); color: #c9f7e5; }
.alert.info{ background: rgba(34,211,238,0.10); border-color: rgba(34,211,238,0.35); color: #cff4fb; }

/* Table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 560px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--card-border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.74rem; letter-spacing: 0.05em; text-transform: uppercase; }
tr:hover td { background: rgba(255,255,255,0.03); }

.badge {
    display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 0.72rem; font-weight: 600;
    background: rgba(124,92,255,0.18); color: #d9d2ff; border: 1px solid rgba(124,92,255,0.35);
}
.badge.ok { background: rgba(52,211,153,0.15); color: #c9f7e5; border-color: rgba(52,211,153,0.4); }
.badge.mono { font-family: var(--mono); }

.pill { font-family: var(--mono); background: rgba(0,0,0,0.3); padding: 4px 10px; border-radius: 8px; }

.rank { font-size: 2.4rem; font-weight: 800; }
.rank .hash { color: var(--muted); font-size: 1.4rem; }

.how li { margin-bottom: 8px; color: var(--muted); }
.how b { color: var(--text); }

/* QR pass card (client dashboard / pass) */
.qr-card {
    background: linear-gradient(135deg, rgba(124,92,255,0.16), rgba(34,211,238,0.10));
    border: 1px solid var(--card-border); border-radius: var(--radius);
    padding: 22px 18px; text-align: center; margin-bottom: 16px;
}
.qr-card .qr-frame {
    display: inline-block; background: #fff; padding: 14px; border-radius: 16px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.45); line-height: 0;
}
.qr-card .qr-frame img, .qr-card .qr-frame canvas { display: block; border-radius: 6px; }
.qr-card .lid {
    margin-top: 14px; font-family: var(--mono); font-size: 1.1rem; font-weight: 700; letter-spacing: 0.06em;
}
.qr-card .qr-hint { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

/* Prize/winner list in app pages */
.prize-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.prize-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--card-2); border: 1px solid var(--card-border); border-radius: 12px; padding: 12px 14px;
}
.prize-item .medal { font-size: 22px; flex: 0 0 auto; }
.prize-item .p-main { flex: 1; min-width: 0; }
.prize-item .p-main b { display: block; }
.prize-item .p-main span { color: var(--muted); font-size: 0.82rem; }

/* Admin nav button grid */
.nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.nav-grid a {
    display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
    background: var(--card-2); border: 1px solid var(--card-border); border-radius: 14px;
    padding: 14px; font-weight: 600; font-size: 0.9rem; transition: border-color .15s, transform .12s;
}
.nav-grid a:hover { border-color: var(--brand); transform: translateY(-1px); text-decoration: none; }
.nav-grid a .ic { font-size: 20px; }

/* Filters */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.th-sub { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: 0.7; }

/* ---- Toggle switch (custom, Dark Luxury) ---- */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
    position: relative; width: 46px; height: 26px; border-radius: 99px;
    background: rgba(255,255,255,0.10); border: 1px solid var(--card-border);
    transition: background .2s, box-shadow .2s;
}
.toggle .thumb {
    position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.4); transition: transform .2s;
}
.toggle input:checked + .track {
    background: linear-gradient(135deg, var(--ok), var(--brand-2));
    box-shadow: 0 0 0 3px rgba(52,211,153,0.25), 0 0 16px rgba(52,211,153,0.45);
}
.toggle input:checked + .track .thumb { transform: translateX(20px); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 4px var(--ring); }
.toggle .toggle-lbl { font-size: 0.8rem; color: var(--muted); min-width: 74px; }
.toggle.flash .track { animation: glowPulse 0.7s ease; }
@keyframes glowPulse {
    0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.6); }
    100% { box-shadow: 0 0 0 14px rgba(52,211,153,0); }
}
/* pulsing-dots loader shown while the toggle request is in flight */
.toggle.loading .track { opacity: 0.6; }
.toggle.loading .thumb { animation: thumbPulse 0.8s ease-in-out infinite; }
@keyframes thumbPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---- Floating-label fields (premium auth forms, ТЗ §4) ---- */
.ff { position: relative; margin-bottom: 18px; }
.ff > input.input, .ff > select.input { padding: 20px 14px 8px; }
.ff > label {
    position: absolute; left: 15px; top: 15px; color: var(--muted);
    font-size: 0.95rem; pointer-events: none; transition: transform .15s, color .15s, font-size .15s;
    transform-origin: left top; background: transparent; padding: 0 2px;
}
.ff > input.input:focus + label,
.ff > input.input:not(:placeholder-shown) + label,
.ff > select.input:focus + label,
.ff > select.input:valid + label {
    transform: translateY(-9px) scale(0.78); color: var(--brand-2);
}
.ff > input.input:focus, .ff > select.input:focus {
    border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring), 0 0 22px rgba(124,92,255,0.35);
}

/* Auth card entrance + brand mark */
.auth-card { animation: authIn .5s cubic-bezier(.2,.8,.2,1) both; }
.auth-brand {
    width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 14px;
    display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 10px 30px var(--ring), 0 0 26px rgba(34,211,238,0.4);
    animation: floatY 4s ease-in-out infinite;
}
@keyframes authIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---- Scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---- Neon glow utility + animated timer ---- */
.neon-timer .box {
    background: rgba(0,0,0,0.35);
    box-shadow: inset 0 0 0 1px rgba(34,211,238,0.25), 0 0 18px rgba(34,211,238,0.18);
}
.neon-timer .box b {
    background: linear-gradient(135deg, var(--brand-2), var(--accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.fee-status {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px;
    font-size: 0.85rem; font-weight: 700; border: 1px solid transparent;
}
.fee-status.on  { background: rgba(52,211,153,0.14); border-color: rgba(52,211,153,0.5); color: #c9f7e5;
    box-shadow: 0 0 18px rgba(52,211,153,0.35); }
.fee-status.off { background: rgba(251,113,133,0.14); border-color: rgba(251,113,133,0.5); color: #ffd7de;
    box-shadow: 0 0 18px rgba(251,113,133,0.30); }
.fee-status .dot { width: 9px; height: 9px; border-radius: 50%; }
.fee-status.on .dot  { background: var(--ok);  box-shadow: 0 0 8px var(--ok); animation: pulseDot 1.6s infinite; }
.fee-status.off .dot { background: var(--err); box-shadow: 0 0 8px var(--err); }
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Neon-glowing QR frame */
.qr-card.neon .qr-frame {
    position: relative; box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 0 34px rgba(124,92,255,0.55), 0 0 60px rgba(34,211,238,0.35);
    animation: qrGlow 3.4s ease-in-out infinite;
}
@keyframes qrGlow {
    0%,100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 0 30px rgba(124,92,255,0.45), 0 0 50px rgba(34,211,238,0.28); }
    50%     { box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 0 44px rgba(124,92,255,0.7),  0 0 74px rgba(34,211,238,0.45); }
}

/* ---- Toasts ---- */
.toast-wrap {
    position: fixed; right: 16px; bottom: 16px; z-index: 60;
    display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px));
}
.toast {
    background: rgba(17,24,39,0.92); border: 1px solid var(--card-border); border-radius: 12px;
    padding: 12px 14px; font-size: 0.88rem; color: var(--text);
    box-shadow: var(--shadow); backdrop-filter: blur(10px);
    transform: translateY(14px); opacity: 0; transition: transform .3s, opacity .3s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok  { border-color: rgba(52,211,153,0.5); }
.toast.err { border-color: rgba(251,113,133,0.5); }
.toast b { color: #fff; }

.foot { text-align: center; color: var(--muted); font-size: 0.72rem; margin-top: 22px; }

@media (min-width: 680px) {
    .stats { grid-template-columns: repeat(4, 1fr); }
    .filters { grid-template-columns: repeat(3, 1fr); }
    h1.page { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) { .btn, .input { transition: none; } }
