@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&family=Raleway:ital,wght@0,100..900;1,100..900&display=swap');


body {
    margin: 0;
    font-family: "Raleway", sans-serif;
    color: #38383E
}


h1, h2, h3, h4, h5, h6 {
    font-family: "Josefin Sans", sans-serif;
    text-transform: uppercase;
    color: #AFCA0B;
    font-weight: 700;
} 
h1 {
    font-weight: 900 !important;
    color: #AFCA0B !important;
    font-size: 40px !important
}

body.contact-open #header-title h1 {
    font-size: var(--h1-size, 40px) !important;
}

header h2 {
    font-size: 23px !important;
    font-weight: 600 !important;
}
.accordion a {color: #006EC4}
.accordion a:hover {color: #666}

/* Stato con pannello aperto: il body riceve la classe 'contact-open' */
body.contact-open #header-title {
    margin-left: 425px;                     /* sposta l’area del titolo a destra */
    width: calc(100% - 425px - 16px);       /* limita davvero lo spazio disponibile */
    max-width: calc(100% - 425px - 16px);
    box-sizing: border-box;
}

/* L'H1 deve poter essere "misurato" e tagliato mentre lo riduciamo */
#header-title h1 {
    display: block;
    max-width: 100%;
    white-space: nowrap;
}

#map {
    top: 0;
    left: 0;
    width: 66.66vw;
    height: 100vh;
    z-index: 0;
}

.chart-popup {
    position: fixed;
    width: 400px;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    cursor: move;
}

.popup-country {
    font-size: 21px;
    /* color: #004494; */
}

.leaflet-popup-content {
    font-family: "Raleway", sans-serif;
    font-size:14px
}

.legend-title, .swatch, .legend-note {
    font-family: "Josefin Sans", sans-serif;
}

.leaflet-popup-content .expand-button,
.entry-preview .expand-button,
.db-entry .expand-button  {
    text-transform: uppercase;
    font-weight: 600;
    font-size: 12px;
    border-radius: 15px;
    padding: 5px 10px;
    background-color: #AFCA0B;
    transition: background-color .3s ease;
}

.leaflet-popup-content .expand-button:hover,
.entry-preview .expand-button:hover,
.db-entry .expand-button:hover {
    background-color: #666;
}

#chart-list {
    position: fixed;
    top: 10px;
    left: 10px;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    color: red;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 15px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.close-btn:hover {
    background: red;
    color: white;
}

ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.modal {
    display: flex;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-content button {
    margin: 10px;
    padding: 12px 20px;
    font-size: 16px;
}

.popup-buttons {
    display: flex;
    justify-content: space-around;
}

.expand-button {
    margin-top: 5px;
    padding: 5px 8px;
    background: #c57d10;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
}

.show-button,
.btn.popout {
    background: #006EC4;
    color: #ffffff;
    font-size: 12px;
    font-family: "Josefin Sans", sans-serif;
    text-transform: uppercase;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

/* Contenitore per allineare gli elementi in linea */
.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; 
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.main-filter-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}



/* Stile per il pulsante */
.btn {
    background-color: #AFCA0B; 
    color: #ffffff;
    font-size: 12px;
    font-family: "Josefin Sans", sans-serif;
    text-transform: uppercase;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

/* Effetto al passaggio del mouse sul pulsante */
.btn:hover,
.btn:active,
.db-modal-header .btn:hover,
.show-button:hover,
.btn.popout:hover {
    background-color: #666; 
}


.btn-success,
.btn-outline-success {
    --bs-btn-active-bg: #666;
}

.db-modal-header .btn {
    background-color: #006EC4;
    color: #fff; 
    font-weight: 700;
    padding: 5px 10px;
    transition: background-color 0.3s ease;
}

#search_bottom_cont {
    position:sticky;
    bottom: 0;
    z-index: 10000;
    background: white;
    padding-bottom: 20px;
    padding-top: 20px
}
#search_bottom_cont button {
    font-size: 15px;
    padding-top: 10px
}

#selected-filters-button {
    background-color: #006EC4 !important; 
}

#selected-filters-button:hover {
    cursor: pointer;
}

.guide-faq-button {
    background-color: #006EC4 !important;
}

.guide-faq-button:hover {
    background-color: #666 !important; 
}

.list-group li {
    font-size: 15px
}


#back-to-map {
    position: absolute;
    top: 0px;
    right: 15px;
    margin-top: 20px;
    background-color: #28a745; /* Verde */
    color: white;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: center;
}

#back-to-map:hover {
    background-color: #218838; /* Verde scuro al passaggio */
}

.name-button {
    background-color: #064420;  /* Verde scuro */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease-in-out;
}

.name-button:hover {
    background-color: #0a5c2d; /* Verde leggermente più chiaro */
}

#role-display-container {
    text-align: center;
    margin-bottom: 10px;
    position: relative;
}

#current-role {
    font-weight: bold;
    cursor: pointer;
    padding: 6px 12px;
    background-color: #eee;
    border-radius: 6px;
    display: inline-block;
    margin-right: 10px;
}

#role-description-box {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    color: #333;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    width: 80%;
    max-width: 600px;
    z-index: 1001;
    text-align: left;
}

.modal-content .role-option {
    margin-bottom: 20px;
}

.modal-content .role-option p {
    font-size: 14px;
    color: #333;
    margin-top: 8px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.custom-div-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.svg-pin {
    position: relative;
    width: 50px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;         /* mettere auto per click sul pin */
    background-color: transparent;
    z-index: 1;

}

.svg-pin svg {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;         /* lascia passare eventi al contenitore */
    z-index: 1;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
     }

.pin-count {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-family: "Josefin Sans", sans-serif;
    font-weight: 900;
    color: white;
    pointer-events: none;         /* evita che il testo faccia chiudere il popup */
    z-index: 2;
}

/* pannello show all db */

#dbpanel {
    position: fixed;
    top: 0;
    left: 66.66vw; /* parte destra della mappa */
    width: 33.33vw;
    height: 100vh;
    background: #f9f9f9;
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    z-index: 1500;
    transform: translateX(100%);
    transition: transform 0.4s ease;
    padding: 20px;
}

#dbpanel.show {
    transform: translateX(0);
}


.dbpanel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#dbpanel-content > div {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ccc;
}

/* pannello show more */

.db-modal {
    visibility: hidden;
    position: fixed;
    top: 0;
    right: 50;
    width: 33.33vw;
    height: 100vh;
    background-color: #fff;
    box-shadow: -4px 0 12px rgba(0,0,0,0.3);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 0 30px 30px 30px;
}

.db-modal.show {
    visibility: visible;
    right: 50;
    transform: translateX(100%);
}

.db-modal-content {
    position: relative;
}

.db-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background-color: white;
    position: sticky;
    top: 0px;
    padding-bottom: 30px;
    padding-top:30px;
    z-index: 10000
}

.db-modal-close {
    position: absolute;
    top: -10px;
    right: 10px;
    background: red;
    color: white;
    border: none;
    font-weight: bold;
    font-size: 18px;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.db-entry {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ccc;
}

/* Linguetta laterale verticale */
.contact-tab {
    font-family: "Josefin Sans", sans-serif;
    position: fixed;
    left: 0;
    top: 60%;
    font-size: medium;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: left top;
    background-color: #F75E25;
    color: #fff;
    font-weight: bold;
    padding: 6px 14px;
    /* border: 2px solid #0056b3; */
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1001;
    transition: background-color 0.3s ease;
}

.contact-tab:hover {
    background-color: #666;
    transition: background-color 0.3s ease;
}

/* Pannello contact form */
.contact-panel {
    position: fixed;
    left: -450px;
    top: 0;
    height: 100%;
    width: 450px;
    background-color: #fff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
    z-index: 1002; /* maggiore dei controlli Leaflet */
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Mostra pannello */
.contact-panel.show {
    left: 0;
}

.close-panel {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    background-color: white;
    margin-right: 10px;
    border-radius: 20px;
    padding: 0 10px;
    font-size: 30px;
    line-height: 1.2em;
    transition: background-color .3s ease;
}


.close-panel:hover {
    background-color: #c6db3f;
}

.contact-panel-description{
    margin: 0;
    padding: 10px;
    font-size: 14px; 
    line-height: 1.5;
    background-color: #7C9E3D;
}

/* .contact-panel-list {
    text-align: start;
} */

.contact-panel-list li {
    margin: 20px;
}

/* Form stile */
.contact-form {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.contact-form label {
    margin-top: 10px;
}

.contact-form input,
.contact-form textarea {
    padding: 8px;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.contact-form textarea {
    min-height: 100px;
}

.contact-form button {
    margin-top: 15px;
    padding: 10px;
    background-color: #0056b3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.contact-form button:hover {
    background-color: #0056b3;
}

#toggle-view-button.fixed-top {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 3000;
}

/* Filter area */

#main-filter-labels, #advanced-filter-labels, #data-variables-labels {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Contenitore collapsible */
.filter-group {
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
}

.filter-toggle {
    background-color: #f0f0f0;
    padding: 10px;
    font-weight: bold;
    cursor: pointer;
}

.filter-options {
    display: none;
    padding: 1px 0 1px 2px;
    background-color: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 1px 2px;
    font-size: 14px;
    font-weight: 500;
}

.checkbox-label input {margin-right: 8px;}

.filter-group.expanded .filter-options {
    display: block;
}

/* Layout a due colonne per paesi */
.filter-row {
    display: flex;
    gap: 20px;
}

.filter-column {
    flex: 1;
}

.container-fluid, .row, .col-lg-4 {
    overflow: visible !important;
}

#filter-area {
    position: fixed;
    top: 0;
    right: 0;
    width: 33.33vw;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    background-color: white;
    padding: 20px;
}

#filter-area {
    margin: 0;
    padding: 20px 20px 0 20px;
    width: 33.33vw;
    height: 100vh;
    overflow-y: auto;
}

.accordion-button:not(.collapsed) {
    background-color: #f4fdbd !important;
}

.accordion-body p {
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.accordion-body ul {
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
    padding-left: 1.2em;
}

.accordion-body li {
    margin-bottom: 2px;
}

/* Effetto pop-out sui path SVG di Leaflet */
.leaflet-overlay-pane svg path.leaflet-interactive {
    transition: all .5s ease-out;
}

.country-pop {
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}

body.contact-open #header-title h1.wrap {
    white-space: normal !important;   
    overflow-wrap: anywhere;          
    word-break: break-word;           
    line-height: 1.1;                 
}

.creative-commons {
    font-family: "Raleway", sans-serif;
    font-size: 10px;
    color: #555;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 1px;
}

.creative-commons img {
    width: 10px;
    height: auto;
}

.user-panel {
    border: 1px solid #b8d4e8;
    border-radius: 6px;
    background: #f0f8ff;
    padding: 12px;
}

.user-panel h5 {
    font-size: 0.95rem;
}

.user-panel .form-control {
    font-size: 0.85rem;
}

.guest-save-tooltip {
    align-items: center;
    border: 1px solid #1a5f3f;
    border-radius: 50%;
    color: #1a5f3f;
    cursor: help;
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 700;
    height: 18px;
    justify-content: center;
    position: relative;
    width: 18px;
}

.guest-save-tooltip::after {
    background: #18313a;
    border-radius: 4px;
    color: #fff;
    content: attr(data-tooltip);
    font-size: 0.75rem;
    font-weight: 400;
    left: 50%;
    line-height: 1.3;
    opacity: 0;
    padding: 8px;
    pointer-events: none;
    position: absolute;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    transition: opacity 0.15s ease;
    visibility: hidden;
    width: 210px;
    z-index: 100;
}

.guest-save-tooltip:hover::after,
.guest-save-tooltip:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.saved-search-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid #dbeaf2;
}

.saved-search-item:first-child {
    border-top: 0;
}

.saved-search-name {
    flex: 1;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-dialog-overlay {
    align-items: center;
    background: rgba(17, 34, 45, 0.55);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 16px;
    position: fixed;
    z-index: 11000;
}

.custom-dialog-overlay[hidden] {
    display: none;
}

.custom-dialog {
    background: #fff;
    border: 1px solid #b8d4e8;
    border-radius: 6px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
    max-width: 420px;
    padding: 20px;
    width: 100%;
}

.applied-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.applied-filter {
    align-items: center;
    display: inline-flex;
    font-size: 0.75rem;
    gap: 6px;
}

body.dark-mode .custom-dialog {
    background: #1e2a40;
    border-color: #2a5a7a;
    color: #fff;
}

body.dark-mode .user-panel {
    border-color: #2a5a7a;
    background: #1a3a52;
}

body.dark-mode {
    background: #101820;
    color: #e7edf3;
}

body.dark-mode header,
body.dark-mode #filter-area,
body.dark-mode #list-view,
body.dark-mode .accordion-item,
body.dark-mode .accordion-button,
body.dark-mode .card,
body.dark-mode .db-modal,
body.dark-mode #dbpanel,
body.dark-mode .popover,
body.dark-mode .popover-body {
    background-color: #172432 !important;
    color: #e7edf3 !important;
}

body.dark-mode .text-muted,
body.dark-mode h2.text-muted,
body.dark-mode .form-text {
    color: #aebdca !important;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #0f1c28;
    border-color: #3b5368;
    color: #f4f7fa;
}


body.dark-mode .form-control::placeholder {
    color: #8fa2b3;
}

body.dark-mode .accordion-button::after {
    filter: invert(1);
}

body.dark-mode .accordion-button:not(.collapsed) {
    background-color: #1e3a4f !important;
}

body.dark-mode .table,
body.dark-mode .list-group-item {
    --bs-table-bg: #172432;
    --bs-table-color: #e7edf3;
    --bs-table-border-color: #34495c;
    background-color: #172432;
    color: #e7edf3;
}

body.dark-mode .db-entry,
body.dark-mode .checkbox-label,
body.dark-mode .filter-options {
    color: #e7edf3;
}

body.dark-mode .creative-commons img {
    filter: invert(1);
}

body.dark-mode {
    color-scheme: dark;
}

body.dark-mode header,
body.dark-mode #header-title,
body.dark-mode .container-fluid,
body.dark-mode .row,
body.dark-mode .col,
body.dark-mode .col-lg-4,
body.dark-mode .col-lg-8,
body.dark-mode .col-lg-12 {
    color: #e7edf3;
}

body.dark-mode #map {
    background: #0b1219;
}

body.dark-mode .leaflet-tile-pane {
    filter: brightness(0.62) saturate(0.72) contrast(1.15);
}

body.dark-mode .leaflet-control,
body.dark-mode .leaflet-control-layers,
body.dark-mode .leaflet-popup-content-wrapper,
body.dark-mode .leaflet-popup-tip,
body.dark-mode .leaflet-tooltip,
body.dark-mode .choropleth-legend,
body.dark-mode .chart-popup,
body.dark-mode #chart-list {
    background: #172432 !important;
    border-color: #3b5368 !important;
    color: #e7edf3 !important;
}

body.dark-mode .leaflet-bar a,
body.dark-mode .leaflet-control-zoom a {
    background: #172432;
    border-color: #3b5368;
    color: #e7edf3;
}

body.dark-mode .leaflet-bar a:hover,
body.dark-mode .leaflet-control-zoom a:hover {
    background: #24384a;
}

body.dark-mode .modal-content,
body.dark-mode .db-modal-header,
body.dark-mode .contact-panel,
body.dark-mode #role-description-box,
body.dark-mode .close-panel,
body.dark-mode .filter-options,
body.dark-mode .filter-toggle,
body.dark-mode .dropdown-menu,
body.dark-mode .card-header,
body.dark-mode .card-body,
body.dark-mode .card-footer,
body.dark-mode .offcanvas,
body.dark-mode .offcanvas-body,
body.dark-mode .offcanvas-header {
    background-color: #172432 !important;
    border-color: #3b5368 !important;
    color: #e7edf3 !important;
}

body.dark-mode .accordion,
body.dark-mode .accordion-body,
body.dark-mode .accordion-collapse,
body.dark-mode .filter-group,
body.dark-mode .saved-search-item,
body.dark-mode .db-entry,
body.dark-mode #dbpanel-content > div {
    border-color: #3b5368 !important;
    color: #e7edf3;
}

body.dark-mode .contact-form input,
body.dark-mode .contact-form textarea,
body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background-color: #0f1c28;
    border-color: #3b5368;
    color: #f4f7fa;
}

body.dark-mode a:not(.btn),
body.dark-mode .accordion a {
    color: #76bdf0;
}

body.dark-mode p,
body.dark-mode label,
body.dark-mode span,
body.dark-mode li,
body.dark-mode strong,
body.dark-mode code,
body.dark-mode .popup-country,
body.dark-mode .leaflet-popup-content {
    border-color: #3b5368;
}

body.dark-mode .btn-outline-secondary {
    border-color: #94a7b8;
    color: #d8e1e8;
}

body.dark-mode .btn-outline-secondary:hover {
    background: #d8e1e8;
    color: #101820;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

body.dark-mode hr {
    border-color: #52697d;
}

body.dark-mode ::-webkit-scrollbar {
    background: #101820;
    width: 12px;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #3b5368;
    border: 3px solid #101820;
    border-radius: 10px;
}

