* {
    box-sizing: border-box;
}

body {
    margin: 0;

    font-family: Arial, Helvetica, sans-serif;

    background: radial-gradient(circle at 50% 0%, #374d77 0%, #213050 38%, #111827 75%);

    color: #172033;
}

.container {
    width: min(1200px, calc(100% - 40px));

    margin: 40px auto;
}

.header {
    background: white;

    border-radius: 16px;

    padding: 10px;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);

    margin-bottom: 25px;
}

h1 {
    margin: 0 0 10px 0;

    font-size: 32px;
}

#analysis-loading {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.30);
}

#analysis-loading img {
    display: block;
    width: min(220px, 50vw);
    height: auto;
}

#boussole {
    margin: 15px;
    font-size: 2rem;
    text-align: center;
}

.yellow {
    color: #ffff00;
}

.subtitle {
    color: #667085;

    margin-bottom: 25px;
}

.search-form {
    display: flex;

    gap: 15px;
}

.search-input {
    flex: 1;

    min-width: 0;

    padding: 10px 11px;

    margin-left: 10px;

    border: 1px solid #ccd3df;

    border-radius: 9px;

    font-size: 17px;

    outline: none;
}

.search-input:focus {
    border-color: #4969d8;

    box-shadow: 0 0 0 3px rgba(73, 105, 216, 0.12);
}

.search-button {
    border: none;

    border-radius: 9px;

    padding: 0 20px;

    margin-right: 10px;

    background: #3157d5;

    color: white;

    font-size: 16px;

    cursor: pointer;

    transition:
        transform 0.1s;
}

.search-button:hover {
    background: #ba2f23;
    transform: scale(1.05);
}

.results-header {
    margin: 20px 0;

    font-size: 18px;

    font-weight: bold;

    color: #ff0;
}

.no-results {
    background: white;

    border-radius: 14px;

    padding: 25px;

    color: #667085;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

#no-results-title {
   color:blue;
   font-weight: bold;
}

.results {
    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));

    gap: 20px;
}

.city-card {
    background: white;

    border-radius: 15px;

    padding: 22px;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);

    border: 1px solid #e4e8ef;
}

.city-header {
    display: flex;

    align-items: center;

    gap: 12px;

    margin-bottom: 18px;
}

.flag {
    width: 42px;

    height: 28px;

    object-fit: cover;

    border-radius: 4px;

    border: 1px solid #d7dce5;
}

.city-name {
    font-size: 23px;

    font-weight: bold;

    margin: 0;
}

.country-name {
    color: #667085;

    font-size: 1rem;

    margin-top: 3px;
}

.info-grid {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin-top: 15px;
}

.info {
    background: #f7f8fb;

    border-radius: 9px;

    padding: 11px 13px;
}

.info-label {
    font-size: 12px;

    color: #667085;

    margin-bottom: 4px;
}

.info-value {
    font-size: 15px;

    font-weight: 500;

    overflow-wrap: anywhere;
}

#info-form {
    margin: 20px 0 0 0;
    padding: 10px 20px;
    color: white;
    background: linear-gradient(135deg, #09254b 0%, #3157d5 80%, #5c77ff 100%);
    border: 1px solid white;
    border-radius: 9px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#yellow {
    color: #ff0;
}

#author {
    text-align: center;
    color: white;
}

.parent {
    text-align: center;
}

.coordinates {
    grid-column: 1 / -1;
}

.alternate {
    margin-top: 15px;

    padding-top: 15px;

    border-top: 1px solid #e5e7eb;

    color: #667085;

    font-size: 13px;

    line-height: 1.5;
}

.alternate strong {
    color: #344054;
}

.technical {
    margin-top: 15px;

    font-size: 12px;

    color: #98a2b3;
}

.feature-code-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    font-weight: 600;
}

.feature-code-info {
    position: absolute;

    left: 50%;
    bottom: calc(100% + 12px);

    transform: translateX(-50%);

    width: 450px;

    padding: 16px 18px;

    background: #294AC2;
    color: #fff;

    border-radius: 8px;

    font-size: 13px;
    font-weight: normal;
    line-height: 1.55;

    text-align: left;

    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.25);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;

    z-index: 1000;
}

/*
|--------------------------------------------------------------------------
| Petite flèche
|--------------------------------------------------------------------------
*/

.feature-code-info::after {
    content: '';

    position: absolute;

    left: 50%;
    top: 100%;

    transform: translateX(-50%);

    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid #294AC2;
}

/*
|--------------------------------------------------------------------------
| Titre
|--------------------------------------------------------------------------
*/

.feature-code-info strong {
    display: block;

    margin-bottom: 9px;

    font-size: 14px;
}

/*
|--------------------------------------------------------------------------
| Chaque définition
|--------------------------------------------------------------------------
*/

.feature-code-info span {
    display: block;

    margin-bottom: 5px;
}

.feature-code-info span:last-child {
    margin-bottom: 0;
}

.feature-code-info b {
    font-weight: 700;
}

.feature-code-help {
    display: inline-block;

    margin-left: 4px;

    font-size: 13px;
    font-weight: bold;

    cursor: help;

    color: red;

    opacity: 0.75;
}

.feature-code-help:hover {
    opacity: 1;
}

/*
|--------------------------------------------------------------------------
| Affichage au survol
|--------------------------------------------------------------------------
*/

.feature-code-tooltip:hover .feature-code-info {
    opacity: 0.94;
    visibility: visible;
}

/* ============================================================
   CARTE DU MONDE
   ============================================================ */

#world-map {
    width: 100%;
    height: 500px;

    margin: 25px 0 30px;

    border-radius: 12px;

    overflow: hidden;

    border: 1px solid #ccc;
}

#map-error-message {
    display: none;

    padding: 25px;

    color: #555;

    text-align: center;

    font-size: 15px;

    line-height: 1.6;
}

#world-map.map-error {
    display: flex;

    align-items: center;
    justify-content: center;

    min-height: 160px;
    height: 160px;

    padding: 25px;
    box-sizing: border-box;

    background: #f5f5f5;

    border: 1px solid #ccc;
    border-radius: 12px;

    color: #555;

    text-align: center;
    font-size: 15px;
    line-height: 1.6;
}

#world-map.map-error #map-error-message {
    display: block;
}

/* ============================================================
   FICHE DE VILLE SÉLECTIONNÉE
   ============================================================ */

.city-card {
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.city-card-selected {
    border-color: #5C77FF;
    box-shadow:
        0 0 0 2px rgba(92, 119, 255, 0.20);
}


/* ============================================================
   POPUP LEAFLET
   ============================================================ */

.leaflet-popup-content {
    font-size: 14px;
    line-height: 1.5;
}


.leaflet-popup-content strong {
    font-size: 16px;
}

/* ============================================================
   MARQUEUR DES VILLES
   ============================================================ */

.city-marker-wrapper {
    background: transparent !important;
    border: none !important;
}


/*
 * Forme principale du marqueur
 */

.city-marker {
    position: relative;

    width: 32px;
    height: 42px;

    background: #2457d6;

    border: 3px solid #ffffff;

    border-radius: 50% 50% 50% 0;

    transform: rotate(-45deg);

    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.45);
}


/*
 * Point central
 */

.city-marker-dot {
    position: absolute;

    width: 10px;
    height: 10px;

    left: 50%;
    top: 50%;

    transform: translate(-50%, -50%) rotate(45deg);

    background: #ffffff;

    border-radius: 50%;
}

/* =========================================================
   CODES POSTAUX
   Affichage de deux lignes maximum avec défilement
   ========================================================= */

.postal-value {
    height: 42px;
    max-height: 42px;

    overflow-y: auto;
    overflow-x: hidden;

    line-height: 21px;
    box-sizing: border-box;

    scrollbar-width: thin;
    scrollbar-color: #5C77FF #eeeeee;
}

/* Chrome / Edge / Safari */
.postal-value::-webkit-scrollbar {
    width: 6px;
}

.postal-value::-webkit-scrollbar-track {
    background: #eeeeee;
    border-radius: 4px;
}

.postal-value::-webkit-scrollbar-thumb {
    background: #5C77FF;
    border-radius: 4px;
}

.postal-value::-webkit-scrollbar-thumb:hover {
    background: #0612f9;
}

.postal-value.has-postal-scroll {
    padding-right: 18px;
    position: relative;
}

.postal-value.has-postal-scroll::before {
    content: '↓';

    position: absolute;
    right: 4px;
    bottom: 3px;

    width: 15px;
    height: 17px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 16px;
    line-height: 16px;

    color: #0000ff;
    background: #eee;
    border-radius: 3px;

    pointer-events: none;
}

@media (max-width: 600px) {
    .container {
        width: calc(100% - 20px);

        margin: 20px auto;
    }

    .header {
        padding: 20px;
    }

    .search-form {
        flex-direction: column;
    }

    .search-input {
        margin: 0px;
    }

    .search-button {
        height: 48px;
        margin: 0px;
    }

    .search-button:hover {
        transform: scale(1.02);
    }

    .results {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}
