/* ==========================================================================
   1. GLOBAL & ROOT
   ========================================================================== */
:root {
    --text: #40012A;
    --background: #f9f6f8;
    --primary: #73305B;
    --secondary: #c89da1;
    --accent: #BF0B80;
    --highlight: #f2dfcf57;

    /* Mapping per compatibilità con classi esistenti */
    --brand-purple: var(--primary);
    --brand-purple-dark: color-mix(in srgb, var(--primary) 85%, black);
    --brand-purple-light: color-mix(in srgb, var(--primary) 15%, white);
    --brand-purple-focus-ring: color-mix(in srgb, var(--primary) 40%, transparent);
    --footer-bg: #40012A;
}

[data-theme="dark"] {
    --text: #febee7;
    --background: #090608;
    --primary: #cf8cb7;
    --secondary: #62373b;
    --accent: #f43eb4;
    --highlight: #5c4a4157;
    /* Versione scura del colore highlight con trasparenza */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
}

/* Applica il font Poppins a tutti i titoli */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Poppins', sans-serif;
    color: var(--text);
}

/* Stile per la navbar trasparente sopra l'hero slider */
header.header-transparent {
    position: absolute;
    background-color: transparent;
    box-shadow: none;
    border-bottom: none;
}

/* Stile per la navbar "glass" */
header.sticky {
    position: sticky;
    z-index: 1010;
    /* Assicura che la navbar sia sopra i controlli della mappa (che hanno z-index 1000) */
    background-color: color-mix(in srgb, var(--background) 80%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    /* Bordo leggermente più visibile */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    /* Ombra più diffusa per l'effetto profondità */
}

/* ==========================================================================
   2. UTILITIES
   ========================================================================== */

/* Color & Background Utilities */
.brand-purple {
    color: var(--primary);
}

.bg-brand-purple {
    background-color: var(--brand-purple);
}

.bg-brand-purple-light {
    background-color: var(--brand-purple-light);
}

.bg-secondary {
    background-color: var(--secondary);
}

.bg-highlight {
    background-color: var(--highlight);
}

.hover-bg-brand-purple-dark:hover {
    background-color: var(--brand-purple-dark);
}

.hover-border-brand-purple-dark:hover {
    border-color: var(--brand-purple-dark);
}

/* Border & Ring Utilities */
.border-brand-purple {
    border-color: var(--brand-purple);
}

.ring-brand-purple:focus-within {
    /* 'ring-color' non è una proprietà CSS standard. Si usa box-shadow per creare l'effetto "ring". */
    box-shadow: 0 0 0 3px var(--brand-purple-focus-ring) !important;
}

/* Tab Utilities */
.tab-active {
    border-bottom-color: var(--brand-purple);
    color: var(--brand-purple);
    font-weight: 600;
}

/* Category Tabs */
.category-tab {
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    background-color: transparent;
    color: var(--text);
    border: 1px solid var(--secondary);
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.category-tab:hover {
    background-color: var(--secondary);
}

.category-tab.active {
    background-color: var(--brand-purple);
    color: white;
    border-color: var(--brand-purple);
}

/* Filtering Animations */
.itinerary-card-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.itinerary-card-item.fade-out {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.itinerary-card-item.hidden {
    display: none;
}

/* Stile per i tag nella pagina di dettaglio, simile all'esempio */
.asset-tag {
    background-color: #f4f4f5;
    /* zinc-100 */
    color: #3f3f46;
    /* zinc-700 */
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 500;
    /* medium */
    padding: 6px 12px;
    /* py-1.5 px-3 */
    border-radius: 9999px;
    /* rounded-full */
}

/* Tag Utilities */
.tag-brand {
    background-color: var(--brand-purple-light);
    color: var(--brand-purple);
    font-size: 0.75rem;
    /* text-xs */
    font-weight: 500;
    /* medium */
    padding: 2px 8px;
    border-radius: 9999px;
}

.tag-neutral {
    background-color: var(--secondary);
    /* gray-100 */
    color: var(--text);
    /* gray-700 */
    font-size: 0.75rem;
    /* text-xs */
    font-weight: 500;
    /* medium */
    padding: 2px 8px;
    border-radius: 9999px;
}

/* Image Placeholder */
.image-placeholder {
    object-fit: contain;
    /* Mostra l'intera icona senza distorcerla */
    background-color: var(--secondary);
    /* gray-100 */
    padding: 1rem;
    /* Aggiunge un po' di spazio intorno all'icona */
}

/* Itineraries Slider */
.itineraries-slider-container {
    width: 100%;
    position: relative;
    padding: 20px 0;
    /* Aggiunge spazio verticale per l'effetto zoom */
    margin: -20px 0;
    /* Compensa lo spazio aggiunto per non alterare il layout generale */
}

.itineraries-slider-track {
    display: flex;
    width: 100%;
}

.itinerary-card-item {
    /* Width is handled by Tailwind classes in HTML (w-full md:w-1/2 lg:w-1/3) */
    transition: opacity 0.3s ease;
}

.slider-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #e5e7eb;
    /* gray-200 */
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-indicator.active {
    background-color: var(--brand-purple);
    width: 24px;
    border-radius: 9999px;
}

/* Gradient Utilities */
.bg-gradient-purple-to-white {
    background: linear-gradient(180deg, var(--brand-purple-light) 0%, var(--background) 30%, var(--background) 70%, var(--brand-purple-light) 100%);
}


/* ==========================================================================
   3. LAYOUT & SECTIONS
   ========================================================================== */

/* Hero Slider Section */
.footer-bg {
    background-color: var(--footer-bg);
    color: white;
}

.footer-bg h4 {
    /* Sovrascrive la regola globale per i titoli e li rende bianchi nel footer */
    color: white;
}

#hero-slider {
    position: relative;
    height: 50vh;
    /* Altezza relativa alla finestra */
    min-height: 500px;
    /* Aumentato di 100px */
    max-height: 600px;
    /* Aumentato di 100px */
    overflow: hidden;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.hero-slide.active-slide {
    opacity: 1;
}

/* Generic Page Section */
.page-section {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.page-section.active {
    display: block;
}

/* "How It Works" Infographic Section */
.infographic-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    /* 4rem */
    height: 64px;
    /* 4rem */
    border-radius: 9999px;
    background-color: var(--brand-purple);
    /* brand-purple */
    color: white;
    font-size: 1.875rem;
    /* text-3xl */
    font-weight: 700;
    /* bold */
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.infographic-line-path {
    stroke: var(--secondary);
}

.infographic-line.is-visible .infographic-line-path {
    animation: march 1s linear infinite;
}

.infographic-step {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.infographic-step.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.infographic-step:nth-child(2) {
    transition-delay: 0.4s;
}

.infographic-step:nth-child(3) {
    transition-delay: 0.8s;
}

.infographic-step:nth-child(4) {
    transition-delay: 1.2s;
}

/* In caso ci fossero più step */

/* Animazione per la linea tratteggiata */
@keyframes march {
    from {
        /* Il valore 16 corrisponde alla somma di dash e gap (8 + 8) */
        stroke-dashoffset: 16;
    }

    to {
        stroke-dashoffset: 0;
    }
}


/* ==========================================================================
   4. COMPONENTS
   ========================================================================== */

/* --- Buttons --- */
.transport-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 2px solid transparent;
    border-radius: 9999px;
    /* forma a pillola */
    font-weight: 600;
    background-color: var(--secondary);
    /* grigio-200 */
    color: var(--text);
    /* grigio-600 */
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.transport-btn:hover {
    background-color: color-mix(in srgb, var(--secondary) 80%, black);
    /* grigio-300 */
}

.transport-btn.active {
    background-color: var(--brand-purple-light);
    color: var(--brand-purple);
    /* viola del brand */
    border-color: var(--brand-purple);
}

.transport-btn svg {
    margin-right: 8px;
}

.btn-transparent {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1.25rem;
    /* py-2 px-5 */
    border-radius: 9999px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

.btn-pill {
    padding: 0.5rem 1.25rem;
    /* py-2 px-5 */
    border-radius: 9999px;
    /* rounded-full */
}

.btn-solid {
    background-color: var(--brand-purple);
    color: white;
    padding: 0.5rem 1.25rem;
    /* py-2 px-5, per coerenza con btn-transparent */
    border-radius: 9999px;
    /* rounded-full, per coerenza con btn-transparent */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.btn-solid:hover {
    background-color: var(--brand-purple-dark);
}

.btn-solid:disabled {
    background-color: var(--brand-purple-light);
    color: var(--brand-purple);
    cursor: not-allowed;
}

.back-to-top-btn {
    display: none;
    /* Nascosto di default su schermi piccoli */
}

/* --- Modals --- */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-choice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: 2px solid var(--secondary);
    /* gray-200 */
    border-radius: 0.5rem;
    /* rounded-lg */
    background-color: var(--background);
    color: #4B5563;
    /* gray-600 */
    font-weight: 600;
    /* semibold */
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    height: 100%;
}

.modal-choice-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    /* shadow-lg */
}

.modal-choice-btn.active {
    border-color: var(--primary);
    background-color: var(--brand-purple-light);
    color: var(--brand-purple);
}

/* --- Maps & Markers --- */
.itinerary-marker-icon {
    background-color: var(--brand-purple);
    color: #FFFFFF;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    animation: marker-pop-in 0.3s ease-out;
}

.search-marker-icon {
    background-color: var(--brand-purple);
    color: #FFFFFF;
    border-radius: 50% 50% 50% 0;
    /* Forma a goccia */
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transform: rotate(-45deg);
    border: 2px solid white;
    transition: transform 0.2s ease-in-out;
}

.search-marker-icon i {
    transform: rotate(45deg);
    /* Raddrizza l'icona all'interno della goccia */
    font-size: 18px;
    line-height: 1;
    margin-top: -2px;
    /* Aggiustamento fine per centrare l'icona */
}

/* Stile per l'icona SVG dentro il marker, usando una maschera per poterla colorare */
.marker-svg-icon {
    width: 20px;
    /* w-5 */
    height: 20px;
    /* h-5 */
    background-color: white;
    /* Colore dell'icona */
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    transform: rotate(45deg);
    /* Raddrizza l'icona all'interno della goccia */
}

/* Stile per il marker quando il bene è stato aggiunto all'itinerario */
.search-marker-icon.added {
    background-color: #10B981;
    /* Stesso verde del pulsante 'btn-added' */
}

/* Stile per l'icona SVG dentro il badge, usando una maschera per poterla colorare */
.badge-svg-icon {
    width: 1rem;
    /* 16px, w-4 */
    height: 1rem;
    /* 16px, h-4 */
    background-color: var(--brand-purple);
    /* Colore dell'icona, uguale al testo */
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.search-marker-icon-wrapper {
    color: #FFFFFF;
    border-radius: 50% 50% 50% 0;
    /* Forma a goccia */
    transform: rotate(-45deg);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease-in-out;
}

.search-marker-icon-wrapper i {
    transform: rotate(45deg);
    /* Raddrizza l'icona all'interno della goccia */
    font-size: 16px;
}

.leaflet-control-custom {
    background-color: #FFFFFF;
    width: auto;
    height: 30px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.2);
    background-clip: padding-box;
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

.leaflet-control-custom:hover {
    background-color: #f4f4f4;
}

.leaflet-control-custom.leaflet-disabled {
    cursor: not-allowed;
    background-color: #f4f4f4;
    color: #aaa;
    pointer-events: none;
    /* Impedisce il click */
}

/* Stile per il controllo custom quando è attivo */
.leaflet-control-custom.active {
    background-color: #e9ecef;
    /* Un grigio leggermente più scuro */
    border-color: #888;
}

/* Stile per il controllo custom quando è in alto a destra */
.leaflet-top.leaflet-right .leaflet-control-custom {
    margin-top: 10px;
}

/* --- Cards & Banners --- */
.itinerary-card {
    background-color: #FFFFFF;
    border-radius: 0.5rem;
    /* rounded-lg */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* shadow-md */
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    overflow: hidden;
    /* Assicura che l'immagine arrotondata non sporga */
}

/* Stile per la nuova card itinerario v2 */
.shadow-soft {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Itinerary Summary Banner */
#itinerary-summary-banner {
    transition-property: transform, visibility;
}

#summary-banner-collapsible-content {
    transition: max-height 0.5s ease-in-out;
}

.stop-item {
    background-color: var(--background);
    border: 1px solid #e5e7eb;
    /* gray-200 */
    border-radius: 0.75rem;
    /* rounded-xl */
    padding: 0.5rem 0.75rem;
    /* py-2 px-3 */
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.stop-number {
    background-color: #FFFFFF;
    border: 1px solid #e5e7eb;
    /* gray-200 */
    border-radius: 9999px;
    /* rounded-full */
    width: 24px;
    height: 24px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    margin-right: 0.75rem;
    /* mr-3 */
    flex-shrink: 0;
    cursor: grab;
    /* Indica che è trascinabile */
}

.stop-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* gap-2 */
    margin-left: auto;
    /* Spinge i controlli a destra */
    padding-left: 0.5rem;
    /* pl-2 */
}

.stop-controls .control-btn svg {
    width: 16px;
    height: 16px;
}

/* --- Forms & Inputs --- */
#filters-collapsible-content {
    max-height: 0;
    /* Imposta il pannello dei filtri come chiuso di default */
}

.filter-panel-collapsible {
    transition: max-height 0.5s ease-in-out;
}

.time-select-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #D1D5DB;
    /* border-gray-300 */
    border-radius: 9999px;
    background-color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    /* shadow-sm */
    transition: border-color 0.2s, box-shadow 0.2s;
    padding: 0.5rem 0.75rem;
    /* py-2 px-3 */
    position: relative;
}

.time-select-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.time-select-icon {
    color: var(--text);
    /* gray-500 */
    margin-right: 0.5rem;
    /* mr-2 */
    flex-shrink: 0;
}

.time-select-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: transparent;
    border: none;
    padding: 0;
    width: 100%;
    cursor: pointer;
}

.time-select-input:focus {
    outline: none;
    box-shadow: none;
}

/* Override per lo stile di autofill del browser sull'input della hero section */
#hero-search-input:-webkit-autofill,
#hero-search-input:-webkit-autofill:hover,
#hero-search-input:-webkit-autofill:focus,
#hero-search-input:-webkit-autofill:active {
    -webkit-text-fill-color: white !important;
    /* Forza il colore del testo a bianco */
    caret-color: white;
    /* Rende il cursore visibile */
    /* Questo trucco usa un'ombra interna per "colorare" lo sfondo, poiché i browser
       spesso ignorano la proprietà background-color per l'autofill. */
    -webkit-box-shadow: none inset !important;
    /* Una transizione molto lunga per ritardare l'applicazione dello stile del browser */
    transition: background-color 5000s ease-in-out 0s;
}

/* ==========================================================================
   5. ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Animazione di "saluto" per il pulsante di Gianna */
@keyframes wave-animation {

    0%,
    100% {
        transform: rotate(0deg) scale(1);
    }

    10%,
    30% {
        transform: rotate(14deg) scale(1.05);
    }

    20%,
    40% {
        transform: rotate(-8deg) scale(1.05);
    }

    50% {
        transform: rotate(4deg) scale(1.05);
    }

    60% {
        transform: rotate(-2deg) scale(1.05);
    }

    70% {
        transform: rotate(0deg) scale(1);
    }
}

.animate-wave {
    /* L'animazione si ripete ogni 4 secondi, con un ritardo iniziale di 2s */
    animation: wave-animation 2.5s ease-in-out 2s infinite;
}

/* Animazione di ingresso per l'icona di Gianna */
@keyframes bounce-in-left {
    0% {
        opacity: 0;
        transform: translateX(-200px);
    }

    60% {
        opacity: 1;
        transform: translateX(20px);
    }

    80% {
        transform: translateX(-10px);
    }

    100% {
        transform: translateX(0);
    }
}

.animate-bounce-in-left {
    animation: bounce-in-left 1s ease-out 0.5s forwards;
    opacity: 0;
    /* Inizia nascosta */
}

@keyframes marker-pop-in {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    50% {
        opacity: .5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-pulse-slow {
    animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Back to Top Button Visibility */
@media (min-width: 768px) {
    .back-to-top-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        background-color: var(--brand-purple);
        color: white;
        width: 48px;
        /* 3rem */
        height: 48px;
        /* 3rem */
        border-radius: 9999px;
        /* rounded-full */
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        z-index: 1050;
        /* Sopra la maggior parte degli elementi */
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out, transform 0.3s ease-in-out;
    }

    .back-to-top-btn.is-visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .back-to-top-btn:hover {
        background-color: var(--brand-purple-dark);
    }
}

/* Animazione per la card di Gianna */
@keyframes slide-in-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in-fade-in {
    animation: slide-in-fade-in 0.7s ease-out forwards;
    opacity: 0;
    /* Inizia trasparente */
}

/* Animazione per il cursore della macchina da scrivere */
@keyframes blink {
    50% {
        opacity: 0;
    }
}

.typing-cursor::after {
    content: '|';
    animation: blink 1s step-end infinite;
    font-weight: bold;
    margin-left: 2px;
    color: var(--brand-purple);
}

/* Stile Chatbot per Gianna */
.chat-bubble {
    position: relative;
    background-color: var(--brand-purple-light);
    padding: 1rem 1.25rem;
    /* py-4 px-5 */
    border-radius: 1rem;
    /* rounded-xl */
    max-width: 90%;
    width: 100%;
    /* Forza la bolla a prendere la larghezza massima disponibile */
}

/* Impedisce al bubble di ridimensionarsi durante l'animazione del typewriter */
#gianna-chat-text {
    width: 100%;
    word-break: break-word;
}

.chat-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    /* gap-2 */
    padding: 0.375rem 0.875rem;
    /* py-1.5 px-3.5 */
    border-radius: 9999px;
    /* rounded-full */
    font-weight: 600;
    /* semibold */
    font-size: 0.875rem;
    /* text-sm */
    transition: background-color 0.2s;
}

/* Animazione per l'indicatore "sta scrivendo" */
@keyframes typing-pulse {

    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--brand-purple);
    border-radius: 50%;
    animation: typing-pulse 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Animazione fade-in per i pulsanti di Gianna */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-in {
    opacity: 0;
    /* Assicura che l'elemento sia trasparente prima dell'animazione */
    animation: fade-in 0.5s ease-out forwards;
}

.text-gradient {
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.border-gradient {
    background: linear-gradient(to bottom right, #C71585, #8A2BE2);
    padding: 4px;
}

.icon-bg {
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   6. COMPONENT OVERRIDES & DYNAMIC STYLES
   ========================================================================== */

/* Stili per i tag HTML generati dinamicamente dal typewriter di Gianna.
   Usiamo selettori specifici per sovrascrivere il reset di Tailwind. */
#gianna-text-1 strong,
#gianna-text-2 strong {
    font-weight: 600;
    /* Equivalente di font-semibold */
}

#gianna-text-1 em,
#gianna-text-2 em {
    font-style: italic;
    /* Equivalente di italic */
}

/* Theme switcher */
.theme-switcher {
    background-color: var(--secondary);
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--secondary) 80%, black);
}

.theme-switcher:hover {
    background-color: color-mix(in srgb, var(--secondary) 70%, black);
}

.theme-switcher .bi-sun-fill {
    display: none;
}

.theme-switcher .bi-moon-fill {
    display: inline-block;
}

[data-theme="dark"] .theme-switcher .bi-sun-fill {
    display: inline-block;
}

[data-theme="dark"] .theme-switcher .bi-moon-fill {
    display: none;
}

/* ==========================================================================
   7. SEARCH PAGE STYLES
   ========================================================================== */

/* --- Stili per le card dei risultati di ricerca --- */

.asset-card-grid,
.asset-card-list {
    background-color: #fff;
    border-radius: 0.75rem;
    /* 12px */
    border: 1px solid #e5e7eb;
    /* gray-200 */
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    /* Imposta flex per entrambi i tipi di card */
}

.asset-card-grid:hover,
.asset-card-list:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* Il contenitore <a> deve essere flex e crescere per riempire la card */
.asset-card-grid>a,
.asset-card-list>a {
    display: flex;
    flex-grow: 1;
}

/* Stile GRIGLIA */
.asset-card-grid>a {
    flex-direction: column;
}

.asset-image-grid {
    width: 100%;
    height: 180px;
    object-fit: cover;
    flex-shrink: 0;
    /* Evita che l'immagine si restringa */
}

/* Stile ELENCO */
.asset-card-list>a {
    flex-direction: row;
}

.asset-image-list {
    width: 120px;
    min-height: 120px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Contenuto testuale della card */
.asset-card-grid .p-3,
.asset-card-list .p-3 {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

/* Pulsante per aggiungere all'itinerario direttamente dalla card */
.add-to-itinerary-from-card-btn {
    position: absolute;
    top: 0.75rem;
    /* 12px */
    right: 0.75rem;
    /* 12px */
    background-color: rgba(115, 48, 91, 0.8);
    /* var(--primary) con trasparenza */
    color: white;
    width: 2rem;
    /* 32px */
    height: 2rem;
    /* 32px */
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
    backdrop-filter: blur(2px);
}

.add-to-itinerary-from-card-btn:hover {
    background-color: var(--primary);
    transform: scale(1.1);
}

/* Stile per il pulsante quando un elemento è già stato aggiunto */
.add-to-itinerary-from-card-btn.btn-added {
    background-color: #10B981;
    /* emerald-500 */
}

.add-to-itinerary-from-card-btn.btn-added:hover {
    background-color: #059669;
    /* emerald-600 */
    transform: scale(1.1);
    /* Mantiene l'effetto hover */
}

/* Stili per la sidebar dell'itinerario nella pagina di ricerca */
.itinerary-sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Spinge i controlli a destra */
    gap: 0.75rem;
    /* 12px */
    padding: 0.5rem;
    /* 8px */
    background-color: #f9fafb;
    /* gray-50 */
    border: 1px solid #e5e7eb;
    /* gray-200 */
    border-radius: 0.5rem;
    /* 8px */
    cursor: grab;
    transition: box-shadow 0.2s;
}

/* Stile per l'elemento mentre viene trascinato */
.itinerary-sidebar-item.sortable-chosen {
    cursor: grabbing;
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Stile per il "fantasma" (placeholder) dell'elemento trascinato */
.itinerary-sidebar-item.sortable-ghost {
    background-color: var(--brand-purple-light);
    opacity: 0.5;
}

.itinerary-sidebar-item:hover {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.itinerary-sidebar-item .drag-handle {
    color: #9ca3af;
    /* gray-400 */
    flex-shrink: 0;
}

.itinerary-sidebar-item .item-title {
    flex-grow: 1;
    font-weight: 600;
    font-size: 0.875rem;
    /* 14px */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stili per la timeline nella sidebar di ricerca */
.itinerary-sidebar-segment-info {
    text-align: center;
    padding: 4px 0;
    position: relative;
}

.itinerary-sidebar-segment-info::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background-image: linear-gradient(to bottom, var(--secondary) 50%, transparent 50%);
    background-size: 100% 8px;
    transform: translateX(-50%);
    z-index: -1;
}

.itinerary-sidebar-item .item-number {
    background-color: var(--primary);
    color: white;
}

/* Stile per il link disabilitato */
.disabled-link {
    pointer-events: none;
    opacity: 0.5;
}

/* Stili per il box "Gianna Consiglia" sulla mappa */
#gianna-tip-box {
    background: linear-gradient(135deg, var(--brand-purple), var(--accent));
    backdrop-filter: blur(5px);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Login Page Styles
   ========================================================================== */

/* Applica questi stili solo ai tag <html> e <body> della pagina di login */
.login-page-html,
.login-page-body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    /* Impedisce lo scroll della pagina */
}

.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRy4CmK9M9nEsm-8hWNkV3VzJr8sJDh09QDOw&s');
    background-size: cover;
    background-position: center;
    filter: blur(4px);
    transform: scale(1.05);
    /* Leggero zoom per nascondere i bordi sfocati */
    z-index: -1;
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1rem;
}

.login-box {
    background-color: white;
    padding: 2.5rem;
    /* 40px */
    border-radius: 1rem;
    /* 16px */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 26rem;
    /* 416px */
    animation: slide-in-fade-in 0.5s ease-out forwards;
    opacity: 0;
}

.logo-link {
    display: block;
    margin-bottom: 1.5rem;
    /* 24px */
    text-align: center;
}

.logo {
    height: 2.5rem;
    /* 40px */
    margin: 0 auto;
}

.title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.875rem;
    /* 30px */
    font-weight: 700;
    text-align: center;
    color: var(--text);
    margin-bottom: 0.5rem;
    /* 8px */
}

.subtitle {
    text-align: center;
    color: #6b7280;
    /* gray-500 */
    margin-bottom: 2rem;
    /* 32px */
}

.input-group {
    margin-bottom: 1.25rem;
    /* 20px */
}

.input-label {
    display: block;
    font-size: 0.875rem;
    /* 14px */
    font-weight: 500;
    color: #374151;
    /* gray-700 */
    margin-bottom: 0.5rem;
    /* 8px */
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    /* 12px 16px */
    border: 1px solid #d1d5db;
    /* gray-300 */
    border-radius: 0.5rem;
    /* 8px */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--brand-purple-focus-ring);
}

.extra-options {
    margin-bottom: 1.5rem;
    /* 24px */
}

.submit-button {
    width: 100%;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    padding: 0.875rem;
    /* 14px */
    border-radius: 0.5rem;
    /* 8px */
    transition: background-color 0.2s;
}

.submit-button:hover {
    background-color: var(--brand-purple-dark);
}

.signup-link {
    margin-top: 2rem;
    /* 32px */
    text-align: center;
    font-size: 0.875rem;
    /* 14px */
    color: #4b5563;
    /* gray-600 */
}

.stat-card {
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.stat-card:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 0 6px 6px rgba(0, 0, 0, 0.1);
    /* shadow-xl */
}


/* Stili per il pannello a comparsa di Gianna */
#gianna-suggestions-panel {
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

.panel-hidden {
    transform: translateX(110%);
    opacity: 0;
    pointer-events: none;
}

.panel-visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   8. LEAFLET POPUP OVERRIDES
   ========================================================================== */

.leaflet-popup-content-wrapper {
    border-radius: 0.75rem;
    /* 12px */
    padding: 0;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 0 !important;
    width: 100% !important;
}

.map-popup-card {
    width: 256px;
    /* w-64 */
    overflow: hidden;
}

.map-popup-image {
    width: 100%;
    height: 128px;
    /* h-32 */
    object-fit: cover;
}

.add-to-itinerary-from-popup-btn {
    background-color: var(--brand-purple);
    color: white;
    width: 1.75rem;
    /* 28px */
    height: 1.75rem;
    /* 28px */
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
    border: none;
    cursor: pointer;
}

/* ==========================================================================
   6. NEWS & EVENTS CARDS
   ========================================================================== */

/* Card hover effects */
.event-card {
    transition: all 0.3s ease-in-out;
}

.event-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.news-card {
    transition: all 0.3s ease-in-out;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* Featured cards special styling */
.featured-card {
    position: relative;
    overflow: hidden;
}

.featured-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* background: linear-gradient(135deg, rgba(115, 48, 91, 0.1) 0%, rgba(191, 11, 128, 0.1) 100%); Removed as per user request */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.featured-card:hover::before {
    opacity: 1;
}