.tech-scroll-container {
    overflow: hidden;
    position: relative;
    padding: 20px 0;
    min-height: 190px; /* Previene il collasso del contenitore */
    touch-action: pan-x; /* Permette lo scroll orizzontale su touch */
    -webkit-user-select: none;
    user-select: none;
}

.tech-scroll-inner {
    display: flex;
    width: max-content; /* Calcolato automaticamente in base al contenuto */
    /* L'animazione per desktop viene disabilitata da JS */
    animation: scrollDesktop 30s linear infinite;
}

@keyframes scrollDesktop {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.tech-box {
    flex: 0 0 auto;
    width: 150px;
    height: 175px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    padding-top: 10px;
    flex-direction: column;
    margin-right: 20px;
    transition: transform 0.2s ease;
}

.tech-box:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.tech-box img {
    max-height: 50px;
    margin-bottom: 10px;
}

.tech-box span {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.tech-box p {
    margin: 5px 0 0;
    text-align: center;
    font-size: 12px;
    color: #666;
    line-height: 16px !important;
    padding: 0 8px;
}

/* --- Stili per le frecce di scorrimento (Solo Desktop) --- */
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    cursor: default; /* Lo scroll è guidato dal mouse, non dal click */
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 10;
    /* Animazione per attirare l'attenzione */
    animation: pulse-arrows 2.5s infinite ease-in-out;
    user-select: none;
}



.left-arrow {
    left: 15px;
}

.right-arrow {
    right: 15px;
}

@keyframes pulse-arrows {
    0% {
        transform: translateY(-50%) scale(1);
        opacity: 0.1;
    }
    50% {
        transform: translateY(-50%) scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 0.1;
    }
}

/* --- Stili per il carosello mobile --- */

@keyframes scrollMobile {
    0% {
        transform: translateX(0);
    }
    100% {
        /* Scorre esattamente della metà, dato che il contenuto è duplicato */
        transform: translateX(-50%);
    }
}

@media screen and (max-width: 991px) {
    .tech-scroll-container {
        /* Effetto fade ai lati per un look più pulito */
        -webkit-mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent);
        mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent);
    }

    .tech-scroll-inner.mobile-carousel {
        /* Applica l'animazione di scorrimento infinita */
        animation: scrollMobile 40s linear infinite;
    }

    /* Mette in pausa l'animazione al tocco o al passaggio del mouse */
    .tech-scroll-container:hover .mobile-carousel,
    .tech-scroll-container:focus-within .mobile-carousel {
        animation-play-state: paused;
    }

    /* Nasconde le frecce su mobile */
    .scroll-arrow {
        display: none;
    }
}

/* Dark mode support for tech boxes */
body.dark-mode .tech-box {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 144, 25, 0.3);
}

body.dark-mode .tech-box:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 144, 25, 0.6);
}

body.dark-mode .tech-box span {
    color: #ffffff;
}

body.dark-mode .tech-box p {
    color: #cccccc;
}
