/* Zdieľaný dizajn auth stránok (login, registrácia) podľa design/DESIGN.md a design/login.html. */

.auth-page {
    /* Farebné tokeny dizajn systému */
    --surface: #f8f9ff;
    --surface-dim: #cbdbf5;
    --surface-container: #e5eeff;
    --surface-container-lowest: #ffffff;
    --on-surface: #0b1c30;
    --on-surface-variant: #45474c;
    --outline-variant: #c5c6cd;
    --primary: #091426;
    --primary-container: #1e293b;
    --on-primary: #ffffff;
    --primary-fixed: #d8e3fb;
    --secondary: #9d4300;
    --secondary-container: #fd761a;
    --secondary-fixed: #ffdbca;
    --tertiary-accent: #0099d9;
    --error-container: #ffdad6;
    --on-error-container: #93000a;

    position: fixed;
    inset: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Vertikálne centruje margin: auto na .auth-card-wrap - ZÁMERNE nie justify-content:
       center, ten by pri okne nižšom než obsah oddol vrch formulára mimo scroll. */
    background: var(--surface);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--on-surface);
}

/* Atmosférické pozadie - rozostrená fotka arény so svetlým prekrytím pre čitateľnosť karty.
   position: fixed + scale namiesto presahu cez inset, aby pozadie nevytváralo pretečenie
   (a tým zbytočný scrollbar); scale skryje svetlé okraje blur-u. */
.auth-bg {
    position: fixed;
    inset: 0;
    background: url('../img/login-background.png') center / cover no-repeat var(--primary);
    filter: blur(6px);
    transform: scale(1.03);
}

.auth-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(248, 249, 255, 0.60) 0%, rgba(248, 249, 255, 0.35) 50%, rgba(203, 219, 245, 0.45) 100%);
}

.auth-card-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    padding: 16px;
    margin: auto 0;
}

@media (min-width: 768px) {
    .auth-card-wrap {
        padding: 32px;
    }
}

.auth-card {
    position: relative;
    overflow: hidden;
    background: var(--surface-container-lowest);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(9, 20, 38, 0.25);
}

/* Dekoratívne rozostrené kruhy v rohoch karty */
.glow {
    position: absolute;
    border-radius: 9999px;
    pointer-events: none;
}

.glow-tr {
    top: -48px;
    right: -48px;
    width: 128px;
    height: 128px;
    background: rgba(216, 227, 251, 0.35);
    filter: blur(40px);
}

.glow-bl {
    bottom: -64px;
    left: -64px;
    width: 192px;
    height: 192px;
    background: rgba(255, 219, 202, 0.25);
    filter: blur(64px);
}

.auth-head {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
    text-align: center;
}

.auth-logo {
    height: 80px;
    width: auto;
    margin-bottom: 12px;
}

.auth-head h1 {
    margin: 0 0 4px;
    font-size: 32px;
    line-height: 40px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--on-surface);
}

.auth-head p {
    margin: 0;
    max-width: 300px;
    font-size: 16px;
    line-height: 24px;
    color: var(--on-surface-variant);
}

/* Alerty */
.alert {
    position: relative;
    z-index: 1;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 20px;
}

.alert-error {
    background: var(--error-container);
    color: var(--on-error-container);
}

.alert-success {
    background: #dcf5e3;
    color: #14532d;
}

.alert-warning {
    background: #fef3c7;
    color: #854d0e;
}

/* Formulár */
.auth-form {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-password {
    position: relative;
}

/* Vizuálne v riadku s labelom, ale v DOM až za poľom hesla (kvôli Tab poradiu). */
.forgot-link {
    position: absolute;
    top: 0;
    right: 0;
}

.field label {
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
    transition: color 0.15s ease;
}

.field:focus-within label {
    color: var(--primary);
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    width: 22px;
    height: 22px;
    fill: var(--on-surface-variant);
    transition: fill 0.15s ease;
    pointer-events: none;
}

.field:focus-within .input-icon {
    fill: var(--primary);
}

.input-wrap input {
    width: 100%;
    padding: 15px 16px 15px 48px;
    background: var(--surface);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    line-height: 24px;
    color: var(--on-surface);
    outline: none;
    box-shadow: 0 0 0 1px var(--outline-variant), 0 1px 2px rgba(9, 20, 38, 0.05);
    transition: box-shadow 0.15s ease;
}

.input-wrap input::placeholder {
    color: rgba(69, 71, 76, 0.5);
}

.input-wrap input:focus {
    box-shadow: 0 0 0 2px var(--primary), 0 1px 2px rgba(9, 20, 38, 0.05);
}

#password {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.toggle-password svg {
    width: 20px;
    height: 20px;
    fill: var(--on-surface-variant);
    transition: fill 0.15s ease;
}

.toggle-password:hover svg {
    fill: var(--on-surface);
}

/* Odkazy */
.link-secondary {
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.link-secondary:hover {
    color: var(--secondary-container);
}

.link-secondary:focus-visible {
    outline: none;
    text-decoration: underline;
}

/* Primárne tlačidlo */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    padding: 15px 16px;
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 18px;
    line-height: 26px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(9, 20, 38, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.15s ease;
}

.btn-primary:hover {
    background: var(--primary-container);
    box-shadow: 0 10px 15px -3px rgba(9, 20, 38, 0.25);
    transform: translateY(-2px);
}

.btn-primary:hover svg {
    transform: translateX(4px);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:focus-visible {
    outline: 2px solid var(--tertiary-accent);
    outline-offset: 2px;
}

/* Stav počas odosielania formulára */
.btn-primary:disabled {
    opacity: 0.8;
    cursor: wait;
    transform: none;
    box-shadow: 0 4px 6px -1px rgba(9, 20, 38, 0.2);
}

.btn-loading svg {
    display: none;
}

.btn-loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: var(--on-primary);
    border-radius: 9999px;
    animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Registrácia */
.auth-switch {
    position: relative;
    z-index: 1;
    margin-top: 32px;
    text-align: center;
}

.auth-switch p {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--on-surface-variant);
}

.auth-switch a {
    margin-left: 4px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-switch a:hover {
    color: var(--primary-container);
}

.auth-switch a:focus-visible {
    outline: none;
    text-decoration: underline;
}

/* Prepínač jazyka */
.auth-cultures {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.culture-btn {
    padding: 4px 10px;
    background: none;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 11px;
    line-height: 14px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.culture-btn:hover {
    color: var(--on-surface);
    background: var(--surface-container);
}

/* Pätička */
.auth-footer {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    opacity: 0.6;
}

.auth-footer span {
    font-size: 11px;
    line-height: 14px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
}

/* Malé obrazovky: bez obrázka pozadia, formulár na celú šírku aj výšku.
   Musí byť na konci súboru, aby prebilo základné pravidlá vyššie. */
@media (max-width: 600px) {
    .auth-page {
        background: var(--surface-container-lowest);
    }

    .auth-bg {
        display: none;
    }

    .auth-card-wrap {
        max-width: none;
        min-height: 100%;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
    }

    .auth-card {
        /* flex-basis auto + flex-shrink 0: karta sa pri malom obsahu roztiahne na výšku okna,
           pri veľkom obsahu narastie podľa obsahu a stránka sa scrolluje. So základným flex: 1
           (basis 0) by ju overflow: hidden nechal orezanú bez možnosti scrollu. */
        flex: 1 0 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        border-radius: 0;
        box-shadow: none;
        padding: 32px 20px;
    }

    .auth-footer {
        margin: 0;
        padding: 12px 0 16px;
    }
}

/* Select v rovnakom štýle ako textové polia (registrácia) */
.input-wrap select {
    width: 100%;
    padding: 15px 44px 15px 48px;
    background: var(--surface);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    line-height: 24px;
    color: var(--on-surface);
    outline: none;
    box-shadow: 0 0 0 1px var(--outline-variant), 0 1px 2px rgba(9, 20, 38, 0.05);
    transition: box-shadow 0.15s ease;
    appearance: none;
    cursor: pointer;
}

.input-wrap select:focus {
    box-shadow: 0 0 0 2px var(--primary), 0 1px 2px rgba(9, 20, 38, 0.05);
}

.select-chevron {
    position: absolute;
    right: 16px;
    width: 20px;
    height: 20px;
    fill: var(--on-surface-variant);
    pointer-events: none;
}

/* Dva stĺpce vedľa seba (meno + priezvisko) */
.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 440px) {
    .field-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}
