/* === Base Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
    /* Handled by custom smooth scroll in JS for a slower and relaxed speed */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-size: 200% 200%;
    font-size: 16px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input,
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* === Header === */
header {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: white;
    padding: 1rem 0 0;
    text-align: center;
}

a:link {
    text-decoration: inherit;
    color: inherit;
}

a:visited {
    text-decoration: inherit;
    color: inherit;
}

header h1 {
    font-size: 2rem;
    margin: 5% 6%;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* === Language Selector - 44px touch targets for mobile === */
.language-selector {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: -1rem;
    padding: 0.5rem;
}

.lang-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.lang-btn:hover,
.lang-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: white;
}

.flag {
    width: 20px;
    border-radius: 2px;
}

/* === Map Container === */
#map-container {
    position: relative;
    height: 70vh;
    max-height: 800px;
    margin: 1.5rem auto;
    max-width: 1200px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.map-controls button {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin: 5px 0;
    background: #063564;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    min-height: 44px;
}

.map-controls button:hover,
.map-controls button:active {
    background: #5a6fd8;
}

.gpx-layer-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gpx-layer-controls h4 {
    margin: 0 0 8px 0;
    color: #063564;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

.layer-toggle {
    display: flex;
    align-items: center;
    margin: 5px 0;
    padding: 3px 0;
}

.layer-toggle input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 20px;
    height: 20px;
}

.layer-toggle label {
    cursor: pointer;
    font-size: 13px;
    color: #333;
    user-select: none;
    flex: 1;
}

.layer-toggle:hover {
    background: rgba(6, 53, 100, 0.1);
    border-radius: 4px;
    padding: 3px 5px;
}

/* GPX path hover effects */
.gpx-path-hover {
    cursor: pointer;
    filter: brightness(1.2);
}

.gpx-path-selected {
    filter: brightness(1.4) drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
}

/* === Main Content === */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.location-section {

    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 30px 20px;
    text-decoration: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.473);
}

.location-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.location-section.visible:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.location-section h2 {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.location-section .location-subtitle {
    font-size: 1.1rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
    margin-top: -0.5rem;
    margin-bottom: 1.2rem;
    font-weight: 500;
}

.location-section .location-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin-right: 10px;
    background: #063564;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.location-section p {
    margin-bottom: 1rem;
    line-height: 1.8;
    font-size: 19px;
}

.location-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.info-card {
    background: #ffffff4d;
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid #063564;
}

.info-card h4 {
    color: #063564;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* === Back to Map Button === */
.back-to-map {
    position: fixed;
    bottom: 30px;
    right: 5%;
    background: #063564;
    color: white !important;
    padding: 12px 20px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: none;
    min-height: 44px;
    font-size: 0.95rem;
    bottom: calc(30px + env(safe-area-inset-bottom, 0));
}

.back-to-map:hover,
.back-to-map:active {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.back-to-map.show {
    display: block;
}

/* === Footer === */
footer {
    background: #121212;
    color: white;
    text-align: center;
    padding: 5rem 1.5rem;
    padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0));
    margin-top: 2rem;
}

footer img {
    max-width: 280px;
    width: 100%;
    height: auto;
}

.sito {
    letter-spacing: 2px;
}

.settantablu {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.google-review {
    display: block;
    margin: 2.5rem auto;
}

.google-review img {
    border-radius: 12px;
    max-width: 60px;
    display: block;
    margin: 0 auto;
}

.leaflet {
    margin-top: 2rem;
    opacity: 0.6;
    font-size: 0.85rem;
    margin-bottom: 6rem;
}

/* === Popup Styles === */
.custom-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.custom-popup h3 {
    color: #063564;
    margin-bottom: 0.5rem;
}

.custom-popup p {
    margin-bottom: 0.5rem;
}

.custom-popup .popup-link {
    display: inline-block;
    background: #063564;
    color: white;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: 6px;
    margin-top: 0.5rem;
    transition: background 0.3s ease;
    min-height: 40px;
    font-size: 0.95rem;
}

.custom-popup .popup-link:hover,
.custom-popup .popup-link:active {
    background: #5a6fd8;
}

/* Special popup styles */
.special-popup {
    text-align: center;
    padding: 10px 15px;
    min-width: 120px;
}

.special-popup h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: bold;
}

/* === Custom map container background === */
.leaflet-container {
    background: #095f74;
}

/* Prevent subpixel tile gaps in Leaflet on mobile browsers */
.leaflet-tile {
    outline: 1px solid transparent;
}

/* === Audio Player === */
.audio-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 400px;
    margin: 1rem auto 0;
}

.audio-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    min-height: 48px;
}

.audio-play-btn:hover,
.audio-play-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.audio-play-btn.playing {
    background: rgba(255, 255, 255, 0.4);
    border-color: white;
}

/* Audio Player Progress */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.audio-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 0 10px;
    border-radius: 50px;
    height: 40px;
}

.audio-time {
    font-size: 12px;
    min-width: 35px;
    text-align: center;
}

input[type="range"].audio-progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    cursor: pointer;
}

input[type="range"].audio-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"].audio-progress::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* === Modal styles === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    color: #333;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #777;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

/* === Image Slider === */
.image-slider {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.slider-container {
    position: relative;
    display: flex;
    align-items: center;
}

.slider-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    touch-action: pan-y pinch-zoom;
}

.slider-viewport:active {
    cursor: grabbing;
}

.slider-track {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
}

.slide {
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
}

.slide img {
    pointer-events: auto;
    max-width: 100%;
    height: auto;
    display: block;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(6, 53, 100, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.slider-btn:hover,
.slider-btn:active {
    background: rgba(6, 53, 100, 1);
}

.prev-btn {
    left: 8px;
}

.next-btn {
    right: 8px;
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 0;
    background: rgba(0, 0, 0, 0.05);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6b6b6b;
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: #c0c0c0;
}

/* === Animations === */
@keyframes gradientBG {
    0% {
        background-position: 0% 30%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 30%;
    }
}

/* === Loading Screen === */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(6, 53, 100);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* === Toast Notifications === */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    top: calc(20px + env(safe-area-inset-top, 0));
}

.toast {
    background: white;
    color: #333;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    min-width: 250px;
    max-width: calc(100vw - 40px);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    border-left: 4px solid #063564;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: #2ecc71;
}

.toast.error {
    border-left-color: #e74c3c;
}

.toast-icon {
    margin-right: 12px;
    font-size: 1.2rem;
}

/* === Social Media Buttons === */
.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 1.5rem;
}

.social-link2 {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 0.5rem;
    margin-bottom: 2.5rem;
}

.social-btn,
.social-btn2 {
    color: white;
    text-decoration: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.social-btn {
    font-size: 2.2rem;
}

.social-btn2 {
    font-size: 1.5rem;
}

.social-btn:hover,
.social-btn:active,
.social-btn2:hover,
.social-btn2:active {
    transform: translateY(-3px);
    opacity: 0.8;
}

/* === Small Stage Cards === */
.small-cards-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    gap: 15px;
    padding: 10px 20px;
    /* Matches page theme-color / dark theme */
    border-radius: 50px;
    /* Capsule look */
    margin: 15px auto;
    width: fit-content;
    z-index: 1000;
    position: relative;
}

.tappe-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    font-family: inherit;
}

.tappe-nav {
    display: flex;
    gap: 10px;
}

.tappa-circle {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    background: #063564;
    /* Blue for inactive */
    color: white !important;
    text-decoration: none !important;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tappa-circle:hover,
.tappa-circle:active {
    background: #2563eb;
    transform: scale(1.1);
}

.tappa-circle.active {
    background: #f49223;
    /* Yellow for active */
    color: rgb(0, 0, 0) !important;
    /* White text matching user image */
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.6);
    font-weight: 800;
}

.descrizione {
    margin: 3em auto 0;
    text-align: center;
    padding-left: 1em;
    padding-right: 1em;
    color: white;
    max-width: 1200px;
    font-size: 19px;
}

.instructions {
    margin-top: 3em;
    padding-left: 1em;
    padding-right: 1em;
    color: white;
    font-size: 14px;
    font-weight: 200;
}

/* === Video Background === */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.video-background video {
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 28, 67, 0.6);

}

/* === Show All Works Button === */
#showAllWorksBtn {
    background: white;
    margin: 2rem auto;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: none;
    font-weight: bold;
    width: 85%;
    max-width: 400px;
    display: block;
    font-size: 1.1rem;
    font-family: inherit;
    color: inherit;
    min-height: 48px;
}

#showAllWorksBtn:hover,
#showAllWorksBtn:active {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.4rem;
    }

    #map-container {
        height: 55vh;
        margin: 1rem 0.5rem;
        border-radius: 8px;
    }

    .location-section {
        margin: 1rem 0.5rem;
        padding: 19px;
    }

    .map-controls {
        top: 10px;
        right: 10px;
    }

    .gpx-layer-controls {
        bottom: 10px;
        right: 10px;
    }

    .slider-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 16px;
    }

    .prev-btn {
        left: 5px;
    }

    .next-btn {
        right: 5px;
    }
}

@media (max-width: 380px) {
    .language-selector {
        gap: 4px;
    }

    .lang-btn {
        min-width: 40px;
        min-height: 40px;
        font-size: 16px;
    }

    header h1 {
        font-size: 1.2rem;
    }
}

/* === Copyable Coordinates === */
.copyable-coords {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    display: inline-block;
    margin: 4px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.copyable-coords:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.copyable-coords:active {
    transform: scale(0.98);
    background: rgba(46, 204, 113, 0.2);
}