/*
 * Styles de base (existants)
 */
.visa-files ul, .visa-files li {
    margin: 0px;
    padding: 0px !important;
}

.visa-files li a {
    color: var(--link) !important;
}

.visa-files li a:hover {
    color: var(--linkhover) !important;
}

.visa-continent {
    padding-left: 40px;
    margin-top: -15px;
    text-transform: uppercase;
}

/*
 * Styles pour la grille [display-current-country]
 * Approche de base (Mobile First) : TOUJOURS 1 colonne
 */
.uvs-grid-container {
    display: block;
    width: 100%;
    max-width: 1900px;
    margin: 24px auto; /* Centre le conteneur global */
    box-sizing: border-box;
}

.uvs-grid-item {
    /* Style de la "carte" */
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 1px solid #e0e0e0;
    
    /* Contenu */
    padding: 24px;

    /* Par défaut (mobile) : 1 colonne */
    display: block; 
    width: 100%; 
    margin-bottom: 24px; 
    box-sizing: border-box;
}

/* --- Styles de contenu DANS la carte --- */

.uvs-grid-item h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.5em;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: none; 
    padding-bottom: 0;
}

/* Correction pour le formatage PHP : 
   s'assure que les <p> et <ul> générés ont le bon style */
.uvs-grid-item p,
.uvs-grid-item li {
    font-size: 1rem;
    line-height: 1.65;
    color: #34495e;
}

.uvs-grid-item ul, 
.uvs-grid-item ol {
    padding-left: 20px;
    margin-bottom: 1rem; /* Marge standard après une liste */
}
.uvs-grid-item p {
    margin-top: 0;
    margin-bottom: 1rem; /* Marge standard après un paragraphe */
}
.uvs-grid-item p:last-child,
.uvs-grid-item ul:last-child {
    margin-bottom: 0; /* Pas de marge sur le dernier élément */
}

/* Style spécifique pour les fichiers (s'ils sont dans la grille) */
.uvs-grid-item .visa-files ul {
    list-style-type: none;
    padding: 0 !important;
}
.uvs-grid-item .visa-files li a {
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
    transition: background-color 0.2s ease;
}
.uvs-grid-item .visa-files li:last-child a {
    border-bottom: none;
}
.uvs-grid-item .visa-files li a:hover {
    background-color: #f9f9f9;
}


/* --- Gestion des tables --- */

/* Le scroll est géré par le div.table ajouté par PHP */
.uvs-grid-item .table {
    overflow-x: auto; 
    scrollbar-width: thin;
    scrollbar-color: #bdc3c7 #f4f4f4;
    margin-bottom: 1rem; /* Marge si la table n'est pas le dernier élément */
}

/* On cible la table A L'INTERIEUR du wrapper */
.uvs-grid-item .table table {
    width: 100%;
    min-width: 340px; 
    border-collapse: collapse;
    margin: 0; /* Le wrapper .table gère la marge */
    font-size: 0.95rem;
}

.uvs-grid-item .table th, 
.uvs-grid-item .table td {
    border: 1px solid #ecf0f1;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.uvs-grid-item .table th {
    background-color: #f9f9f9;
    font-weight: 600;
}
/* Style pour la note de table ajoutée par JS */
.uvs-table-note {
    font-size: 0.9em;
    color: #555;
    margin-top: 8px;
    border-top: 1px dashed #eee;
    padding-top: 8px;
}


/* --- Responsive Desktop (Logique 1 / 2 / 3+) --- */

@media (min-width: 782px) {
    
    /* CAS 1 : 1 seul élément */
    /* On le centre et on limite sa largeur */
    .uvs-grid-item:only-child {
        display: block; 
        max-width: 900px; 
        margin-left: auto;
        margin-right: auto;
    }

    /* CAS 2 : Exactement 2 éléments */
    /* On utilise FLEX pour les forcer côte à côte (non-masonry) */
    .uvs-grid-container:has(.uvs-grid-item:nth-child(2)):not(:has(.uvs-grid-item:nth-child(3))) {
        display: flex;
        flex-wrap: wrap; /* Sécurité */
        gap: 24px; /* Espace flex */
    }
    
    .uvs-grid-container:has(.uvs-grid-item:nth-child(2)):not(:has(.uvs-grid-item:nth-child(3))) > .uvs-grid-item {
        flex-basis: 0;
        flex-grow: 1;
        width: 45%; /* Fallback pour flex-basis */
        margin-bottom: 0; /* Le gap gère l'espacement */
    }


    /* CAS 3 : 3 éléments OU PLUS */
    /* On active le MASONRY (column-count) */
    .uvs-grid-container:has(.uvs-grid-item:nth-child(3)) {
        column-count: 2;
        column-gap: 24px;
    }

    .uvs-grid-container:has(.uvs-grid-item:nth-child(3)) > .uvs-grid-item {
        /* Déclenche l'imbrication masonry */
        display: inline-block; 
        width: 100%; 
        margin-bottom: 24px; /* Espace vertical */
    }
}