/**
 * PS Login Manager - Styles de la page de connexion
 * Design inspiré du Portail Salarié
 * 
 * @package PS_Login_Manager
 * @since 1.0.0
 */

/* Reset et base */
body.login {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%) !important;
    min-height: 100vh;
}

#login {
    width: 100% !important;
    max-width: 480px !important;
    padding: 20px !important;
    margin: 0 auto !important;
}

/* Logo header */
.pslm-login-header {
    text-align: center;
    margin-bottom: 20px;
}

.pslm-login-logo {
    max-width: 200px;
    height: auto;
}

/* Container principal */
.pslm-login-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 40px;
    margin-top: 20px;
    overflow: hidden; /* v1.4.27: évite débordement sur mobile */
}

/* Header du box */
.pslm-login-box-header {
    text-align: center;
    margin-bottom: 30px;
}

.pslm-login-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.pslm-login-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}

.pslm-login-subtitle {
    font-size: 15px;
    color: #64748b;
    margin: 0;
}

.pslm-login-instruction {
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Vues */
.pslm-login-view {
    display: none;
}

.pslm-login-view.active {
    display: block;
}

/* Méthodes de connexion */
.pslm-login-methods {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.pslm-method-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.pslm-method-btn:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.pslm-method-btn:active {
    transform: translateY(0);
}

/* v1.4.19: Conteneur pour le shortcode WPO365 - même style que les autres boutons */
.pslm-wpo365-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 120px;
    overflow: hidden; /* v1.4.27: évite débordement sur mobile */
}

.pslm-wpo365-container:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.pslm-wpo365-container .wpo365-mssignin-wrapper,
.pslm-wpo365-container .wpo365-mssignin-spacearound,
.pslm-wpo365-container #wpo365OpenIdRedirect {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.pslm-wpo365-container .wpo365-mssignin-button {
    width: 100% !important;
    height: 100% !important;
    min-height: 118px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 20px 15px !important;
}

.pslm-wpo365-container .wpo365-mssignin-button:hover {
    background: transparent !important;
}

.pslm-wpo365-container .wpo365-mssignin-logo {
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.pslm-wpo365-container .wpo365-mssignin-logo svg {
    width: 32px !important;
    height: 32px !important;
}

.pslm-wpo365-container .wpo365-mssignin-label {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    padding: 0 !important;
    height: auto !important;
    line-height: 1.3 !important;
    text-align: center !important;
}

.pslm-method-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #f8fafc;
    border-radius: 10px;
}

.pslm-method-label {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.pslm-method-desc {
    font-size: 12px;
    color: #94a3b8;
}

/* v1.4.25: Warning Inéa uniquement */
.pslm-method-warning {
    font-weight: 700;
    color: #d97706;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.pslm-warning-icon {
    font-size: 11px;
}

/* v1.4.25: Méthode principale (Microsoft) pleine largeur */
.pslm-primary-method {
    margin-bottom: 12px;
}

.pslm-method-btn-full {
    width: 100%;
}

.pslm-method-btn-full.pslm-wpo365-container {
    min-height: 80px;
}

.pslm-method-btn-full .wpo365-mssignin-button {
    flex-direction: row !important;
    min-height: 78px !important;
    gap: 12px !important;
}

.pslm-method-btn-full .wpo365-mssignin-logo {
    margin-bottom: 0 !important;
}

/* v1.4.25: Méthodes secondaires (Email / SMS) */
.pslm-secondary-methods {
    margin-bottom: 0;
}

/* v1.4.25: Section Accès admin */
.pslm-admin-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    position: relative;
}

.pslm-admin-section-label {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 0 12px;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pslm-admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    font-size: 13px;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.pslm-admin-btn:hover {
    color: #475569;
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.pslm-admin-btn-icon {
    font-size: 14px;
}

.pslm-admin-btn-text {
    font-weight: 500;
}

/* Titre de méthode */
.pslm-login-method-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
}

/* Formulaires */
.pslm-login-form {
    margin-bottom: 20px;
}

.pslm-field {
    margin-bottom: 20px;
}

.pslm-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.pslm-field input[type="text"],
.pslm-field input[type="email"],
.pslm-field input[type="password"],
.pslm-field input[type="tel"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.pslm-field input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.pslm-field input::placeholder {
    color: #94a3b8;
}

/* Champ mot de passe avec toggle */
.pslm-password-field {
    position: relative;
}

.pslm-password-field input {
    padding-right: 50px;
}

.pslm-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}

/* Checkbox */
.pslm-field-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.pslm-field-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.pslm-field-checkbox label {
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    margin: 0;
}

/* Bouton submit */
.pslm-submit-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pslm-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.pslm-submit-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Lien mot de passe oublié */
.pslm-forgot-password {
    display: block;
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: #667eea;
    text-decoration: none;
}

.pslm-forgot-password:hover {
    text-decoration: underline;
}

/* Texte d'aide */
.pslm-help-text {
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
    margin-top: 15px;
}

.pslm-inea-notice {
    color: #64748b;
    font-style: italic;
}

/* Bouton retour */
.pslm-back-btn {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 14px;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: color 0.2s ease;
}

.pslm-back-btn:hover {
    color: #1e293b;
}

/* Messages */
.pslm-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: none;
}

.pslm-message.success {
    display: block;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.pslm-message.error {
    display: block;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.pslm-message.info {
    display: block;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Code OTP */
.pslm-code-input {
    font-size: 28px !important;
    letter-spacing: 10px !important;
    text-align: center !important;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace !important;
    font-weight: 600 !important;
}

/* Info envoyé à */
.pslm-sent-to {
    text-align: center;
    font-size: 14px;
    color: #64748b;
    margin-bottom: 20px;
}

.pslm-sent-to strong {
    color: #1e293b;
}

/* Timer et resend */
.pslm-otp-timer {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    margin-top: 15px;
}

.pslm-resend-btn {
    display: block;
    width: 100%;
    padding: 10px;
    font-size: 14px;
    color: #667eea;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: center;
    margin-top: 10px;
}

.pslm-resend-btn:hover:not(.disabled) {
    text-decoration: underline;
}

.pslm-resend-btn.disabled {
    color: #cbd5e1;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 520px) {
    .pslm-login-container {
        padding: 30px 20px;
        border-radius: 12px;
    }
    
    .pslm-login-methods {
        grid-template-columns: 1fr;
    }
    
    .pslm-method-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: 15px;
        gap: 15px;
    }
    
    .pslm-method-icon {
        margin-bottom: 0;
    }
    
    .pslm-method-btn > span:not(.pslm-method-icon) {
        text-align: left;
    }
    
    .pslm-login-title {
        font-size: 24px;
    }
    
    .pslm-code-input {
        font-size: 24px !important;
        letter-spacing: 6px !important;
    }
    
    /* v1.4.27: Fix bouton Microsoft sur mobile */
    .pslm-primary-method {
        width: 100%;
        overflow: hidden;
    }
    
    .pslm-method-btn-full.pslm-wpo365-container {
        min-height: 60px;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden;
    }
    
    .pslm-wpo365-container .wpo365-mssignin-wrapper,
    .pslm-wpo365-container .wpo365-mssignin-spacearound,
    .pslm-wpo365-container #wpo365OpenIdRedirect {
        max-width: 100% !important;
        overflow: hidden !important;
    }
    
    .pslm-wpo365-container .wpo365-mssignin-button {
        min-height: 58px !important;
        max-width: 100% !important;
        padding: 12px 15px !important;
        flex-direction: row !important;
        gap: 10px !important;
    }
    
    .pslm-wpo365-container .wpo365-mssignin-logo {
        width: 32px !important;
        height: 32px !important;
        flex-shrink: 0;
    }
    
    .pslm-wpo365-container .wpo365-mssignin-logo svg {
        width: 24px !important;
        height: 24px !important;
    }
    
    .pslm-wpo365-container .wpo365-mssignin-label {
        font-size: 14px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* Animation de chargement */
.pslm-submit-btn.loading {
    position: relative;
    color: transparent;
}

.pslm-submit-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: pslm-spin 0.8s linear infinite;
}

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