:root {
    --primary: #116bac;
    --primary-light: #e5ecf4;
    --border: #dee2e6;
    --on-background: #545454;
    --btn-primary: #116bac;
    --btn-primary-hover: #1688da;

    /*- Other-Colors */
    --fao-orange: #F58320;
    --fao-caption: #1C4767;
    --fao-emergency: #980000;
    --fao-un-blue: #5792C9;

    /* Title */
    --tile-background-color: #e5ecf4;
    --title-font-color: #545454;
}

body {
    background-color: #fcfcfc;
    color: var(--on-background);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    overflow-x: hidden;
}

/* Typography & Layout */
#faoHeader {
    width: 100%;
    height: 60px;
    background-color: var(--primary);
}

.text-primary {
    color: var(--primary) !important;
    margin-top: 20px;
}

.fao-primary-title {
    /* color: white !important;
  background-color: var(--primary) !important; */

    background-color: var(--tile-background-color) !important;
    color: var(--title-font-color) !important;
    text-align: center;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.bg-primary-light {
    background-color: var(--primary-light) !important;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover);
    color: white;
}

/* Export UI Toggle */
.export-container {
    border: 1px solid var(--border) !important;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: white;
}

.btn-check:checked+.btn-outline-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(17, 107, 172, 0.3);
}

/* Table Overrides */
table.table th,
table.table td {
    vertical-align: middle;
    white-space: nowrap;
}

/* Header summary info box */
#transboundaryTopInfo p {
    margin-bottom: 0.5rem;
}

#transboundaryTopInfo label {
    font-weight: bold;
    color: var(--primary);
    margin-right: 0.5rem;
}

/* Floating Action Button */
.fao-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 55px;
    height: 55px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   13. SELECT2 THEME OVERRIDES (FAO BRANDING)
   ========================================= */

/* Main select box focus/open border and glow */
.select2-container--bootstrap-5.select2-container--focus .select2-selection--single,
.select2-container--bootstrap-5.select2-container--open .select2-selection--single,
.select2-container--bootstrap-5.select2-container--focus .select2-selection--multiple,
.select2-container--bootstrap-5.select2-container--open .select2-selection--multiple {
    border-color: var(--btn-primary) !important;
    /* This is the exact FAO blue (17, 106, 171) with 25% opacity for the glow effect */
    box-shadow: 0 0 0 0.25rem rgba(17, 106, 171, 0.25) !important;
}

/* Optional: Also apply this to native Bootstrap form elements just in case
   you use standard inputs/selects elsewhere on the page! */
.form-select:focus,
.form-control:focus {
    border-color: var(--btn-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(17, 106, 171, 0.25) !important;
}

/* The CURRENTLY SELECTED item (overriding the dedicated --selected class) */
.select2-container--bootstrap-5 .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"] {
    background-color: var(--btn-primary) !important;
    /* FAO Vibrant Blue */
    color: white !important;
}



/* When hovering over the ALREADY SELECTED item (combining both classes) */
.select2-container--bootstrap-5 .select2-results__option.select2-results__option--selected.select2-results__option--highlighted,
.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"].select2-results__option--highlighted {
    background-color: var(--fao-caption) !important;
    /* FAO Dark Blue for hover */
    color: white !important;
}

/* Normal HOVERED/HIGHLIGHTED item (not selected) */
.select2-container--bootstrap-5 .select2-results__option--highlighted:not(.select2-results__option--selected) {
    background-color: var(--fao-caption) !important;
    color: white !important;
}

/* The border of the dropdown menu itself */
.select2-container--bootstrap-5 .select2-dropdown {
    padding: .5rem .75rem !important;
    border-color: var(--btn-primary) !important;
}

/* Il contenitore (wrapper) della barra di ricerca: IL PADDING VA QUI */
.select2-container--bootstrap-5 .select2-search--dropdown {
    padding: .5rem .75rem !important;
}

/* The search input field INSIDE the dropdown menu */
.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    /* padding: .5rem .75rem !important;
  padding-right: .75rem !important; */
    border-color: var(--fao-gray-medium) !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field:focus {
    border-color: var(--btn-primary) !important;
    /*  padding-right: .75rem !important; */
    box-shadow: 0 0 0 0.25rem rgba(17, 106, 171, 0.25) !important;
}

/* =========================================
   14. SELECT2 RESPONSIVENESS FIX
   ========================================= */
/* .select2-container {
  width: 100% !important;
  max-width: 100%;
} */

/* =======================================
   FIX RICERCA SELECT2 (Sovrascrittura forzata tema B5)
   ======================================= */

/* Diamo respiro al contenitore (stacca la barra dai bordi) */
.select2-container--bootstrap-5 .select2-dropdown .select2-search {
    padding: .5rem .75rem !important;
}

/* Usiamo l'ESATTO selettore che hai trovato nella console */
.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    width: 100% !important;
    box-sizing: border-box !important;
    /* IL VERO SALVAVITA: fa rientrare il padding nel 100% */
    padding: .375rem .75rem !important;
    /* Mantiene l'altezza elegante di Bootstrap */
    margin: 0 !important;
    /* Azzera margini fastidiosi del tema */
    border-radius: .375rem !important;
    border: 1px solid var(--border) !important;
    outline: none !important;
}

/* Glow blu FAO al click sulla ricerca */
.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field:focus {
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 0.25rem rgba(17, 107, 172, 0.25) !important;
}