/**
 * Styles pour la page formations/index2
 * Page de liste moderne des formations avec tableau compact
 */

/* ========================================
   CONTENEUR PRINCIPAL
   ======================================== */
.index2-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    height: auto;
}

/* ========================================
   SECTION FILTRES
   ======================================== */
.index2-filters {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    position: -webkit-sticky;
    position: sticky;
    top: 10px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    align-self: flex-start;
}

.filters-form {
    margin: 0;
}

.filters-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.filters-grid {
    display: flex;
    gap: 12px;
    flex: 1;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.filter-item.filter-keyword {
    min-width: 260px;
    flex: 0 1 400px;
}

.filter-item.filter-pole {
    min-width: 140px;
    flex: 0 1 160px;
}

.filter-item.filter-campus {
    min-width: 100px;
    flex: 0 1 120px;
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    flex: 0 1 150px;
}

.filter-checkboxes > label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 13px;
}

.filter-checkboxes .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-checkboxes .checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-checkboxes .checkbox label {
    font-size: 12px;
    font-weight: normal;
    margin-bottom: 0;
}

.filter-checkboxes input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.filters-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.filters-actions .btn,
.filters-actions button {
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    border: none;
    font-size: 14px;
    text-align: center;
    width: 100%;
}

.filters-actions .btn-primary,
.filters-actions button[type="submit"] {
    background-color: #2563eb;
    color: white;
}

.filters-actions .btn-primary:hover,
.filters-actions button[type="submit"]:hover {
    background-color: #1d4ed8;
}

.filters-actions .btn-secondary {
    background-color: #6c757d;
    color: white;
}

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

/* ========================================
   TITRES DES BLOCS FI/FA ET FC
   ======================================== */
.index2-bloc {
    margin-bottom: 40px;
}

.index2-bloc-title {
    background: #e9ecef;
    padding: 12px 16px;
    margin: 0 0 15px 0;
    border-left: 4px solid #2563eb;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.index2-bloc-fifa .index2-bloc-title {
    border-left-color: #06b6d4;
}

.index2-bloc-fc .index2-bloc-title {
    border-left-color: #8b5cf6;
}

/* ========================================
   TABLEAU DES FORMATIONS
   ======================================== */
.index2-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    table-layout: auto;
}

.index2-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.index2-table thead th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    border-bottom: 2px solid #dee2e6;
}

.index2-table tbody tr {
    border-bottom: 1px solid #dee2e6;
}

.index2-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.index2-table tbody tr:hover {
    background: #e9ecef;
}

.index2-table tbody tr.already-applied {
    background: #d1e7dd;
}

.index2-table tbody tr.already-applied:hover {
    background: #c3e1d1;
}

.index2-table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
    font-size: 14px;
}

/* ========================================
   CELLULES SPÉCIFIQUES
   ======================================== */

/* Nom de la formation */
.index2-formation-name {
    width: 400px;
}

.index2-formation-name strong {
    font-size: 15px;
    color: #212529;
}

/* Régime avec badges */
.index2-formation-regime {
    white-space: nowrap;
}

.index2-formation-regime .badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 4px;
}

.badge-fi {
    background-color: #06b6d4;
    color: white;
}

.badge-fa {
    background-color: #f59e0b;
    color: white;
}

.badge-fc {
    background-color: #8b5cf6;
    color: white;
}

/* Campus */
.index2-formation-campus {
    color: #495057;
    font-size: 14px;
}

/* Département */
.index2-formation-departement {
    color: #555;
    font-size: 13px;
}

/* Brochures */
.index2-brochures-cell {
    text-align: center;
}

.index2-brochures-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.index2-brochure-icon {
    width: 28px;
    height: 28px;
    transition: transform 0.2s;
    display: inline-block;
}

.index2-brochure-icon:hover {
    transform: scale(1.15);
}

/* Site web */
.index2-siteweb-cell {
    text-align: center;
}

.index2-web-icon {
    width: 28px;
    height: 28px;
    transition: transform 0.2s;
    display: inline-block;
}

.index2-web-icon:hover {
    transform: scale(1.15);
}

.index2-siteweb-cell a {
    color: inherit;
    text-decoration: none;
    font-size: 20px;
    display: inline-block;
    transition: transform 0.2s;
}

.index2-siteweb-cell a:hover {
    transform: scale(1.2);
}

/* Candidatures */
.index2-candidature-cell {
    min-width: 200px;
}

.index2-candidature-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.candidature-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-open {
    background-color: #d1f4dd;
    color: #0f5132;
}

.status-closed {
    background-color: #f8d7da;
    color: #842029;
}

.status-not-yet {
    background-color: #fff3cd;
    color: #856404;
}

.index2-candidature-cell .btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.index2-candidature-cell .btn-primary {
    background-color: #2563eb;
    color: white;
}

.index2-candidature-cell .btn-primary:hover {
    background-color: #1d4ed8;
}

.index2-candidature-cell .btn-success {
    background-color: #198754;
    color: white;
}

.index2-candidature-cell .btn-success:hover {
    background-color: #157347;
}

.index2-candidature-cell .btn-sm {
    font-size: 12px;
    padding: 5px 10px;
}

/* ========================================
   HEADERS COMPOSANTES ET PÔLES
   ======================================== */

/* Header composante (sans accordéon) - Style distinct et plus visible */
.index2-composante-header-row {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.index2-composante-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-top: 3px solid #5a67d8;
    border-bottom: 3px solid #5a67d8;
    padding: 14px 16px !important;
    font-weight: 700;
    font-size: 17px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.index2-composante-header::before {
    content: "🏛️ ";
    margin-right: 8px;
}

/* ========================================
   ACCORDÉONS PÔLES (CSS pur avec <details>)
   ======================================== */

.index2-pole-accordion {
    display: table-row-group;
}

.index2-pole-cell {
    padding: 0 !important;
    background: #f8f9fa;
}

.index2-pole-details {
    width: 100%;
}

.index2-pole-summary {
    background: #f1f3f5;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.index2-pole-summary::-webkit-details-marker {
    display: none;
}

.index2-pole-summary::before {
    content: "▶";
    display: inline-block;
    margin-right: 8px;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.index2-pole-details[open] .index2-pole-summary::before {
    transform: rotate(90deg);
}

.index2-pole-summary:hover {
    background: #e9ecef;
}

/* Utilisation de max-height pour une transition plus douce */
.index2-pole-content-table {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s ease;
}

.index2-pole-details[open] .index2-pole-content-table {
    max-height: 5000px;
    opacity: 1;
}

.index2-pole-content-table {
    width: 100%;
    border-collapse: collapse;
}

.index2-pole-content-table thead {
    background: #f8f9fa;
}

.index2-pole-content-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 13px;
    border-bottom: 1px solid #dee2e6;
}

.index2-pole-content-table tbody {
    display: table-row-group;
}

.index2-pole-content-table tr {
    display: table-row;
}

/* ========================================
   MESSAGE AUCUN RÉSULTAT
   ======================================== */
.index2-empty-message {
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #6c757d;
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
    .filters-grid {
        flex-wrap: wrap;
    }
    
    .filter-item.filter-keyword {
        min-width: 150px;
    }
    
    .filter-item.filter-pole,
    .filter-item.filter-campus {
        width: 100%;
        min-width: auto;
    }
    
    .index2-table {
        font-size: 13px;
    }
    
    .index2-formation-name {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .index2-container {
        padding: 10px;
    }
    
    .filters-wrapper {
        flex-direction: column;
    }
    
    .filters-grid {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-item.filter-keyword,
    .filter-item.filter-campus {
        width: 100%;
        min-width: auto;
    }
    
    .filters-actions {
        flex-direction: row;
        width: 100%;
    }
    
    .index2-table {
        font-size: 12px;
    }
    
    .index2-table thead th,
    .index2-table tbody td {
        padding: 8px;
    }
    
    .index2-formation-name {
        min-width: 150px;
    }
    
    .index2-candidature-cell {
        min-width: 150px;
    }
    
    .index2-brochures-wrapper {
        gap: 4px;
    }
    
    .index2-brochure-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .index2-table {
        font-size: 11px;
    }
    
    .index2-formation-name strong {
        font-size: 13px;
    }
    
    .filters-actions {
        flex-direction: column;
    }
}
