/* ===================================
   PAGE DE SÉLECTION
   =================================== */

.selection-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.app-icon {
    font-size: 2rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Contenu principal */
.selection-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    /* Espace réservé en bas pour ne pas passer sous la barre d'actions fixe */
    padding-bottom: 8rem;
    width: 100%;
}

/* Filtres */
.filters-wrapper {
    margin-bottom: 2rem;
}

.filters-container {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.filters-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.filter-icon {
    font-size: 1.1rem;
}

.filter-select,
.filter-search {
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    outline: none;
}

.filter-select:focus,
.filter-search:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-select {
    cursor: pointer;
}

.search-group {
    flex: 2;
}

.btn-clear-filters {
    padding: 0.75rem 1.5rem;
    background: #f0f0f0;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-clear-filters:hover {
    background: #e0e0e0;
    color: #333;
}

.filters-stats {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
    color: #666;
    font-size: 0.95rem;
}

.stat-highlight {
    color: #667eea;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Liste de fichiers */
.files-wrapper {
    margin-bottom: 2rem;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Groupe par année */
.year-group {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.year-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.year-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.year-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.year-toggle {
    color: #667eea;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.year-group.expanded .year-toggle {
    transform: rotate(0deg);
}

.year-icon {
    font-size: 1.3rem;
}

.year-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.year-count {
    color: #666;
    font-size: 0.9rem;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.year-selected {
    color: #667eea;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-select-year {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    color: #667eea;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-select-year:hover {
    background: #667eea;
    color: white;
}

.year-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.year-group.expanded .year-content {
    max-height: 10000px;
}

/* Item de fichier */
.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.file-item.selected {
    background: rgba(102, 126, 234, 0.05);
    border-left: 4px solid #667eea;
}

.file-checkbox {
    display: flex;
    align-items: center;
}

.file-checkbox input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.file-content {
    flex: 1;
    min-width: 0;
}

.file-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.file-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-date {
    color: #999;
    font-size: 0.9rem;
    white-space: nowrap;
}

.file-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #666;
    font-size: 0.9rem;
}

.stat-icon {
    font-size: 1rem;
}

.stat-value {
    font-weight: 600;
}

.btn-view-single {
    padding: 0.5rem 1rem;
    background: #667eea;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
}

.file-item:hover .btn-view-single {
    opacity: 1;
}

.btn-view-single:hover {
    background: #5568d3;
    transform: scale(1.1);
}

/* État vide */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #999;
}

/* Actions de sélection */
.selection-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px 15px 0 0;
    padding: 1.5rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    z-index: 500;
}

.selection-info {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
    color: #333;
}

/* Footer */
.app-footer {
    background: white;
    padding: 1.5rem 2rem;
    text-align: center;
    color: #999;
    border-top: 1px solid #e0e0e0;
}

/* Modales */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 2rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 2rem;
}

.modal-body h3 {
    color: #333;
    margin-bottom: 1rem;
}

.modal-body h4 {
    color: #667eea;
    margin: 1.5rem 0 0.75rem;
}

.modal-body section {
    margin-bottom: 2rem;
}

.modal-body ul {
    list-style: none;
    padding: 0;
}

.modal-body li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.modal-body li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
}

.modal-body p {
    color: #666;
    line-height: 1.6;
}

/* Statistiques dans modal */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.stat-card-label {
    font-size: 0.85rem;
    color: #666;
}

.stats-details {
    margin-top: 2rem;
}

.year-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.year-stat-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.year-stat-year {
    font-weight: 600;
    min-width: 60px;
    color: #333;
}

.year-stat-bar {
    height: 30px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.year-stat-count {
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Paramètres */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.setting-item select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.btn-danger {
    background: #e91e63;
    color: white;
}

.btn-danger:hover {
    background: #c2185b;
}

.setting-note {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        padding: 0.75rem 1rem;
    }

    .header-content {
        gap: 0.5rem;
    }

    .app-title {
        font-size: 1.4rem;
    }

    .app-icon {
        font-size: 1.6rem;
    }

    .header-actions {
        gap: 0.25rem;
    }

    .btn-icon {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .selection-content {
        padding: 1rem;
        padding-bottom: 12rem;
    }

    .filters-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .btn-clear-filters {
        width: 100%;
    }

    .year-header {
        padding: 1rem;
    }

    .year-title {
        font-size: 1.1rem;
    }

    .file-item {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .file-stats {
        width: 100%;
        margin-top: 0.5rem;
    }

    .selection-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        max-width: 100%;
        border-radius: 15px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        padding: 0.5rem 0.75rem;
    }

    .app-title {
        font-size: 1.1rem;
        gap: 0.5rem;
    }

    .app-icon {
        font-size: 1.3rem;
    }

    .btn-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
}