/**
 * Styles pour le modal de candidature
 * Cosmos Group - Version 2.0
 */

/* Police système */
* {
    font-family: Verdana, Geneva, sans-serif;
}

/* Modal de candidature */
.application-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.application-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: translateY(-50px) scale(0.9);
    transition: all 0.3s ease;
}

.application-modal.active .modal-container {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 0;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* Informations du poste */
.job-info {
    padding: 24px 32px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.job-info h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
}

.job-info p {
    margin: 4px 0;
    color: #6c757d;
    font-size: 0.95rem;
}

.job-info p i {
    margin-right: 8px;
    color: #667eea;
}

/* Formulaire */
.application-form {
    padding: 32px;
}

.form-section {
    margin-bottom: 32px;
}

.form-section h4 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Messages d'erreur */
.error-message {
    display: none;
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Upload de fichier */
.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-input-display:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.file-input-display i {
    margin-right: 8px;
    color: #667eea;
    font-size: 1.2rem;
}

.file-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: #e8f4f8;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.file-info i {
    margin-right: 8px;
    color: #667eea;
}

/* Compteur de caractères */
.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 4px;
}

.char-counter.over-limit {
    color: #dc3545;
    font-weight: 600;
}

/* Actions du formulaire */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
    margin-top: 32px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background: #5a6268;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-width: 180px;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: none;
    align-items: center;
    gap: 8px;
}

.btn-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Notifications */
.application-notification {
    margin-bottom: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    animation: slideDown 0.3s ease;
}

.application-notification.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.application-notification.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-content i {
    font-size: 1.2rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prévention du scroll du body */
body.modal-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        margin: 2.5vh auto;
        max-height: 95vh;
    }

    .modal-header {
        padding: 20px 24px;
    }

    .modal-header h2 {
        font-size: 1.3rem;
    }

    .application-form {
        padding: 24px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .btn-cancel,
    .btn-submit {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .modal-container {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .application-modal.active .modal-container {
        transform: translateY(0) scale(1);
    }

    .job-info {
        padding: 20px;
    }

    .application-form {
        padding: 20px;
    }

    .form-section h4 {
        font-size: 1rem;
    }
}

/* Améliorations d'accessibilité */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn-cancel:focus,
.btn-submit:focus,
.modal-close:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Animation d'entrée pour les éléments du formulaire */
.application-modal.active .form-section {
    animation: fadeInUp 0.4s ease forwards;
}

.application-modal.active .form-section:nth-child(1) { animation-delay: 0.1s; }
.application-modal.active .form-section:nth-child(2) { animation-delay: 0.2s; }
.application-modal.active .form-section:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* États de validation visuels */
.form-group input:valid:not(:placeholder-shown),
.form-group select:valid,
.form-group textarea:valid:not(:placeholder-shown) {
    border-color: #28a745;
}

.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid,
.form-group textarea:invalid:not(:placeholder-shown) {
    border-color: #dc3545;
}

/* Indicateur de champ obligatoire */
.form-group label::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

.form-group:has(input:not([required])) label::after,
.form-group:has(select:not([required])) label::after,
.form-group:has(textarea:not([required])) label::after {
    content: "";
}