/* css/login.css */
/* Styles pour la page d'authentification (login.html) */

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo img {
    max-width: 120px;
    height: auto;
}

h2 {
    text-align: center;
    color: #333;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

input[type="email"], 
input[type="password"], 
input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    box-sizing: border-box;
}

input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.btn {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.3s;
}

.btn:hover {
    background: #5a6fd8;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    margin-top: 0.5rem;
}

.btn-secondary:hover {
    background: #5a6268;
}

.toggle-form {
    text-align: center;
    margin-top: 1rem;
    color: #666;
}

.toggle-form a {
    color: #667eea;
    text-decoration: none;
    cursor: pointer;
}

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

.forgot-password-link {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.forgot-password-link a {
    color: #667eea;
    text-decoration: none;
    cursor: pointer;
}

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

.error-message {
    background: #fee;
    color: #c33;
    padding: 0.5rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    display: none;
    line-height: 1.4;
}

/* Message de validation de mot de passe (ne pas être affecté par clearMessages) */
.password-validation-message {
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px;
    display: none;
    line-height: 1.4;
    font-size: 0.9em;
}

/* Classes pour les messages de correspondance de mot de passe */
.pwd-match-warning {
    display: block !important;
    background: #fff3cd !important;
    color: #856404 !important;
    padding: 8px !important;
    border-left: 4px solid #ffc107 !important;
    font-size: 0.9em !important;
    border-radius: 4px !important;
    margin-top: 10px !important;
    line-height: 1.4 !important;
}

.pwd-match-success {
    display: block !important;
    background: #d4edda !important;
    color: #155724 !important;
    padding: 8px !important;
    border-left: 4px solid #28a745 !important;
    font-size: 0.9em !important;
    border-radius: 4px !important;
    margin-top: 10px !important;
    line-height: 1.4 !important;
}

.pwd-match-hidden {
    display: none !important;
}

.success-message {
    background: #efe;
    color: #393;
    padding: 0.5rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    display: none;
}

.info-message {
    background: #e7f3ff;
    color: #0066cc;
    padding: 0.5rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    display: none;
}

.hidden {
    display: none;
}

.loading {
    opacity: 0.7;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.back-to-login {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.back-to-login a {
    color: #667eea;
    text-decoration: none;
    cursor: pointer;
}

.back-to-login a:hover {
    text-decoration: underline;
}

/* ============================================================ */
/* VALIDATION MOT DE PASSE                                      */
/* ============================================================ */

.password-strength {
    margin-top: 10px;
    margin-bottom: 15px;
}

.strength-bar {
    width: 100%;
    height: 6px;
    background-color: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    background-color: #e74c3c;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 3px;
}

.strength-text {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
}

.password-requirements {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 11px;
}

.password-requirements li {
    padding: 2px 0;
    color: #e74c3c;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

.password-requirements li:before {
    content: "○ ";
    margin-right: 5px;
}

.password-requirements li.valid {
    color: #27ae60;
    text-decoration: line-through;
}

.password-requirements li.valid:before {
    content: "✓ ";
    color: #27ae60;
}

.password-requirements li[style*="line-through"]:before {
    content: "✓ ";
    color: #27ae60;
}

/* Classe speciale pour l'exigence de confirmation */
.password-requirements li.confirm-requirement {
    color: #e74c3c; /* Rouge par defaut jusqu'a validation */
    font-weight: bold;
    background: #fff3cd;
    padding: 8px !important;
    border-radius: 3px;
    margin-top: 5px !important;
    border: 2px solid #ffc107;
}

.password-requirements li.confirm-requirement.valid {
    color: #27ae60;
    background: #d4edda;
    border-color: #28a745;
}

.password-requirements li.confirm-requirement:before {
    content: "○ ";
}

.password-requirements li.confirm-requirement[style*="line-through"]:before {
    content: "✓ ";
    color: #27ae60;
}

input[type="password"].invalid {
    border-color: #e74c3c;
}

input[type="password"].valid {
    border-color: #27ae60;
}

/* ============================================================ */
/* SELECTION DES VERGERS                                        */
/* ============================================================ */

.vergers-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
}

.vergers-section p {
    font-weight: 500;
    margin: 0 0 10px 0;
    color: #333;
}

.verger-checkbox {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 8px;
    background: white;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.verger-checkbox:hover {
    background: #f0f7ff;
    border-color: #667eea;
}

.verger-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.verger-checkbox label {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

.verger-name {
    font-weight: 500;
    color: #333;
}

.verger-description {
    color: #666;
    font-size: 0.85rem;
    margin-left: 8px;
}

.vergers-loading {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* ============================================================ */
/* RESPONSIVE                                                   */
/* ============================================================ */

@media (max-width: 480px) {
    .password-requirements {
        font-size: 10px;
    }
    
    .strength-text {
        font-size: 11px;
    }
    
    .auth-container {
        padding: 1.5rem;
    }
}