*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg-0: #07091a;
    --bg-1: #0d1230;
    --accent-a: #7c5cff;
    --accent-b: #22d3ee;
    --accent-c: #ff5cae;
    --text:    #e7e9f7;
    --muted:   #9aa0c3;
    --danger:  #ff5577;
    --card:    rgba(255, 255, 255, 0.06);
    --border:  rgba(255, 255, 255, 0.12);
}

html {
    overflow-x: hidden;
    min-height: 100%;
    background-color: var(--bg-0);
    background-image:
        radial-gradient(1200px 800px at 20% 10%, #1a1450 0%, transparent 60%),
        radial-gradient(900px 700px at 90% 90%, #0a4a5c 0%, transparent 55%),
        linear-gradient(135deg, var(--bg-0), var(--bg-1));
    background-attachment: fixed;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background-color: var(--bg-0);
    display: grid;
    place-items: safe center;
    padding: 24px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (hover: none) and (pointer: coarse) {
    html { background-attachment: scroll; }
    html, body { overscroll-behavior-y: none; }
}

/* Animated background blobs */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: screen;
}
.blob.b1 { width: 520px; height: 520px; background: var(--accent-a); top: -160px; left: -120px; animation: float1 14s ease-in-out infinite; }
.blob.b2 { width: 480px; height: 480px; background: var(--accent-b); bottom: -160px; right: -120px; animation: float2 18s ease-in-out infinite; }
.blob.b3 { width: 360px; height: 360px; background: var(--accent-c); top: 40%; left: 55%; animation: float3 22s ease-in-out infinite; opacity: 0.35; }

@keyframes float1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(60px, 40px); } }
@keyframes float2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-50px, -30px); } }
@keyframes float3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-30px, 30px) scale(1.08); } }

/* Subtle grid */
body::before {
    content: "";
    position: fixed; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
    z-index: 0;
}

.card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 40px 36px 32px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    box-shadow:
        0 20px 60px rgba(0,0,0,0.45),
        inset 0 1px 0 rgba(255,255,255,0.08);
    animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Glowing border highlight */
.card::before {
    content: "";
    position: absolute; inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(124,92,255,0.6), rgba(34,211,238,0.0) 35%, rgba(255,92,174,0.5) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}
.brand-mark {
    width: 40px; height: 40px;
    border-radius: 12px;
    overflow: hidden;
    display: grid; place-items: center;
    box-shadow: 0 8px 24px rgba(124,92,255,0.45);
}
.brand-mark svg { width: 22px; height: 22px; color: white; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-name {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.3px;
}

h1 {
    margin: 0 0 6px;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.2px;
    background: linear-gradient(135deg, #ffffff, #c9c5ff 60%, #9be8ff);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}
.subtitle {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 14px;
}

form { display: flex; flex-direction: column; gap: 16px; }

.field { position: relative; }
.field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 8px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrap svg.icon {
    position: absolute;
    left: 14px;
    width: 18px; height: 18px;
    color: var(--muted);
    transition: color 0.2s ease;
    pointer-events: none;
}
.field input[type="text"],
.field input[type="password"] {
    width: 100%;
    padding: 14px 14px 14px 44px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.field input::placeholder { color: rgba(154,160,195,0.55); }
.field input:hover { background: rgba(255,255,255,0.06); }
.field input:focus {
    border-color: rgba(124,92,255,0.65);
    background: rgba(255,255,255,0.07);
    box-shadow: 0 0 0 4px rgba(124,92,255,0.18);
}
.field input:focus + .toggle-eye,
.input-wrap:focus-within svg.icon { color: var(--text); }

.toggle-eye {
    position: absolute;
    right: 12px;
    display: grid; place-items: center;
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}
.toggle-eye:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.toggle-eye svg { width: 18px; height: 18px; }

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}
.remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.remember input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox {
    width: 16px; height: 16px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    display: grid; place-items: center;
    transition: all 0.15s ease;
}
.checkbox svg { width: 11px; height: 11px; color: white; opacity: 0; transform: scale(0.6); transition: all 0.15s ease; }
.remember input:checked + .checkbox {
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    border-color: transparent;
}
.remember input:checked + .checkbox svg { opacity: 1; transform: scale(1); }

.forgot {
    font-size: 13px;
    color: #b3b8e0;
    text-decoration: none;
    transition: color 0.2s ease;
}
.forgot:hover { color: white; }

button.submit {
    margin-top: 10px;
    width: 100%;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    box-shadow: 0 10px 30px rgba(124,92,255,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
    letter-spacing: 0.2px;
}
button.submit:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 14px 36px rgba(124,92,255,0.45), inset 0 1px 0 rgba(255,255,255,0.3); }
button.submit:active { transform: translateY(0); }
button.submit::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}
button.submit:hover::after { transform: translateX(100%); }

.errors {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 85, 119, 0.08);
    border: 1px solid rgba(255, 85, 119, 0.3);
    color: #ffb3c2;
    font-size: 13.5px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.errors svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--danger); }
.errors ul { margin: 0; padding-left: 0; list-style: none; }

.footer {
    margin-top: 28px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
}
.footer a { color: #b3b8e0; text-decoration: none; }
.footer a:hover { color: white; }

/* Language switcher pill placed above the footer. */
.lang-switch {
    margin: 22px auto 0;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    width: max-content;
}
.card .lang-switch {
    display: flex;
    width: max-content;
    margin-left: auto;
    margin-right: auto;
}
.lang-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: 600 11.5px/1 'Inter', system-ui, sans-serif;
    letter-spacing: 0.6px;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.lang-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.lang-btn.active {
    background: linear-gradient(135deg, var(--accent-a, #7c5cff), var(--accent-b, #22d3ee));
    color: #0b0f1a;
    box-shadow: 0 4px 12px rgba(124,92,255,0.35);
}

@media (max-width: 480px) {
    .card { padding: 32px 24px 24px; border-radius: 18px; }
    h1 { font-size: 24px; }
}
