/* ───────────────────────────────────────────────────────────────
   ANNUAIRE INSTITUTIONNEL - STYLES MODERNISÉS
   ─────────────────────────────────────────────────────────────── */

/* Variables & Réinitialisation */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Open Sans', 'Raleway', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    display: block;
    visibility: visible;
}

/* ───────────────────────────────────────────────────────────────
   BANDEAU TITRE / HERO SECTION
   ─────────────────────────────────────────────────────────────── */

.directory-hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8c 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.directory-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.15);
    z-index: 0;
}

.directory-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.directory-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.directory-hero p {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 0;
}

/* ───────────────────────────────────────────────────────────────
   SECTION DE RECHERCHE
   ─────────────────────────────────────────────────────────────── */

.search-section {
    background: white;
    padding: 40px 20px;
    margin: -30px 20px 0 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.search-container {
    max-width: 700px;
    margin: 0 auto;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: flex-end;
}

.search-group {
    display: flex;
    flex-direction: column;
}

.search-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 0.95rem;
}

.search-group select,
.search-group input[type="text"] {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: #333;
}

.search-group select:focus,
.search-group input[type="text"]:focus {
    outline: none;
    border-color: #2d5a8c;
    box-shadow: 0 0 0 3px rgba(45, 90, 140, 0.1);
    background: white;
}

.search-group input[type="text"]::placeholder {
    color: #999;
}

.btn-search {
    background-color: #2d5a8c;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.btn-search:hover {
    background-color: #1e3a5f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 90, 140, 0.3);
}

/* Responsive - Formulaire */
@media (max-width: 768px) {
    .search-form {
        grid-template-columns: 1fr;
    }
    
    .search-group {
        width: 100%;
    }
    
    .btn-search {
        width: 100%;
    }
}

/* ───────────────────────────────────────────────────────────────
   MESSAGES D'ERREUR / SUCCÈS
   ─────────────────────────────────────────────────────────────── */

.alert {
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: 6px;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border-left-color: #c33;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border-left-color: #3c3;
}

.alert-info {
    background-color: #eef;
    color: #33c;
    border-left-color: #33c;
}

/* ───────────────────────────────────────────────────────────────
   GRILLE DE RÉSULTATS
   ─────────────────────────────────────────────────────────────── */

.results-section {
    padding: 50px 20px;
}

.results-container {
    max-width: 1200px;
    margin: 0 auto;
}

.results-header {
    margin-bottom: 30px;
    text-align: center;
}

.results-count {
    display: inline-block;
    background: #e8eef5;
    color: #2d5a8c;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

/* ───────────────────────────────────────────────────────────────
   CARTES D'ANNUAIRE (AGENTS / FORMATEURS / CENTRES)
   ─────────────────────────────────────────────────────────────── */

.directory-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e8eef5;
}

.directory-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(45, 90, 140, 0.15);
}

/* Image / Avatar */
.directory-card-image {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, #e8eef5 0%, #f5f7fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.directory-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.directory-card:hover .directory-card-image img {
    transform: scale(1.05);
}

/* Contenu */
.directory-card-content {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.directory-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e3a5f;
    margin-bottom: 12px;
    text-transform: uppercase;
    line-height: 1.3;
}

.directory-card-badge {
    display: inline-block;
    background: linear-gradient(135deg, #2d5a8c 0%, #1e3a5f 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.directory-card-field {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
}

.directory-card-field-label {
    font-weight: 600;
    color: #2d5a8c;
    margin-bottom: 4px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.directory-card-field-value {
    color: #555;
    line-height: 1.5;
    word-break: break-word;
}

.directory-card-field-value.link {
    color: #2d5a8c;
    text-decoration: none;
    font-weight: 500;
}

.directory-card-field-value.link:hover {
    text-decoration: underline;
}

/* Contact Icons */
.directory-card-contacts {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #e8eef5;
}

.contact-btn {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 6px;
    border: 1px solid #ddd;
    color: #2d5a8c;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}

.contact-btn:hover {
    background: #e8eef5;
    border-color: #2d5a8c;
    color: #1e3a5f;
    font-weight: 600;
}

/* ───────────────────────────────────────────────────────────────
   ÉTAT VIDE (NO RESULTS)
   ─────────────────────────────────────────────────────────────── */

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-results-icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 10px;
}

.no-results p {
    color: #999;
    margin-bottom: 25px;
}

.no-results-action {
    display: inline-block;
    background-color: #2d5a8c;
    color: white;
    padding: 12px 30px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.no-results-action:hover {
    background-color: #1e3a5f;
    transform: translateY(-2px);
}

/* ───────────────────────────────────────────────────────────────
   PAGINATION
   ─────────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #2d5a8c;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: #e8eef5;
    border-color: #2d5a8c;
}

.pagination .active {
    background: #2d5a8c;
    color: white;
    border-color: #2d5a8c;
}

/* ───────────────────────────────────────────────────────────────
   ACCESSIBILITÉ ET STATES
   ─────────────────────────────────────────────────────────────── */

button:focus,
a:focus,
select:focus,
input:focus {
    outline: 2px solid #2d5a8c;
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #2d5a8c;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1e3a5f;
}

/* ───────────────────────────────────────────────────────────────
   RESPONSIVE - TABLETTES ET MOBILES
   ─────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .directory-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .directory-hero h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .directory-hero {
        padding: 40px 20px;
    }
    
    .directory-hero h1 {
        font-size: 1.75rem;
    }
    
    .directory-hero p {
        font-size: 1rem;
    }
    
    .search-section {
        margin: -20px 10px 0 10px;
        padding: 25px 15px;
    }
    
    .directory-grid {
        grid-template-columns: 1fr;
    }
    
    .directory-card-content {
        padding: 20px;
    }
    
    .directory-card-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .directory-hero h1 {
        font-size: 1.5rem;
    }
    
    .search-container {
        padding: 0 10px;
    }
    
    .directory-card-image {
        height: 180px;
    }
}

/* ───────────────────────────────────────────────────────────────
   IMPRESSION
   ─────────────────────────────────────────────────────────────── */

@media print {
    .search-section,
    .pagination,
    .no-results-action {
        display: none;
    }
    
    .directory-card {
        page-break-inside: avoid;
    }
}
