/* ========== RESET & BASE ========== */
.hed-search-container,
.hed-map-container,
.hed-submission-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
    width: 100%;
}

*,
*:before,
*:after {
    box-sizing: border-box;
}

/* ========== FORMULAIRES ========== */
.hed-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hed-form-group {
    flex: 1;
    min-width: 0;
}

.hed-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: #1e1e1e;
}

.hed-form-group input,
.hed-form-group select,
.hed-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #dcdcde;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.hed-form-group input:focus,
.hed-form-group select:focus,
.hed-form-group textarea:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.hed-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ========== BOUTONS ========== */
.hed-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    min-height: 44px;
}

.hed-btn-primary {
    background: linear-gradient(135deg, #2271b1, #135e96);
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.25);
}

.hed-btn-primary:hover {
    background: linear-gradient(135deg, #135e96, #0a4a78);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(34, 113, 177, 0.35);
}

.hed-btn-secondary {
    background: #f6f7f7;
    color: #2271b1;
    border: 1.5px solid #dcdcde;
}

.hed-btn-secondary:hover {
    background: #e8eaeb;
    border-color: #2271b1;
}

/* ========== CARTES RÉSULTATS ========== */
#hed-results-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    min-height: 100px;
}

.hed-school-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid #eee;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    height: 100%;
    min-height: 280px;
}

.hed-school-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.10);
    border-color: #2271b1;
}

.hed-school-card-header {
    display: flex;
    gap: 14px;
    padding: 18px 18px 0;
    align-items: flex-start;
}

.hed-school-card-logo {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e8eaeb;
    overflow: hidden;
}

.hed-school-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.hed-school-card-info {
    flex: 1;
    min-width: 0;
}

.hed-school-card-title {
    margin: 0 0 6px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e1e1e;
    word-break: break-word;
    line-height: 1.3;
}

.hed-school-card-title a {
    color: #2271b1;
    text-decoration: none;
}

.hed-school-card-title a:hover {
    text-decoration: underline;
}

.hed-school-card-location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 13px;
    flex-wrap: wrap;
}

.hed-school-card-location .dashicons {
    font-size: 16px;
    color: #2271b1;
    flex-shrink: 0;
}

.hed-school-card-country {
    background: #e7f3ff;
    color: #135e96;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.hed-school-card-body {
    padding: 16px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hed-school-card-description {
    color: #555;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hed-school-card-footer {
    padding: 0 18px 18px;
    margin-top: auto;
}

.hed-school-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hed-school-card-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.25s ease;
    min-height: 40px;
}

.hed-school-card-btn-primary {
    background: #2271b1;
    color: #fff;
}

.hed-school-card-btn-primary:hover {
    background: #135e96;
}

.hed-school-card-btn-secondary {
    background: #f6f7f7;
    color: #2271b1;
    border: 1px solid #dcdcde;
}

.hed-school-card-btn-secondary:hover {
    background: #e8eaeb;
}

/* ========== STYLES DES MARQUEURS DE LA CARTE (MAP) ========== */

/* Marqueurs standards */
.hed-map-marker {
    background: #2271b1;
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hed-map-marker:hover {
    background: #135e96;
    transform: scale(1.1);
}

.hed-map-marker i {
    font-size: 16px;
}

/* Marqueurs pour les détails (plus grands) */
.hed-map-marker-details {
    background: #2271b1;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
}

.hed-map-marker-details i {
    font-size: 20px;
}

/* Marqueur personnalisé pour Leaflet */
.hed-school-marker-icon .hed-school-marker {
    background: #dc3232 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3) !important;
    border: 3px solid white !important;
    font-size: 18px !important;
}

.hed-school-marker-icon {
    line-height: 0 !important;
}

/* Popup amélioré */
.hed-map-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 10px;
}

.hed-map-popup .leaflet-popup-content {
    margin: 0;
    line-height: 1.4;
}

/* Légende de la carte */
.hed-map-legend {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
}

.hed-map-legend-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #2271b1;
    color: white;
    border-radius: 50%;
    font-size: 10px;
}

.hed-map-legend-marker .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Animation de chargement des marqueurs */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.hed-loading-marker {
    animation: pulse 1.5s infinite;
}

/* ========== MODAL ========== */
.hed-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: hedFadeIn 0.25s ease-out;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.hed-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: hedSlideUp 0.35s ease-out;
}

.hed-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    z-index: 10;
}

.hed-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #1e1e1e;
}

.hed-modal-close {
    font-size: 28px;
    color: #666;
    cursor: pointer;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}

.hed-modal-close:hover {
    background: #f0f0f1;
}

.hed-modal-body {
    padding: 24px;
}

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

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

/* ========== CARTE (MAP WRAPPER) ========== */
.hed-map-wrapper {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    min-height: 500px;
    position: relative;
    width: 100%;
}

.hed-main-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.hed-map-filters {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.hed-map-header {
    text-align: center;
    margin-bottom: 20px;
}

.hed-map-header h2 {
    color: #2271b1;
    margin-bottom: 10px;
    font-size: clamp(24px, 5vw, 32px);
}

.hed-map-header p {
    color: #666;
    font-size: clamp(14px, 3vw, 16px);
}

/* ========== SELECT2 ========== */
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    border-color: #dcdcde !important;
    border-radius: 8px !important;
    min-height: 44px !important;
    padding: 2px 8px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: #e7f3ff !important;
    border: 1px solid #b6d7ff !important;
    border-radius: 16px !important;
    color: #135e96 !important;
    padding: 3px 10px 3px 24px !important;
    font-size: 13px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #2271b1 !important;
    left: 6px !important;
}

/* ========== MESSAGES ========== */
.hed-message {
    padding: 14px 18px;
    border-radius: 8px;
    border-left: 4px solid #2271b1;
    background: #f0f8ff;
    color: #1e1e1e;
    font-size: 14px;
    margin: 12px 0;
}

.hed-message-success {
    border-color: #28a745;
    background: #f0f9f4;
    color: #155724;
}

.hed-message-error {
    border-color: #dc3545;
    background: #fdf3f3;
    color: #721c24;
}

/* ============================================================
   RESPONSIVE - Mobile First
   ============================================================ */

/* Tablettes et petits écrans */
@media (max-width: 1024px) {
    #hed-results-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

/* Tablettes portrait & grands mobiles */
@media (max-width: 768px) {
    .hed-search-container,
    .hed-map-container,
    .hed-submission-container {
        padding: 16px;
    }

    .hed-form-row {
        flex-direction: column;
        gap: 14px;
    }

    .hed-form-group {
        width: 100%;
        min-width: 0;
    }

    .hed-form-actions {
        flex-direction: column;
    }

    .hed-form-actions .hed-btn {
        width: 100%;
    }

    .hed-submission-form {
        padding: 20px;
    }

    #hed-results-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .hed-school-card {
        min-height: 240px;
    }

    .hed-school-card-header {
        padding: 14px 14px 0;
    }

    .hed-school-card-logo {
        width: 60px;
        height: 60px;
    }

    .hed-school-card-title {
        font-size: 16px;
    }

    .hed-school-card-body {
        padding: 12px 14px;
    }

    .hed-school-card-footer {
        padding: 0 14px 14px;
    }

    .hed-school-card-actions {
        flex-direction: column;
    }

    .hed-school-card-btn {
        padding: 12px;
        font-size: 14px;
        min-height: 44px;
    }

    .hed-map-wrapper,
    .hed-main-map {
        min-height: 400px;
    }

    .hed-map-legend {
        bottom: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .hed-map-legend-marker {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }

    /* Marqueurs mobile */
    .hed-map-marker {
        width: 26px;
        height: 26px;
    }

    .hed-map-marker i {
        font-size: 14px;
    }

    .hed-map-marker-details {
        width: 34px;
        height: 34px;
    }

    .hed-map-marker-details i {
        font-size: 17px;
    }

    /* Modal */
    .hed-modal {
        padding: 10px;
    }

    .hed-modal-content {
        max-height: 92vh;
        border-radius: 12px;
    }

    .hed-modal-header {
        padding: 14px 18px;
    }

    .hed-modal-header h3 {
        font-size: 18px;
    }

    .hed-modal-body {
        padding: 18px;
    }

    .hed-modal-close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .hed-results-count {
        padding: 12px 16px;
        font-size: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/* Petits mobiles */
@media (max-width: 480px) {
    .hed-search-container,
    .hed-map-container,
    .hed-submission-container {
        padding: 12px 10px;
    }

    .hed-search-form {
        padding: 16px;
        border-radius: 12px;
    }

    .hed-submission-form {
        padding: 14px;
        border-radius: 10px;
    }

    .hed-form-section {
        margin-bottom: 28px;
        padding-bottom: 20px;
    }

    .hed-form-section h3 {
        font-size: 18px;
    }

    .hed-form-group input,
    .hed-form-group select,
    .hed-form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* évite le zoom sur iOS */
    }

    .hed-btn {
        padding: 12px 18px;
        font-size: 15px;
        min-height: 48px;
        width: 100%;
    }

    #hed-results-list {
        gap: 14px;
    }

    .hed-school-card {
        min-height: 220px;
        border-radius: 12px;
    }

    .hed-school-card-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 14px 14px 0;
    }

    .hed-school-card-logo {
        width: 72px;
        height: 72px;
    }

    .hed-school-card-info {
        width: 100%;
    }

    .hed-school-card-location {
        justify-content: center;
    }

    .hed-school-card-title {
        font-size: 17px;
    }

    .hed-school-card-description {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }

    .hed-school-card-btn {
        font-size: 14px;
        padding: 12px;
        min-height: 44px;
    }

    .hed-map-wrapper,
    .hed-main-map {
        min-height: 320px;
    }

    .hed-map-filters {
        padding: 14px;
    }

    .hed-map-header h2 {
        font-size: 20px;
    }

    .hed-map-header p {
        font-size: 14px;
    }

    .hed-map-legend {
        bottom: 8px;
        right: 8px;
        padding: 4px 10px;
        font-size: 10px;
        gap: 4px;
    }

    .hed-map-legend-marker {
        width: 14px;
        height: 14px;
        font-size: 8px;
    }

    .hed-map-legend-marker .dashicons {
        font-size: 10px;
        width: 10px;
        height: 10px;
    }

    /* Marqueurs très petits mobiles */
    .hed-map-marker {
        width: 22px;
        height: 22px;
    }

    .hed-map-marker i {
        font-size: 12px;
    }

    .hed-map-marker-details {
        width: 30px;
        height: 30px;
    }

    .hed-map-marker-details i {
        font-size: 15px;
    }

    .hed-school-marker-icon .hed-school-marker {
        width: 34px !important;
        height: 34px !important;
        font-size: 15px !important;
    }

    /* Modal */
    .hed-modal {
        padding: 6px;
    }

    .hed-modal-content {
        max-height: 94vh;
        border-radius: 10px;
    }

    .hed-modal-header {
        padding: 12px 14px;
    }

    .hed-modal-header h3 {
        font-size: 16px;
    }

    .hed-modal-body {
        padding: 14px;
    }

    .hed-modal-close {
        width: 32px;
        height: 32px;
        font-size: 22px;
    }

    /* État vide */
    .hed-empty-state {
        padding: 32px 16px;
    }

    .hed-empty-state h3 {
        font-size: 18px;
    }

    .hed-empty-state p {
        font-size: 14px;
    }

    /* Select2 */
    .select2-container .select2-selection--single,
    .select2-container .select2-selection--multiple {
        min-height: 44px !important;
        padding: 0 6px !important;
    }

    .select2-container--default .select2-selection--multiple .select2-selection__choice {
        font-size: 12px !important;
        padding: 2px 8px 2px 20px !important;
        margin: 3px 3px 0 0 !important;
    }

    .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
        font-size: 14px !important;
        left: 4px !important;
    }

    /* Messages */
    .hed-message {
        padding: 12px 14px;
        font-size: 13px;
    }
}

/* Très petits écrans (moins de 360px) */
@media (max-width: 360px) {
    .hed-search-container,
    .hed-map-container,
    .hed-submission-container {
        padding: 8px 6px;
    }

    .hed-search-form {
        padding: 12px;
    }

    .hed-submission-form {
        padding: 10px;
    }

    .hed-school-card-logo {
        width: 60px;
        height: 60px;
    }

    .hed-school-card-title {
        font-size: 15px;
    }

    .hed-school-card-location {
        font-size: 12px;
    }

    .hed-map-wrapper,
    .hed-main-map {
        min-height: 280px;
    }

    .hed-map-legend {
        bottom: 6px;
        right: 6px;
        padding: 3px 8px;
        font-size: 9px;
    }

    .hed-map-legend-marker {
        width: 12px;
        height: 12px;
        font-size: 7px;
    }

    .hed-map-legend-marker .dashicons {
        font-size: 8px;
        width: 8px;
        height: 8px;
    }

    .hed-map-marker {
        width: 18px;
        height: 18px;
    }

    .hed-map-marker i {
        font-size: 10px;
    }

    .hed-school-marker-icon .hed-school-marker {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
}

/* ========== ANIMATIONS ========== */
.hed-school-card.hed-animated {
    animation: hedCardAppear 0.4s ease forwards;
}

@keyframes hedCardAppear {
    0% { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hed-school-card.hed-animated:nth-child(1) { animation-delay: 0.04s; }
.hed-school-card.hed-animated:nth-child(2) { animation-delay: 0.08s; }
.hed-school-card.hed-animated:nth-child(3) { animation-delay: 0.12s; }
.hed-school-card.hed-animated:nth-child(4) { animation-delay: 0.16s; }
.hed-school-card.hed-animated:nth-child(n+5) { animation-delay: 0.20s; }

/* ========== LOADING ========== */
.hed-loading-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid #f0f0f1;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: hedSpin 0.8s linear infinite;
}

@keyframes hedSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== UTILITAIRES ========== */
.hed-text-center { text-align: center; }
.hed-mt-10 { margin-top: 10px; }
.hed-mb-10 { margin-bottom: 10px; }
.hed-w-full { width: 100%; }
.hed-flex { display: flex; }
.hed-flex-center { display: flex; align-items: center; justify-content: center; }
.hed-gap-8 { gap: 8px; }
.hed-gap-12 { gap: 12px; }