/* style.css */
:root {
    --primary-color: #e74c3c;
    --secondary-color: #2c3e50;
    --background-gradient: linear-gradient(135deg, #ff7f7f 0%, #e74c3c 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--background-gradient);
    padding: 20px;
}

.import-section {
    padding: 30px;
    text-align: center;
}

.intro-text {
    font-size: 1.1em;
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-weight: 500;
}

.divider {
    margin: 25px 0;
    border: 0;
    height: 1px;
    background: #ddd;
}

.import-btn {
    width: 100%;
    background: var(--primary-color);
    border: 2px solid #c0392b;
    color: white;
    font-size: 16px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: block;
    margin-top: 15px;
}

.import-btn:hover {
    background: #c0392b;
}

.new-request-btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 12px;
    background: var(--secondary-color);
    color: white;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.new-request-btn:hover {
    background: #34495e;
}

/* Animation pour l'import */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-container {
    animation: fadeInUp 0.4s ease-out;
}

.form-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
}

.form-header {
    background: var(--secondary-color);
    color: white;
    padding: 25px;
    text-align: center;
}

.form-header h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
}

.step-indicator {
    font-size: 0.9em;
    color: #ecf0f1;
    margin-top: 8px;
}

label {
    display: block;
    margin-top: 10px;
    margin-bottom: 5px;
    color: var(--secondary-color);
    font-weight: 500;
}

.radio-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    margin-top: 0px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

input, 
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.2);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.button-group {
    display: flex;
    gap: 5px;
}

.nav-btn {
    flex: 1;
    padding: 12px;
    margin: 12px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.prev-btn {
    background: #bdc3c7;
    border: 2px solid #95a5a6;
    color: var(--secondary-color);
}

.next-btn {
    background: var(--primary-color);
    border: 2px solid #c0392b;
    color: white;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.prev-btn:hover {
    background: #95a5a6;
}

.next-btn:hover {
    background: #c0392b;
}

.nav-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.nav-btn:disabled:hover {
    background: initial;
}

.form-step {
    padding: 30px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-step.active {
    display: block;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Champs numériques */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* Responsive */
@media (max-width: 480px) {
    .radio-group {
        flex-direction: column;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .nav-btn {
        width: 100%;
    }
}

/* Animation optionnelle */
.hidden {
    display: none !important;
}

/* Animation optionnelle */
#conditional-fields-mr {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: 
        opacity 0.4s ease-in-out,
        max-height 0.4s ease-in-out,
        margin 0.4s ease-in-out;
    margin-bottom: 0;
}

#conditional-fields-mr.hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
}

#conditional-fields-mr.visible {
    opacity: 1;
    max-height: 300px; /* Ajuster selon le contenu */
    margin-bottom: 25px;
}

/* Animation optionnelle */
#ref-dazr-fields {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: 
        opacity 0.4s ease-in-out,
        max-height 0.4s ease-in-out,
        margin 0.4s ease-in-out;
    margin-bottom: 0;
}

#ref-dazr-fields.hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
}

#ref-dazr-fields.visible {
    opacity: 1;
    max-height: 300px; /* Ajuster selon le contenu */
    margin-bottom: 25px;
}

select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background-color: white;
    appearance: none; /* Supprime le style par défaut du navigateur */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232c3e50'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: border-color 0.3s ease;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.2);
}

#echafaudage-fields,
#permis-hse-fields {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: 
        opacity 0.3s ease-in-out,
        max-height 0.4s ease-in-out,
        margin 0.3s ease-in-out;
    margin-bottom: 0;
}

#echafaudage-fields.visible,
#permis-hse-fields.visible {
    opacity: 1;
    max-height: 200px; /* Ajustez selon le contenu */
    margin-bottom: 25px;
}

.file-upload {
    position: relative;
    overflow: hidden;
    margin-top: 0px;
}

.file-label {
    display: flex;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    margin-top: 0px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    border-color: var(--primary-color);
    background: #f8f8f8;
}

.file-button {
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    margin-right: 15px;
    transition: background 0.3s ease;
}

.file-button:hover {
    background: #c0392b;
}

.file-name {
    color: #666;
    font-style: italic;
    flex-grow: 1;
}

input[type="file"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Feedback visuel quand un fichier est sélectionné */
input[type="file"]:valid + .file-label .file-name {
    color: var(--secondary-color);
    font-style: normal;
    font-weight: 500;
}

/* Styles spécifiques à l'étape 5 */
.inline-group {
    display: flex;
    align-items: center; /* Alignement vertical au centre */
    gap: 15px;
}

.inline-label {
    margin-bottom: 5px; /* Supprime la marge basse */
    white-space: nowrap; /* Empêche le label de passer à la ligne */
    align-self: center; /* Alignement vertical */
}

.checkbox-group {
    display: flex;
    gap: 25px;
    margin-top: 0; /* Supprime la marge supérieure */
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    align-items: center; /* Alignement vertical des cases à cocher */
}

.checkbox-option {
    display: flex;
    align-items: center; /* Alignement vertical du texte et de la case */
    gap: 8px;
    padding: 5px 10px; /* Ajustement du padding */
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.checkbox-option:hover {
    background: #e9ecef;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.add-btn, .remove-btn {
    padding: 10px 25px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.add-btn {
    background: var(--primary-color);
    color: white;
    border: 2px solid #c0392b;
}

.remove-btn {
    background: #e74c3c20;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.add-btn:hover {
    background: #c0392b;
}

.remove-btn:hover {
    background: #e74c3c30;
}

.note {
    margin-top: 25px;
    font-size: 0.9em;
    color: #666;
}

.note a {
    color: var(--primary-color);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .inline-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .checkbox-group {
        width: 100%;
        justify-content: space-between;
    }
}

/* Styles spécifiques à l'étape 6 */
.form-row-step6 {
    display: grid;
    grid-template-columns: 200px 1fr; /* Ajuste la largeur des colonnes */
    gap: 15px;
    margin-bottom: 15px;
}

.section-description {
    color: var(--secondary-color);
    margin-bottom: 25px;
    font-weight: 500;
}

.acces-group {
    margin-bottom: 0px;
    padding-bottom: 0px;
    background: #f8f9fa;
    border-radius: 8px;
}


.type-acces {
    width: 200px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background-image: url("data:image/svg+xml,%3csvg..."); /* Utiliser la même flèche que précédemment */
}

#step-6 .form-group label {
    display: flex;
    align-items: left;
}

#step-6 .form-group input[type="checkbox"] {
    margin-right: 10px;
    width: auto;
}

#step-5 .form-group label {
    display: flex;
    align-items: left;
}

#step-5 .form-group input[type="checkbox"] {
    margin-right: 10px;
    width: auto;
}


input[placeholder*="ex:"] {
    font-style: italic;
    color: #666;
}

@media (max-width: 480px) {
    .type-acces {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
    }
}

/* Styles spécifiques à l'étape 8 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.date-input, .time-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    transition: border-color 0.3s ease;
}

.date-input:focus, .time-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.2);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    table-layout: fixed; /* Forcer les colonnes à avoir la même largeur */
}

.schedule-table th, .schedule-table td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: center;
}

.schedule-table th {
    background: var(--secondary-color);
    color: white;
    font-weight: bold;
}

.schedule-table td {
    background: #f8f9fa;
}

/* Largeur fixe pour les colonnes "Heure de début" et "Heure de fin" */
.schedule-table th:nth-child(2),
.schedule-table td:nth-child(2) {
    width: 30%; /* Ajustez cette valeur selon vos besoins */
}

.schedule-table th:nth-child(3),
.schedule-table td:nth-child(3) {
    width: 30%; /* Ajustez cette valeur selon vos besoins */
}

.error-message {
    color: #e74c3c;
    margin-top: 15px;
    font-weight: 500;
    display: none;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .schedule-table {
        display: block;
        overflow-x: auto;
    }
}

/* Styles spécifiques à l'étape 9 */
/* Styles pour les sections */
.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.section-title {
    color: var(--secondary-color);
    font-size: 1.2em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.add-btn, .remove-btn {
    padding: 10px 25px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.add-btn {
    background: var(--primary-color);
    color: white;
    border: 2px solid #c0392b;
}

.remove-btn {
    background: #e74c3c20;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.add-btn:hover {
    background: #c0392b;
}

.remove-btn:hover {
    background: #e74c3c30;
}


.nav-btn, .submit-btn {
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.prev-btn {
    background: #bdc3c7;
    border: 2px solid #95a5a6;
    color: var(--secondary-color);
}

.submit-btn {
    background: var(--primary-color);
    color: white;
    border: 2px solid #c0392b;
}

.prev-btn:hover {
    background: #95a5a6;
}

.submit-btn:hover {
    background: #c0392b;
}

/* Styles pour les RZA */
.rza-group {
    margin-bottom: 15px;
    padding: 15px;
    background: #ffffff;
    border: 2px solid #ddd;
    border-radius: 8px;
    position: relative;
    padding-top: 25px; /* Espace pour le badge */
}

.rza-group::before {
    content: "RZA " attr(data-index);
    position: absolute;
    top: -12px; /* Position ajustée */
    left: 10px;
    background: var(--primary-color);
    color: white;
    padding: 3px 8px; /* Taille réduite */
    border-radius: 5px;
    font-size: 0.8em; /* Texte plus petit */
    font-weight: bold;
    z-index: 1; /* S'assurer que le badge est au-dessus */
}

.rza-group:nth-child(odd) {
    background: #f8f9fa; /* Alternance de couleurs */
}

.rza-group:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.1);
}

/* Styles pour les labels des RZA */
.rza-group .form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--secondary-color);
    font-weight: 500;
}

.rza-group .form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.rza-group .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.2);
}

@media (max-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .add-btn, .remove-btn {
        width: 100%;
    }
}

/* Masquer "Précédent" sur la première étape */
[data-step="1"] .prev-btn {
    display: none;
}

/* Remplacer "Suivant" par "Soumettre" sur la dernière étape */
[data-step="9"] .next-btn {
    display: none;
}

[data-step="9"] .submit-btn {
    display: inline-block; /* Afficher le bouton Soumettre */
}

/* Style pour les champs invalides */
input.error, select.error, textarea.error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.2);
}

.error-message {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

input.error + .error-message,
select.error + .error-message,
textarea.error + .error-message {
    display: block;
}