@import url('general.css');
@import url('variables.css');

/* ===== SÉLECTEUR DE FORMATION ===== */

.formation-selector-wrapper {
    background: var(--light-gray);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-md);
    margin: var(--spacing-xl) 0;
    text-align: center;
}

.formation-selector-wrapper label {
    display: block;
    font-weight: var(--font-weight-semibold);
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
}

.formation-selector-wrapper select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: var(--border-accent);
    border-radius: var(--border-radius-sm);
    background: var(--white-color);
    font-size: var(--font-size-base);
    min-width: var(--max-width-medium);
    cursor: pointer;
}

.formation-selector-wrapper select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

/* ===== TABLEAUX DE FORMATIONS ===== */

.formations-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin: var(--spacing-xl) 0;
}

:root[data-theme="dark"] .formations-table th {
    background: var(--dark-gradient);
    color: var(--text-color-rgb);
}

.formations-table th {
    background: var(--primary-gradient);
    color: var(--white-color);
    text-align: center;
    padding: var(--spacing-md);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
}

.formations-table td {
    padding: var(--spacing-lg);
    vertical-align: top;
    border-bottom: var(--border-width-thin) solid var(--black-10);
    line-height: 1.6;
}

.formations-table tbody tr:last-child {
    border-bottom: none;
}

.formations-table tbody tr td:last-child {
    border-left: var(--border-light);
}

.formations-table tbody tr:nth-child(even) td {
    background-color: var(--light-gray);
}

.formations-table tbody tr {
    transition: background-color 0.2s ease;
}

/* ===== CONTENU DES TABLEAUX DE FORMATIONS ===== */

.formations-table h3 {
    color: var(--accent-color);
    font-size: 1.3rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.formations-table p {
    font-size: 1.08rem;
    color: var(--text-color);
    margin-bottom: 1.1rem;
    text-align: left;
}

.formations-table ul {
    background: var(--light-gray);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 1.2rem 1.5rem;
    font-size: 1.08rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    list-style: disc inside;
}

.formations-table ul li {
    margin-bottom: 0.7em;
    line-height: 1.6;
}

.formations-table .formation-images {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.formations-table .formation-images .formation-image-grid {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.formations-table .formation-images img {
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    max-width: 100%;
    height: auto;
}

/* ===== LIENS DE TEXTE SPÉCIAUX ===== */

.formations-table .ftextlink {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.3s ease;
    font-weight: var(--font-weight-medium);
}

.formations-table .ftextlink:hover {
    color: var(--accent-color);
    text-decoration: none;
}

:root[data-theme="dark"]  .formations-table .ftextlink {
    color: var(--primary-color);
}

:root[data-theme="dark"] .formations-table .ftextlink:hover {
    color: var(--accent-color);
}

.formations-table a {
    color: var(--white-color);
    text-decoration: underline;
    transition: color 0.2s;
}

.formations-table a:hover {
    color: var(--accent-color);
}

/* ===== CONTENEUR DES DÉTAILS DE FORMATION ===== */

#formation-details {
    background: var(--white-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

#formation-details table {
    margin: 0 auto;
    animation: fadeIn 0.3s ease-in-out;
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== SECTIONS DE FORMATION SPÉCIFIQUES ===== */

.formation-b-section,
.formation-moto-section,
.formation-am-section,
.formation-125-section,
.formation-post-permis-section {
    display: none;
}

.formation-b-section.active,
.formation-moto-section.active,
.formation-am-section.active,
.formation-125-section.active,
.formation-post-permis-section.active {
    display: table;
    animation: fadeIn 0.3s ease-in-out;
}

/* ===== RESPONSIVE POUR FORMATIONS ===== */

/* Responsive Design */
@media (max-width: 992px) {
    .formations-table {
        font-size: 0.95rem;
    }
    
    .formations-table th {
        font-size: 1.1rem;
        padding: 0.8rem;
    }
    
    .formations-table td {
        padding: 1rem;
    }
    
    .formation-selector-wrapper {
        padding: 1.5rem;
    }
    
    .formation-selector-wrapper select {
        min-width: 250px;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    /* Transformation des tables en layout vertical sur mobile */
    .formations-table {
        font-size: 0.9rem;
    }
    
    .formations-table thead th {
        font-size: 1rem;
        padding: 0.8rem;
    }
    
    /* Forcer toutes les cellules en mode vertical sur mobile */
    .formations-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border-radius: var(--border-radius-sm);
        overflow: hidden;
        box-shadow: var(--shadow-sm);
    }
    
    /* Alternance des couleurs de fond pour séparer visuellement les lignes */
    .formations-table tbody tr:nth-child(even) {
        background-color: var(--light-gray);
    }
    
    .formations-table tbody tr:nth-child(odd) {
        background-color: var(--white-color);
    }
    
    .formations-table tbody td {
        display: block !important;
        width: 100% !important;
        border-left: none !important;
        border-bottom: none !important;
        padding: 1.2rem;
        box-sizing: border-box;
        background-color: transparent !important;
    }
    
    .formations-table tbody td:last-child {
        border-bottom: none;
    }
    
    /* Style spécial pour les cellules qui spans 2 colonnes */
    .formations-table tbody td[colspan="2"] {
        margin-bottom: 0.5rem;
    }
    
    .formations-table th {
        font-size: 1.1rem;
        padding: 0.8rem;
    }
    
    .formations-table td {
        padding: 1rem;
    }
    
    .formations-table h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        color: var(--primary-color);
    }
    
    .formations-table p {
        font-size: 1rem;
        margin-bottom: 0.8rem;
        line-height: 1.5;
    }
    
    .formations-table ul {
        margin-bottom: 1rem;
        padding-left: 1.2rem;
    }
    
    .formations-table ul li {
        margin-bottom: 0.4rem;
    }
    
    /* Boutons plus adaptés au mobile */
    .formations-table .pl_button {
        display: inline-block;
        text-align: center;
        margin: 0.3rem 0.2rem;
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        width: auto;
        box-sizing: border-box;
    }
    
    /* Améliorer l'affichage des liens */
    .formations-table a {
        word-break: break-word;
    }
    
    .formation-selector-wrapper {
        padding: 1.5rem 1rem;
        margin: 1.5rem 0;
    }
    
    .formation-selector-wrapper select {
        min-width: auto;
        width: 100%;
        max-width: 100%;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .formations-table {
        font-size: 0.85rem;
    }
    
    .formations-table thead th {
        font-size: 0.95rem;
        padding: 0.6rem;
    }
    
    .formations-table tbody td {
        padding: 1rem;
    }
    
    .formations-table h3 {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }
    
    .formations-table p {
        font-size: 0.9rem;
        margin-bottom: 0.6rem;
    }
    
    .formation-selector-wrapper {
        padding: 1rem;
    }
    
    .formation-selector-wrapper select {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .formations-table .formation-images .formation-image-grid {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .formations-table .formation-images img {
        max-width: 100px;
        height: auto;
    }
    
    /* Boutons optimisés pour très petits écrans */
    .formations-table .pl_button {
        padding: 0.7rem 0.8rem;
        font-size: 0.85rem;
    }
}