/* 
 * Styles communs pour toutes les pages d'index (regions, sites, sectors, routes)
 * Version uniforme avec filtres avancés repliables
 */

/* ===== HEADER ET LAYOUT GÉNÉRAL ===== */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.page-header h1 {
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-actions .btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.25);
}

.header-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.35);
}

/* ===== INFORMATIONS DE RÉSULTATS ===== */
.results-info {
    margin-bottom: 1.5rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.results-text {
    font-weight: 500;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-options .btn-group .btn {
    border-radius: 6px;
    border-color: #ced4da;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
}

.view-options .btn-group .btn.active {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.25);
}

/* ===== GRILLES ET CARTES ===== */
/* DÉSACTIVÉ: Conflit avec view-modes.css - entities-grid force display même sans .active */
/* La gestion des grilles est maintenant dans view-modes.css avec .view-grid.active */
/*.entities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}*/

.entity-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #f1f3f4;
    position: relative;
}

.entity-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.entity-card .card-body {
    padding: 1.5rem;
    position: relative;
}

.entity-card .card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.entity-card .card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.entity-card .card-title a:hover {
    color: #007bff;
}

/* ===== ACTIONS RAPIDES SUR LES CARTES ===== */
.entity-quick-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.entity-card:hover .entity-quick-actions {
    opacity: 1;
}

.quick-action-btn {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: #6c757d;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    text-decoration: none;
}

.quick-action-btn:hover {
    background: #007bff;
    color: white;
    transform: scale(1.1);
    text-decoration: none;
}

/* ===== MÉTA-INFORMATIONS DES CARTES ===== */
.entity-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.entity-code {
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.8rem;
    font-weight: 500;
}

.difficulty-badge {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
}

/* ===== STATISTIQUES DES CARTES ===== */
.entity-stats {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f3f4;
}

.entity-stats .row {
    margin: 0;
}

.entity-stats .col-4 {
    padding: 0.5rem;
    text-align: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    font-weight: 500;
}

/* ===== ÉTATS VIDES ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
    color: #6c757d;
    grid-column: 1 / -1;
}

.empty-state .empty-icon {
    margin-bottom: 1.5rem;
}

.empty-state .empty-icon i {
    opacity: 0.5;
    color: #adb5bd;
}

.empty-state h3, .empty-state h4 {
    color: #495057;
    margin-bottom: 0.75rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* ===== ANIMATIONS ===== */
.entity-card {
    animation: fadeInUp 0.2s ease-out both;
}

.entity-card:nth-child(1) { animation-delay: 0s; }
.entity-card:nth-child(2) { animation-delay: 0.1s; }
.entity-card:nth-child(3) { animation-delay: 0.2s; }
.entity-card:nth-child(4) { animation-delay: 0.3s; }
.entity-card:nth-child(5) { animation-delay: 0.4s; }
.entity-card:nth-child(6) { animation-delay: 0.5s; }

@keyframes fadeInUp {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.4s ease-out both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== DESIGN SPÉCIFIQUE AUX ENTITÉS ===== */
.regions-grid .entity-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.sites-grid .entity-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #007bff 0%, #6f42c1 100%);
}

.sectors-grid .entity-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #fd7e14 0%, #e83e8c 100%);
}

.routes-grid .entity-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #dc3545 0%, #fd7e14 100%);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .entities-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .entity-quick-actions {
        opacity: 1; /* Toujours visible sur mobile */
        position: static;
        margin-top: 1rem;
        justify-content: center;
    }
    
    .quick-action-btn {
        background: rgba(255, 255, 255, 0.95);
        position: static;
    }
    
    .results-info {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .view-options {
        align-self: center;
    }
    
    .entity-meta {
        justify-content: center;
        text-align: center;
    }
    
    .page-header .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .entity-card .card-body {
        padding: 1rem;
    }
    
    .entity-stats .col-4 {
        padding: 0.25rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .empty-state {
        padding: 2rem 1rem;
    }
}

/* ===== THÈME SOMBRE (OPTIONNEL) ===== */
@media (prefers-color-scheme: dark) {
    .entity-card {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .entity-card .card-title {
        color: #f7fafc;
    }
    
    .entity-meta {
        color: #a0aec0;
    }
    
    .entity-code {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .results-info {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        color: #e2e8f0;
    }
    
    .empty-state {
        background: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }
    
    .quick-action-btn {
        background: rgba(45, 55, 72, 0.95);
        color: #a0aec0;
    }
    
    .quick-action-btn:hover {
        background: #007bff;
        color: white;
    }
}