/* ============================================================
   Webilaa — Auth pages (login.php / register.php)
   "Vivid Float" — a bold saturated gradient stage with a white card
   that visibly lifts off it, colorful accents throughout.
   Shared, self-hosted stylesheet — CSP on these pages is script-src
   'none', so every interaction here (floating labels, focus states,
   the drifting background, the floating chips) is pure CSS.
   ============================================================ */

:root {
    --emerald: #10b981;
    --emerald-dark: #059669;
    --teal: #14b8a6;
    --amber: #f59e0b;
    --sky: #38bdf8;
    --violet: #8b5cf6;
    --ink: #0f172a;
    --ink-soft: #64748b;
    --ink-faint: #94a3b8;
    --line: #cfe8de;
    --field-bg: #eefaf5;
    --card-bg: #ffffff;
    --radius-card: 32px;
    --radius-md: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', sans-serif; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
    background: linear-gradient(135deg, #043d31 0%, #047857 28%, #0d9488 58%, #0369a1 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px;
    position: relative;
    overflow-x: hidden;
}

/* ---------- Bold drifting glow + texture over the gradient stage ---------- */
.mesh { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.mesh::before {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.07) 1px, transparent 0);
    background-size: 26px 26px;
}
.mesh span { position: absolute; border-radius: 50%; filter: blur(90px); will-change: transform; }
.mesh .m1 { width: 480px; height: 480px; background: radial-gradient(circle, rgba(52,211,153,0.55) 0%, transparent 70%); top: -160px; left: -120px; animation: driftA 24s ease-in-out infinite; }
.mesh .m2 { width: 460px; height: 460px; background: radial-gradient(circle, rgba(56,189,248,0.5) 0%, transparent 70%); bottom: -180px; right: -100px; animation: driftB 28s ease-in-out infinite; }
.mesh .m3 { width: 380px; height: 380px; background: radial-gradient(circle, rgba(245,158,11,0.4) 0%, transparent 70%); top: 42%; left: 62%; animation: driftC 32s ease-in-out infinite; }

@keyframes driftA { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(50px, 40px) scale(1.12); } }
@keyframes driftB { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-40px, -30px) scale(1.08); } }
@keyframes driftC { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-55%, -45%) scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .mesh span, .chip { animation: none !important; } }

/* ---------- Decorative floating chips (desktop flourish only) ---------- */
.chip {
    position: fixed; z-index: 1;
    width: 54px; height: 54px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; color: #fff;
    box-shadow: 0 16px 32px rgba(2, 20, 16, 0.35);
    animation: floatChip 6s ease-in-out infinite;
}
.chip.c1 { top: 14%; left: 10%; background: linear-gradient(135deg, #34d399, #059669); animation-delay: 0s; }
.chip.c2 { bottom: 18%; left: 7%; background: linear-gradient(135deg, #38bdf8, #0369a1); animation-delay: 1.2s; }
.chip.c3 { top: 20%; right: 9%; background: linear-gradient(135deg, #fbbf24, #d97706); animation-delay: 0.6s; }
.chip.c4 { bottom: 12%; right: 11%; background: linear-gradient(135deg, #a78bfa, #7c3aed); animation-delay: 1.8s; }
@keyframes floatChip { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@media (max-width: 1000px) { .chip { display: none; } }

/* ---------- The app-card itself — deliberately high-contrast against the stage ---------- */
.app-card {
    position: relative; z-index: 2;
    width: 100%;
    /* margin:auto (not justify-content:center on the parent) centers this
       vertically — it degrades gracefully to top-aligned + scrollable when
       the card is taller than the viewport, instead of clipping the top
       half of the card off-screen the way flex justify-content:center does. */
    margin: auto 0;
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: 0 50px 100px -20px rgba(2, 30, 24, 0.55), 0 10px 30px rgba(2, 30, 24, 0.25), 0 0 0 1px rgba(255,255,255,0.5) inset;
    padding: 40px 36px;
}
.app-card.narrow { max-width: 420px; }
.app-card.wide { max-width: 540px; }

.app-head { text-align: center; margin-bottom: 26px; }
.app-head .badge-logo {
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 18px; position: relative;
}
.app-head .badge-logo::before {
    content: '';
    position: absolute; inset: -18px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16,185,129,0.22) 0%, transparent 72%);
    animation: pulseRing 2.8s ease-in-out infinite;
}
.app-head .badge-logo img { position: relative; height: 30px; }
@keyframes pulseRing { 0%, 100% { transform: scale(0.9); opacity: 0.7; } 50% { transform: scale(1.18); opacity: 1; } }

.app-head h1 { font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: -0.5px; margin-bottom: 6px; }
.app-head p { font-size: 13.5px; color: var(--ink-soft); font-weight: 500; line-height: 1.5; }
.app-head p strong { color: var(--ink); }

.status-pill {
    display: inline-flex; align-items: center; gap: 7px;
    background: linear-gradient(135deg, var(--emerald), var(--teal));
    color: #fff;
    font-size: 10.5px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
    padding: 7px 13px; border-radius: 999px; margin-bottom: 14px;
    box-shadow: 0 8px 18px rgba(16,185,129,0.35);
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulseDot 1.6s ease-in-out infinite; }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Toast ---------- */
.app-toast {
    padding: 13px 16px; border-radius: 14px; font-size: 12.5px; font-weight: 700;
    margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
}
.app-toast.error { background: #fef2f2; color: #ef4444; border: 1px solid #fee2e2; }
.app-toast.success { background: #ecfdf5; color: var(--emerald); border: 1px solid #d1fae5; }

/* ---------- Google button — colorful gradient border, unmistakable ---------- */
.btn-google {
    width: 100%; color: var(--ink);
    padding: 14px; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    text-decoration: none;
    border: 2px solid transparent;
    background-image: linear-gradient(#fff, #fff), linear-gradient(120deg, #4285F4, #EA4335, #FBBC05, #34A853);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 10px 24px rgba(15,23,42,0.1);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    grid-column: 1 / -1;
}
.btn-google:hover { box-shadow: 0 14px 30px rgba(15,23,42,0.16); transform: translateY(-1px); }
.btn-google:active { transform: scale(0.98); }
.btn-google .g-icon {
    width: 20px; height: 20px; flex-shrink: 0;
    background: conic-gradient(from -45deg, #4285F4 90deg, #34A853 90deg 180deg, #FBBC05 180deg 270deg, #EA4335 270deg);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-google .g-icon i { color: #fff; font-size: 11px; }

.or-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; grid-column: 1 / -1; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.or-divider span { font-size: 10.5px; font-weight: 800; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 1.2px; }

/* ---------- Plan / trial picker (CSS-only selection, no JS) ---------- */
.plan-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.plan-card { position: relative; cursor: pointer; display: block; }
.plan-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.plan-card-inner {
    display: block; padding: 13px 14px; border: 2px solid var(--line); border-radius: var(--radius-md);
    background: var(--field-bg); transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.plan-card-name { display: block; font-weight: 800; font-size: 13.5px; color: var(--ink); margin-bottom: 2px; }
.plan-card-desc { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 500; }
.plan-card input:checked ~ .plan-card-inner { border-color: var(--emerald); background: #fff; box-shadow: 0 8px 20px rgba(16,185,129,0.16); }
.plan-card input:focus-visible ~ .plan-card-inner { outline: 2px solid var(--emerald); outline-offset: 2px; }
@media (max-width: 480px) { .plan-picker { grid-template-columns: 1fr; } }

/* Standard plan — deep navy, always-dark so it reads as its own distinct card */
.plan-card.c-standard .plan-card-inner {
    background: linear-gradient(135deg, #0f2247, #1d3f8f); border-color: #0f2247;
    box-shadow: 0 6px 16px rgba(15,34,71,0.25);
}
.plan-card.c-standard .plan-card-name { color: #7dd3fc; }
.plan-card.c-standard .plan-card-desc { color: #bcd4f7; }
.plan-card.c-standard input:checked ~ .plan-card-inner {
    background: linear-gradient(135deg, #1d4ed8, #0ea5e9); border-color: #38bdf8;
    box-shadow: 0 10px 26px rgba(29,78,216,0.45), 0 0 0 2px #38bdf8 inset;
}
.plan-card.c-standard input:checked ~ .plan-card-inner .plan-card-name { color: #fff; }
.plan-card.c-standard input:checked ~ .plan-card-inner .plan-card-desc { color: #e0f2fe; }

/* Smart AI plan — deep violet/black, always-dark so it reads as its own distinct card */
.plan-card.c-ai .plan-card-inner {
    background: linear-gradient(135deg, #1e0a3c, #4c1d95); border-color: #1e0a3c;
    box-shadow: 0 6px 16px rgba(30,10,60,0.25);
}
.plan-card.c-ai .plan-card-name { color: #d8b4fe; }
.plan-card.c-ai .plan-card-desc { color: #ddc9fb; }
.plan-card.c-ai input:checked ~ .plan-card-inner {
    background: linear-gradient(135deg, #7c3aed, #c026d3); border-color: #e879f9;
    box-shadow: 0 10px 26px rgba(124,58,237,0.5), 0 0 0 2px #e879f9 inset;
}
.plan-card.c-ai input:checked ~ .plan-card-inner .plan-card-name { color: #fff; }
.plan-card.c-ai input:checked ~ .plan-card-inner .plan-card-desc { color: #fae8ff; }

/* ---------- Floating-label fields (CSS-only) — clearly defined wells ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.form-grid .full-width { grid-column: 1 / -1; }

.section-title {
    font-size: 11px; font-weight: 800; color: var(--ink-faint);
    text-transform: uppercase; letter-spacing: 1.2px;
    margin: 16px 0 10px; display: flex; align-items: center; grid-column: 1 / -1;
}
.section-title::after { content: ''; flex: 1; height: 2px; background: var(--line); margin-left: 10px; border-radius: 2px; }

.field { position: relative; margin-bottom: 12px; }
.field input {
    width: 100%; background: var(--field-bg); border: 2px solid var(--line);
    border-radius: var(--radius-md); padding: 23px 16px 9px 44px;
    font-size: 14.5px; font-weight: 600; color: var(--ink); outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    min-height: 54px;
}
.field input::placeholder { color: transparent; }
.field input:focus { background: #fff; border-color: var(--emerald); box-shadow: 0 8px 20px rgba(16,185,129,0.18); }
.field .field-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--emerald-dark); opacity: 0.6; font-size: 14px; transition: opacity 0.15s ease, color 0.2s ease; pointer-events: none; }
.field input:focus ~ .field-icon { color: var(--emerald); opacity: 1; }
/* Once the label floats up (focused or filled), the icon would otherwise sit
   awkwardly between the shrunk label and the value text — fade it out so the
   label alone occupies that row cleanly, matching a single, aligned line.
   Browser autofill (Chrome/Safari) sets the value without reliably clearing
   :placeholder-shown, so :-webkit-autofill / :autofill are matched too — this
   is the exact case that was still showing the overlap on Full Name/Address/
   Country, since those are the fields browsers auto-fill first. */
.field input:focus ~ .field-icon,
.field input:not(:placeholder-shown) ~ .field-icon,
.field input:-webkit-autofill ~ .field-icon,
.field input:autofill ~ .field-icon { opacity: 0; }
.field label { position: absolute; left: 44px; top: 50%; transform: translateY(-50%); font-size: 14px; font-weight: 600; color: var(--ink-soft); pointer-events: none; transition: all 0.18s ease; }
.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label,
.field input:-webkit-autofill ~ label,
.field input:autofill ~ label {
    top: 12px; transform: translateY(0); font-size: 10px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
    color: var(--emerald-dark); left: 16px;
}
/* Chrome forces its own autofill background (a light yellow/blue box) via an
   internal UA style that ordinary background/color rules can't override
   directly — this pushes it transparent after a long delay so our own
   var(--field-bg) shows through instead of clashing with the floated label. */
.field input:-webkit-autofill,
.field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    transition: background-color 9999s ease-in-out 0s;
}

.terms-box {
    display: flex; align-items: center; margin: 14px 0 16px;
    background: var(--field-bg); padding: 13px 14px; border-radius: var(--radius-md);
    border: 2px solid var(--line); grid-column: 1 / -1;
}
.terms-box input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--emerald); margin-right: 10px; flex-shrink: 0; }
.terms-box label { font-size: 12.5px; font-weight: 600; color: #475569; }

/* ---------- Primary CTA ---------- */
.btn-magic {
    width: 100%; background: linear-gradient(135deg, var(--emerald) 0%, var(--teal) 100%);
    color: #fff; border: none; padding: 17px; border-radius: var(--radius-md);
    font-size: 15px; font-weight: 700; cursor: pointer;
    box-shadow: 0 16px 32px rgba(16,185,129,0.4);
    display: flex; justify-content: center; align-items: center; gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    grid-column: 1 / -1; margin-bottom: 6px; min-height: 54px;
}
.btn-magic:hover { transform: translateY(-1px); box-shadow: 0 20px 40px rgba(16,185,129,0.48); }
.btn-magic:active { transform: scale(0.98); }

.bottom-link { text-align: center; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); grid-column: 1 / -1; margin-top: 16px; }
.bottom-link a { color: var(--emerald-dark); text-decoration: none; font-weight: 700; }
.bottom-link a:hover { text-decoration: underline; }

/* ============================================================
   Mobile — same single-card language, native app spacing
   ============================================================ */
@media (max-width: 560px) {
    body { padding: 0; }
    .app-card { border-radius: 0; box-shadow: none; min-height: 100vh; min-height: 100dvh; max-width: 100%; padding: 44px 22px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; justify-content: center; }
    .form-grid { grid-template-columns: 1fr; }
    .field input, .btn-magic, .btn-google { min-height: 52px; font-size: 16px; } /* 16px avoids iOS auto-zoom on focus */
    .app-head { margin-bottom: 22px; }
}
