html {
    background: #0F172A;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: #0F172A;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Changed from center */
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body.modal-open {
    overflow: hidden !important;
}


/* Barra di ricerca */
.search-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 5px 5px;
    width: 90%;
    max-width: 400px;
    margin-bottom: 10px;
    backdrop-filter: blur(8px);
    margin-top: 0;
    margin-bottom: 0;
    position: fixed;
    top: 155px;
    /* Below date filter */
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
}


.search-container input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 16px;
    outline: none;
    padding: 5px;
}

.search-container .icon {
    font-size: 18px;
    margin-right: 8px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    padding: 10px;
    margin-left: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.filter-btn:hover svg {
    opacity: 0.8;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

/* Pulsanti categorie */
.categories {
    display: flex;
    justify-content: center;
    gap: 40px;
    /* 🔹 Distanza tra le icone raddoppiata */
    flex-wrap: wrap;
    margin-top: 10px;
}

.category {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.category img {
    width: 60px;
    height: 60px;
    margin-bottom: 5px;
    transition: transform 0.3s ease, filter 0.3s ease;
}

/* 🔹 Hover: ingrandimento leggero */
.category:hover img {
    transform: scale(1.1);
}

/* 🔹 Filtro attivo: cambia colore */
.category.active img {
    filter: brightness(0) saturate(100%) invert(68%) sepia(74%) saturate(456%) hue-rotate(110deg) brightness(90%) contrast(97%);
}

.category.active span {
    color: #6effa1;
    /* verde menta per evidenziare il filtro attivo */
}

/* MODALE BASE */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: #000;
    /* ensure modal content is visible inside global dark theme */
}

.modal-content {
    background: #efefef;
    padding: 30px 40px;
    border-radius: 20px;
    width: 320px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    text-align: center;
    color: #000;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 26px;
    cursor: pointer;
    color: #000;
    /* fix color */
}

h2 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #000;
}

/* ----------- MODALE 1: FILTRI NUMERICI ----------- */
.filter-group {
    margin-bottom: 25px;
    text-align: left;
}

.filter-label {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    color: #000;
    /* fix color */
}

input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: #000;
    border-radius: 5px;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
}

.next-btn {
    display: block;
    width: 100%;
    background-color: #ddd;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    color: #000;
}

.next-btn:hover {
    background-color: #ccc;
}

/* ----------- MODALE 2: CATEGORIE ----------- */
h3 {
    font-size: 16px;
    font-weight: 500;
    color: #000;
    margin-bottom: 5px;
}

p {
    font-size: 12px;
    color: #666;
    margin-top: 0;
    margin-bottom: 25px;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 0px;
}

.category-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #dcdcdc;
    background: #f6f6f6;
    color: #888;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn.selected {
    border: 2px solid #000;
    color: #000;
    background: #fff;
}

.category-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.categories a {
    color: white !important;
    text-decoration: none;
    display: inline-block;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
}

.footer-btn {
    flex: 1;
    margin: 0 5px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: #ddd;
    color: #000;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.footer-btn:hover {
    background: #ccc;
}


/* Slider */
input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: #000;
    border-radius: 5px;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
}

input[type=range]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
}


/* --- BOTTOM SHEET --- */
.bottom-sheet {
    position: fixed;
    bottom: 60px;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.2);
    transition: max-height 0.4s ease;
    max-height: 60px;
    /* chiusa */
    z-index: 1;
}

.bottom-sheet.open {
    max-height: 60vh;
    /* aperta */
}

.sheet-header {
    text-align: center;
    padding: 12px 0;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px 20px 0 0;
    font-weight: 600;
    color: #000;
}

.sheet-content {
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    scrollbar-width: none;
}

.sheet-content::-webkit-scrollbar {
    display: none;
}

.grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 12px;
    scroll-behavior: smooth;
    padding-bottom: 10px;
}

.grid::-webkit-scrollbar {
    display: none;
}

.box {
    flex: 0 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 10px;
    width: 150px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.box:hover {
    transform: translateY(-3px);
}

.box img {
    width: 100%;
    border-radius: 10px;
    height: auto;
}

.box strong {
    display: block;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #222;
}

#autocompleteList {
    position: fixed;
    top: 215px;
    left: 50%;
    transform: translateX(-50%);
    /* appena sotto la barra di ricerca */
    width: 90%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    overflow: hidden;
    z-index: 10000;
}

#autocompleteList li {
    padding: 6px 12px;
    cursor: pointer;
    color: #fff;
}

#autocompleteList li:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quick-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.quick-buttons .btn {
    display: block;
    text-align: center;
    padding: 10px 0;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
}

.quick-buttons .btn:hover {
    background-color: #0056b3;
}


.event-categories {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.event-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #dcdcdc;
    border-radius: 14px;
    background: #fff;
    padding: 14px 18px;
    font-size: 17px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.event-card img {
    width: 40px;
    height: 40px;
}

.event-card:hover {
    background: #f9f9f9;
}

.event-card.selected {
    border-color: #000;
    background: #e9e9e9;
}

#eventNextBtn {
    margin-top: 20px;
    background-color: #ddd;
    color: #000;
    font-weight: 600;
}

#eventNextBtn.active {
    background-color: #000;
    color: #fff;
    cursor: pointer;
}

@media (max-width: 400px) {
    .categories {
        gap: 20px;
    }

    .category img {
        width: 32px;
        height: 32px;
    }
}

.gm-ui-hover-effect {
    display: none !important;
}

/* Google Maps Tooltips InfoWindow Customization */

.gm-style-iw {
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 15px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
}

.gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
}

.gm-style-iw-ch {
    display: none !important;
}

/* Container principale del tooltip */
.map-tooltip {
    background: transparent;
    width: 200px;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    overflow: hidden;
}

/* Titolo evento */
.map-tooltip h3 {
    margin: 10px 5px 5px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    text-transform: capitalize;
    line-height: 1.2;
}

/* New Tooltip Hero */
.tooltip-hero {
    position: relative;
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: transparent;
}

.tooltip-hero-bg {
    position: absolute;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    object-fit: cover;
    filter: blur(8px) brightness(0.6);
    opacity: 0.8;
}

.tooltip-hero-main {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tooltip-hero-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Immagine evento */
.map-tooltip .tooltip-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

/* Footer del tooltip con info e bottone */
.map-tooltip .tooltip-footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px;
}

/* Badge età e prezzo */
.map-tooltip .badge {
    background: #111;
    color: #fff;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
}

/* Bottone partecipa */
.map-tooltip .btn-partecipa {
    background: #ff2f5c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 47, 92, 0.4);
    transition: transform 0.2s ease, background 0.2s ease;
}

.map-tooltip .btn-partecipa:hover {
    transform: scale(1.05);
    background: #d6284c;
}

.map-tooltip .btn-partecipa img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
    /* Assicura che l'icona sia bianca */
}

/* Rimuovi il padding di default di google maps al container */
.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: 15px !important;
    background: rgba(20, 20, 35, 0) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

/* Remove arrow if possible or style it (Google Maps triangle is hard to style with glass, usually best to hide or color match) */
.gm-style .gm-style-iw-t::after {
    background: linear-gradient(45deg, rgba(20, 20, 35, 0.65), rgba(20, 20, 35, 0.65)) !important;
    /* Attempt to match glass color, but backdrop-filter won't work on the arrow pseudo-element easily without structure changes */
    /* Often better to just make it transparent if possible, though GMaps might render a shadow */
    display: none !important;
}

.gm-ui-hover-effect {
    top: 5px !important;
    right: 5px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border-radius: 50% !important;
}

/* --- UNIFIED MODAL STYLES --- */

/* Modal Content Override */
.modal-content {
    background: #fff;
    padding: 0;
    /* Remove default padding, use sections */
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    /* Slightly wider */
    text-align: left;
    color: #111;
    overflow: hidden;
    /* For header/footer radius */
    max-height: 85vh;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

/* Header */
.modal-header {
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.modal-header .close-btn {
    position: static;
    /* Override absolute */
    font-size: 24px;
    color: #333;
    cursor: pointer;
    line-height: 1;
}

/* Body */
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Sections */
.filter-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #111;
}

.filter-section .subtitle {
    font-size: 12px;
    color: #888;
    font-weight: 400;
    margin-left: 5px;
}

.divider {
    border: 0;
    height: 1px;
    background: #eee;
    margin: 20px 0;
}

/* Ranges */
.filter-group {
    margin-bottom: 15px;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    /* Lint fix */
    background: #e0e0e0;
}

input[type=range]::-webkit-slider-thumb {
    background: #000;
}

/* Event Types Grid */
.event-categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.event-card-small {
    background: #f8f8f8;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.event-card-small:hover {
    transform: translateY(-2px);
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #ddd;
}

.event-card-small img {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    display: block;
    transition: transform 0.3s ease;
    object-fit: contain;
}

.event-card-small:hover img {
    transform: scale(1.1);
}

.event-card-small span {
    font-size: 12px;
    font-weight: 500;
    color: #555;
    transition: color 0.3s ease;
}

.event-card-small.selected {
    border-color: #000;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.event-card-small.selected span {
    color: #000;
    font-weight: 600;
}

/* Music Chips */
.music-categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-chip {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-chip:hover {
    background: #f0f0f0;
    border-color: #ccc;
    transform: translateY(-1px);
}

.category-chip.selected {
    background: #000;
    color: #fff;
    border-color: #000;
}

.category-chip.selected:hover {
    background: #222;
    transform: none;
}

/* Footer */
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 10px;
}

.reset-btn {
    flex: 1;
    background: #f0f0f0;
    color: #333;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: #e0e0e0;
}

.apply-btn {
    flex: 2;
    background: #000;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.apply-btn:hover {
    background: #222;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Overrides for existing legacy styles if needed */
.categories,
#eventNextBtn,
.next-btn {
    display: none;
    /* Hide old elements if any remain */
}




/* DATE FILTER BAR (Inline - Glass Overlay) */
.date-filter-bar {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 15px;

    position: fixed;
    /* Overlay on map */
    top: 85px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    /* Above search bar */
    width: 95%;
    max-width: 600px;

    background: rgba(20, 20, 35, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.date-filter-bar::-webkit-scrollbar {
    display: none;
}

.date-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #eee;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.date-pill:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.date-pill.active {
    background: #ff2f5c;
    border-color: #ff2f5c;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 47, 92, 0.4);
}