/* Strona logowania panelu – "Asfalt" */
:root {
    --bg: #0c0e12;
    --card: #14171d;
    --line: #262b34;
    --text: #eef0f4;
    --muted: #8b93a1;
    --accent: #1e90e6;
    --accent-2: #5ac1ff;
    --danger: #ff4d5e;
    --ok: #34d399;
}

html body {
    box-sizing: border-box; /* bez tego width:100% + padding dawało 100% + 32px i całość wychodziła poza ekran */
    align-items: center;
    background:
        radial-gradient(900px 500px at 50% -10%, rgba(30, 144, 230, 0.14), transparent 70%),
        radial-gradient(700px 400px at 100% 100%, rgba(90, 193, 255, 0.06), transparent 70%),
        var(--bg);
    color: var(--text);
    display: flex;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
    justify-content: center;
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
    padding: 16px 16px 150px;
    position: relative;
    width: 100%;
}

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

/* Formularz jest elementem flex w <body>: bez jawnej szerokości rozpychał się szerzej niż ekran telefonu. */
html body > form {
    flex: 0 1 400px;
    max-width: 100%;
    min-width: 0;
    width: min(400px, 100%);
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

html body {
    max-width: 100vw;
    overflow-x: hidden;
}

.login,
.login__card,
.login__field,
.login__input,
.login__button {
    max-width: 100%;
    min-width: 0;
}

/* ---------- Karta ---------- */
.login {
    position: relative;
    width: 100%;
    z-index: 2;
}

.login__card {
    animation: cardIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)), var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    margin: 0 auto;
    max-width: 400px;
    width: 100%;
    overflow: hidden;
    padding: 38px 34px 34px;
    position: relative;
}

/* Niebieska linia na górze karty */
.login__card::before {
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
    content: '';
    height: 2px;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.login__logo {
    margin: 0 0 4px;
    text-align: center;
}

.login__logo img {
    display: block;
    height: auto;
    margin: -18px auto -22px;
    max-width: 300px;
    width: 100%;
}

.login__tagline {
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.4px;
    margin: 0 0 28px;
    text-align: center;
}

/* ---------- Pola ---------- */
.login__field {
    margin-bottom: 18px;
}

.login__label {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.6px;
    margin-bottom: 7px;
    text-transform: uppercase;
}

.login__input {
    background: #0f1217;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    outline: none;
    padding: 14px 16px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    width: 100%;
}

.login__input:hover {
    border-color: #343a46;
}

.login__input:focus {
    background: #11151b;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(30, 144, 230, 0.16);
}

/* Autouzupełnianie przeglądarki nie może jaśnieć */
.login__input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 100px #0f1217 inset;
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
}

.login__captcha {
    display: flex;
    justify-content: center;
    margin: 6px 0 14px;
}

/* ---------- Przycisk ---------- */
.login__button {
    align-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: 0;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(30, 144, 230, 0.32);
    color: #04131f;
    cursor: pointer;
    display: flex;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    padding: 15px 20px;
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
    width: 100%;
}

.login__button svg {
    transition: transform 0.2s;
}

.login__button:hover {
    box-shadow: 0 14px 34px rgba(30, 144, 230, 0.42);
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.login__button:hover svg {
    transform: translateX(4px);
}

.login__button:active {
    transform: translateY(1px);
}

.login__button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ---------- Droga i opona ---------- */
.road {
    bottom: 0;
    height: 120px;
    left: 0;
    pointer-events: none;
    position: fixed;
    right: 0;
    z-index: 1;
}

.road::before {
    background: linear-gradient(180deg, #171a20, #0e1014);
    border-top: 1px solid var(--line);
    content: '';
    inset: 0;
    position: absolute;
}

.road__line {
    animation: roadMove 1.1s linear infinite;
    background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 46px, transparent 46px 96px);
    background-size: 96px 100%;
    bottom: 18px;
    height: 4px;
    left: 0;
    position: absolute;
    right: 0;
}

@keyframes roadMove {
    from { background-position: 0 0; }
    to { background-position: -96px 0; }
}

.road__tire {
    bottom: 26px;
    left: 50%;
    margin-left: -60px;
    position: absolute;
}

.road__tire-spin {
    animation: tireSpin 1.1s linear infinite;
    transform-box: fill-box;
    transform-origin: center;
}

@keyframes tireSpin {
    to { transform: rotate(-360deg); }
}

/* Po wysłaniu formularza wszystko przyspiesza */
body.is-driving .road__line,
body.is-driving .road__tire-spin {
    animation-duration: 0.22s;
}

body.is-driving .login__card {
    opacity: 0.85;
    transition: opacity 0.4s;
}

/* ---------- Komunikaty ---------- */
#fmNotice,
#fmError {
    backdrop-filter: blur(10px);
    margin-left: 0; /* messages.css (.fmMessage) ustawia margin-left: -40% */
    opacity: 1;
    width: auto;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    left: 50%;
    max-width: 92%;
    min-width: 260px;
    padding: 14px 20px;
    position: fixed;
    text-align: center;
    top: 16px;
    transform: translateX(-50%);
    z-index: 1000;
}

#fmNotice {
    background: rgba(52, 211, 153, 0.14);
    border: 1px solid rgba(52, 211, 153, 0.4);
    color: #d6fbe9;
}

#fmError {
    background: rgba(255, 77, 94, 0.14);
    border: 1px solid rgba(255, 77, 94, 0.45);
    color: #ffdfe3;
}

@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -100%); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes slideUp {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, -100%); }
}

/* ---------- Małe ekrany ---------- */
@media (max-width: 420px) {
    .login__card {
        padding: 30px 22px 26px;
    }

    html body {
        padding-bottom: 130px;
    }

    .road {
        height: 100px;
    }

    .road__tire {
        bottom: 20px;
        height: 96px;
        margin-left: -48px;
        width: 96px;
    }

    .road__line {
        bottom: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
