/* ============================================
   Thème Keycloak - Secours Populaire Français
   Page de login ATRIUM
   ============================================ */

/* --- Variables --- */
:root {
    --spf-blue: #1a2466;
    --spf-blue-dark: #0f1740;
    --spf-red: #E2001A;
    --spf-red-dark: #B8001A;
    --spf-white: #FFFFFF;
    --spf-grey-bg: #F5F5F5;
    --spf-grey-border: #CCCCCC;
    --spf-grey-text: #999999;
    --spf-text: #333333;
    --spf-error: #D32F2F;
    --spf-radius: 4px;
    --spf-transition: all 0.2s ease;
}

/* --- Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Open Sans', 'Segoe UI', Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: var(--spf-text);
    background-color: var(--spf-white);
}

/* --- Masquer les éléments par défaut de Keycloak --- */
#kc-header,
#kc-header-wrapper,
#kc-content-wrapper > h1,
#kc-locale,
#kc-info-wrapper {
    display: none !important;
}

#kc-content {
    padding: 0 !important;
    margin: 0 !important;
}

.login-pf-page {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 100vh;
}

#kc-form-wrapper {
    padding: 0;
    margin: 0;
}

/* --- Layout principal : 2 colonnes --- */
.spf-page-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
    align-items: center;
}

/* --- Colonne gauche : Formulaire --- */
.spf-left-panel {
    width: 35%;
    min-width: 380px;
    max-width: 480px;
    padding: 40px 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--spf-white);
}

/* --- Colonne droite : Bannière --- */
.spf-right-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--spf-white);
    padding: 40px;
    overflow: hidden;
}

.spf-banner-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

/* --- Logo & Titre ATRIUM --- */
.spf-logo-block {
    text-align: center;
    margin-bottom: 30px;
}

.spf-logo {
    max-width: 80px;
    height: auto;
    margin-bottom: 8px;
}

.spf-atrium-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--spf-blue);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 0;
}

/* --- Zone de notification --- */
.spf-notification {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid;
    border-left: 4px solid;
    border-radius: var(--spf-radius);
    position: relative;
}

/* Status : info (bleu) — défaut */
.spf-notification-info {
    background-color: #EEF2FF;
    border-color: #C7D2FE;
    border-left-color: var(--spf-blue);
    color: var(--spf-blue);
}

.spf-notification-info .spf-notification-title { color: var(--spf-blue); }
.spf-notification-info .spf-notification-body { color: var(--spf-blue-dark); }
.spf-notification-info .spf-notification-icon { color: var(--spf-blue); }
.spf-notification-info .spf-notification-close { color: var(--spf-blue); }

/* Status : warning (orange) */
.spf-notification-warning {
    background-color: #FFF8E1;
    border-color: #FFE082;
    border-left-color: #F59E0B;
    color: #92400E;
}

.spf-notification-warning .spf-notification-title { color: #92400E; }
.spf-notification-warning .spf-notification-body { color: #78350F; }
.spf-notification-warning .spf-notification-icon { color: #F59E0B; }
.spf-notification-warning .spf-notification-close { color: #92400E; }

/* Status : danger (rouge) */
.spf-notification-danger {
    background-color: #FEF2F2;
    border-color: #FECACA;
    border-left-color: #DC2626;
    color: #991B1B;
}

.spf-notification-danger .spf-notification-title { color: #991B1B; }
.spf-notification-danger .spf-notification-body { color: #7F1D1D; }
.spf-notification-danger .spf-notification-icon { color: #DC2626; }
.spf-notification-danger .spf-notification-close { color: #991B1B; }

.spf-notification-icon {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--spf-blue);
}

.spf-notification-content {
    flex: 1;
    min-width: 0;
}

.spf-notification-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--spf-blue);
    margin-bottom: 4px;
}

.spf-notification-body {
    font-size: 12px;
    color: var(--spf-blue-dark);
    line-height: 1.5;
}

.spf-notification-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--spf-blue);
    opacity: 0.5;
    padding: 2px;
    transition: var(--spf-transition);
}

.spf-notification-close:hover {
    opacity: 1;
}

/* --- Formulaire --- */
#kc-form-login {
    width: 100%;
}

.spf-form-group {
    margin-bottom: 16px;
    width: 100%;
}

/* --- Champ input avec icône --- */
.spf-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--spf-grey-border);
    border-radius: var(--spf-radius);
    transition: var(--spf-transition);
    background: var(--spf-white);
}

.spf-input-wrapper:focus-within {
    border-color: var(--spf-blue);
    box-shadow: 0 0 0 2px rgba(26, 36, 102, 0.1);
}

.has-error .spf-input-wrapper {
    border-color: var(--spf-error);
}

.spf-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-width: 48px;
    height: 48px;
    background-color: var(--spf-grey-bg);
    border-right: 1px solid var(--spf-grey-border);
}

.spf-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--spf-text);
    background: transparent;
    height: 48px;
}

.spf-input::placeholder {
    color: var(--spf-grey-text);
}

/* --- Bouton toggle password (oeil) --- */
.spf-toggle-password {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-width: 48px;
    height: 48px;
    background-color: var(--spf-blue);
    border: none;
    cursor: pointer;
    transition: var(--spf-transition);
}

.spf-toggle-password:hover {
    background-color: var(--spf-blue-dark);
}

/* --- Erreurs --- */
.spf-error-msg {
    display: block;
    font-size: 12px;
    color: var(--spf-error);
    margin-top: 4px;
}

/* --- Alertes --- */
.spf-alert {
    padding: 12px 16px;
    border-radius: var(--spf-radius);
    margin-bottom: 16px;
    font-size: 13px;
    width: 100%;
}

.spf-alert-error {
    background-color: #FDECEA;
    border: 1px solid #F5C6CB;
    color: var(--spf-error);
}

.spf-alert-warning {
    background-color: #FFF3CD;
    border: 1px solid #FFE69C;
    color: #856404;
}

.spf-alert-success {
    background-color: #D4EDDA;
    border: 1px solid #C3E6CB;
    color: #155724;
}

.spf-alert-info {
    background-color: #D1ECF1;
    border: 1px solid #BEE5EB;
    color: #0C5460;
}

/* --- Boutons --- */
.spf-form-buttons {
    width: 100%;
    margin-bottom: 10px;
}

.spf-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--spf-radius);
    cursor: pointer;
    transition: var(--spf-transition);
    text-align: center;
    letter-spacing: 0.3px;
    border: 2px solid transparent;
}

.spf-btn-primary {
    color: var(--spf-white);
    background-color: var(--spf-blue);
    border-color: var(--spf-blue);
}

.spf-btn-primary:hover {
    background-color: var(--spf-blue-dark);
    border-color: var(--spf-blue-dark);
}

.spf-btn-secondary {
    color: var(--spf-blue);
    background-color: var(--spf-white);
    border-color: var(--spf-blue);
}

.spf-btn-secondary:hover {
    background-color: var(--spf-grey-bg);
}

/* --- Liens sous le formulaire --- */
.spf-support-links {
    margin-top: 24px;
    text-align: center;
    width: 100%;
}

.spf-link-support {
    display: block;
    font-size: 14px;
    color: var(--spf-text);
    text-decoration: underline;
    margin-bottom: 14px;
    font-weight: 700;
}

.spf-link-support:hover {
    color: var(--spf-blue);
}

.spf-link-secondary {
    display: block;
    font-size: 12px;
    color: var(--spf-grey-text);
    text-decoration: underline;
    margin-bottom: 4px;
}

.spf-link-secondary:hover {
    color: var(--spf-blue);
}

.spf-teamviewer-links {
    margin-top: 16px;
}

/* --- Responsive --- */
@media screen and (max-width: 900px) {
    .spf-page-wrapper {
        flex-direction: column;
    }

    .spf-left-panel {
        width: 100%;
        min-width: unset;
        max-width: unset;
        padding: 30px 24px;
    }

    .spf-right-panel {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .spf-left-panel {
        padding: 20px 16px;
    }

    .spf-logo {
        max-width: 60px;
    }

    .spf-atrium-title {
        font-size: 14px;
    }

    .spf-btn {
        padding: 12px;
        font-size: 14px;
    }
}

/* Petits écrans en hauteur : autoriser le scroll interne du panel */
@media screen and (max-height: 650px) {
    .spf-left-panel {
        max-height: 100vh;
        overflow-y: auto;
    }
}