/* Shakkikoulu.fi — Kirjautumis- ja rekisteröitymissivujen tyylit
 *
 * Käytetään: login.php, register.php, login-code.php, login-child.php,
 *            register-school.php, register-club.php
 *
 * Vaatii: style.css (muuttujat ja perusreset)
 */

/* ── Sivupohja ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
}

.auth-page main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
}

/* ── Kortti (card) ── */
.auth-container {
    width: 100%;
    max-width: 480px;
    animation: authSlideUp 0.45s ease;
}

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

.auth-card {
    background: #fff;
    border: 1px solid var(--stone-light);
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.auth-card h1 {
    font-size: 1.75rem;
    margin-bottom: 0.4rem;
    color: var(--ink);
}

.auth-card .auth-subtitle {
    color: var(--stone);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* ── Lomakekentät ── */
.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--ink);
}

.auth-form label .req {
    color: #b91c1c;
    margin-left: 0.15rem;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"],
.auth-form input[type="tel"],
.auth-form input[type="url"],
.auth-form input[type="number"],
.auth-form select,
.auth-form textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    font-family: 'Source Sans 3', sans-serif;
    border: 1.5px solid var(--stone-light);
    background: var(--paper);
    color: var(--ink);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 150, 12, 0.1);
}

.auth-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2378716c' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.auth-form textarea {
    resize: vertical;
    min-height: 80px;
}

.auth-form .form-help {
    font-size: 0.8rem;
    color: var(--stone);
    margin-top: 0.3rem;
    line-height: 1.4;
}

/* ── Virheilmoitukset ── */
.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.form-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.hidden { display: none !important; }

/* ── Salasanan vahvuus ── */
.password-strength {
    margin-top: 0.6rem;
}

.strength-bar {
    height: 5px;
    background: var(--stone-light);
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.strength-bar-fill {
    height: 100%;
    width: 0;
    transition: width 0.3s, background-color 0.3s;
}

.strength-text {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: right;
}

.password-reqs {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--paper);
    border: 1px solid var(--stone-light);
}

.pw-req {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    color: var(--stone);
    transition: color 0.2s;
}

.pw-req:last-child { margin-bottom: 0; }
.pw-req.met { color: #15803d; }

.pw-req-icon {
    font-weight: 700;
    font-size: 0.85rem;
    width: 1rem;
    text-align: center;
}

/* ── Painikkeet ── */
.auth-form .btn-submit {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Source Sans 3', sans-serif;
    background: var(--ink);
    color: var(--paper);
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    margin-top: 0.5rem;
    letter-spacing: 0.01em;
}

.auth-form .btn-submit:hover {
    background: #2c2825;
    transform: translateY(-1px);
}

.auth-form .btn-submit:active { transform: translateY(0); }

.auth-form .btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-submit-gold {
    background: var(--gold) !important;
    color: var(--ink) !important;
}

.btn-submit-gold:hover {
    background: var(--gold-muted) !important;
}

/* ── Muista minut + Unohtunut salasana ── */
.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}

.remember-forgot label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0;
}

.remember-forgot input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
    accent-color: var(--gold);
}

.remember-forgot a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 500;
}

.remember-forgot a:hover { color: var(--ink); }

/* ── Erotinviiva ── */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    gap: 1rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--stone-light);
}

.auth-divider span {
    font-size: 0.8rem;
    color: var(--stone);
}

/* ── Linkit kortin alaosassa ── */
.auth-links {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--stone-light);
    text-align: center;
    font-size: 0.9rem;
    line-height: 2;
    color: var(--stone);
}

.auth-links a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
}

.auth-links a:hover { color: var(--ink); }

/* ── Käyttöehdot-valintaruutu ── */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.form-check input[type="checkbox"] {
    width: auto;
    margin-top: 0.2rem;
    cursor: pointer;
    accent-color: var(--gold);
    flex-shrink: 0;
}

.form-check label {
    margin: 0;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--stone);
}

.form-check a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
}

.form-check a:hover { text-decoration: underline; }

/* ── Koodikirjautumisen ruudut ── */
.code-input-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.code-input-group input {
    width: 3.2rem;
    height: 3.8rem;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    font-family: 'Cormorant Garamond', serif;
    border: 1.5px solid var(--stone-light);
    background: var(--paper);
    color: var(--ink);
    text-transform: uppercase;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.code-input-group input:focus {
    outline: none;
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(184, 150, 12, 0.1);
}

/* ── Lapsikirjautumisen profiilivalitsin ── */
.child-profiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.child-profile-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: var(--paper);
    border: 2px solid var(--stone-light);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: 'Source Sans 3', sans-serif;
}

.child-profile-btn:hover {
    border-color: var(--gold-muted);
    background: #fff;
}

.child-profile-btn.selected {
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(184, 150, 12, 0.1);
}

.child-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gold-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    font-family: 'Cormorant Garamond', serif;
}

.child-profile-btn .child-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink);
}

/* ── Tilityyppitabit (rekisteröinti) ── */
.account-tabs {
    display: flex;
    border: 1.5px solid var(--stone-light);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.account-tab {
    flex: 1;
    padding: 0.85rem 0.5rem;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--stone);
    background: var(--paper);
    border: none;
    transition: all 0.2s;
    font-family: 'Source Sans 3', sans-serif;
    border-right: 1.5px solid var(--stone-light);
}

.account-tab:last-child { border-right: none; }

.account-tab:hover {
    background: var(--paper-warm);
    color: var(--ink);
}

.account-tab.active {
    background: var(--ink);
    color: var(--paper);
}

/* ── Info-laatikko ── */
.auth-info-box {
    background: var(--paper-warm);
    border: 1px solid var(--stone-light);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--ink);
}

.auth-info-box strong {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gold);
    margin-bottom: 0.3rem;
}

/* ── Honeypot ── */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    tab-index: -1;
}

/* ── Kortin leveyden muokkaajat ── */
.auth-container--wide {
    max-width: 560px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .auth-page main {
        padding: 1.5rem 1rem;
        align-items: flex-start;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
    }

    .auth-card h1 {
        font-size: 1.5rem;
    }

    .code-input-group input {
        width: 2.7rem;
        height: 3.2rem;
        font-size: 1.35rem;
    }

    .child-profiles {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .remember-forgot {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .account-tabs {
        flex-direction: column;
    }

    .account-tab {
        border-right: none;
        border-bottom: 1.5px solid var(--stone-light);
    }

    .account-tab:last-child { border-bottom: none; }
}
