/* Keyframes for carousel animation */
@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-250px * 5));
    }
}

/* Carousel Section */
.carousel-section {
    padding: 0;
    background: linear-gradient(to bottom,
            #000 0%,
            #000 60px,
            /* Altura do gradiente de transição */
            #0a0a0a 120px,
            /* Transição suave para o cinza */
            #111 100%);
    overflow: hidden;
    position: relative;
    margin-top: calc(-10vh - 150px);
    /* Move a seção 200px para cima */
    z-index: 1;
    width: 100%;
    padding: calc(10vh + 27px) 0 4rem;
    /* Compensa o movimento para manter o conteúdo no lugar */
}

/* Linha superior - fundo preto */
.carousel-row:first-child {
    background: transparent;
    padding-top: 1rem;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
    transform: translateY(-20%);
    /* Move a primeira linha 20% para cima */
}

/* Linhas seguintes - fundo transparente para mostrar o gradiente da section */
.carousel-row:not(:first-child) {
    background: transparent;
    margin-top: 45px;
    /* Espaçamento de 45px entre as linhas */
    position: relative;
    z-index: 1;
    transform: translateY(-20%);
    /* Move as linhas seguintes 20% para cima */
}

/* Remove margem inferior da primeira linha já que usamos margin-top nas linhas seguintes */
.carousel-row:first-child {
    margin-bottom: 0;
}

/* Suaviza a transição entre as linhas */
.carousel-row {
    position: relative;
}

/* Adiciona um pequeno gradiente de sobreposição para suavizar a transição */
.carousel-row:first-child::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0) 0%,
            #0a0a0a 100%);
    z-index: -1;
}

.carousel-container {
    width: 100%;
    margin: 0;
    position: relative;
}

.carousel-row {
    display: flex;
    margin-bottom: 0;
    position: relative;
    min-height: 70px;
    height: auto;
    overflow: visible;
    padding: 0.5rem 2rem;
    align-items: flex-start;
    box-sizing: border-box;
}

.carousel-track {
    display: flex;
    position: absolute;
    white-space: nowrap;
    will-change: transform;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

/* First row: left to right */
.carousel-row:nth-child(1) .carousel-track {
    animation-name: slideLeftToRight;
    animation-duration: 60s;
}

/* Second row: right to left - 15% slower */
.carousel-row:nth-child(2) .carousel-track {
    animation-name: slideRightToLeft;
    animation-duration: 75s;
    /* Aumentado de 65s para 75s (15% mais lento) */
    justify-content: flex-end;
}

/* Third row: left to right (slower) */
.carousel-row:nth-child(3) .carousel-track {
    animation-name: slideLeftToRight;
    animation-duration: 70s;
}

.carousel-card {
    background: rgba(10, 10, 10, 0.7);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    margin: 0 0.75rem 0 0;
    min-width: 450px;
    width: 450px;
    height: auto;
    min-height: 60px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.carousel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1) 0%, transparent 100%);
    z-index: 0;
}

.carousel-card:hover {
    transform: translateY(-3px) scale(1.02);
    /* Adicionado leve escala */
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.3);
    z-index: 10;
    /* Garante que o card em hover fique acima dos outros */
    transition: all 0.3s ease;
}

.carousel-card-category {
    font-size: 0.65rem;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.8rem;
    padding: 0.2rem 0.6rem;
    background: rgba(0, 255, 255, 0.1);
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.carousel-card-title {
    font-size: 0.85rem;
    font-weight: 400;
    color: #fff;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    max-width: 100%;
    white-space: normal;
    word-wrap: break-word;
}

.carousel-card-description {
    font-size: 0.9rem;
    color: #aaa;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    /* Standard property for better browser support */
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    margin-top: 0.5rem;
}

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

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

@keyframes slideRightToLeft {
    0% {
        transform: translateX(-50%);
    }

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

/* Aplica as animações */
.carousel-row:nth-child(1) .carousel-track {
    animation: slideLeftToRight 60s linear infinite;
}

.carousel-row:nth-child(2) .carousel-track {
    animation: slideRightToLeft 70s linear infinite;
}

.carousel-row:nth-child(3) .carousel-track {
    animation: slideLeftToRight 80s linear infinite;
}



/* Responsive adjustments */
@media (max-width: 768px) {
    .carousel-card {
        min-width: 300px;
        width: 300px;
        padding: 0.6rem 1rem;
    }

    .carousel-card-title {
        font-size: 0.8rem;
        max-width: 200px;
    }

    .carousel-card-category {
        font-size: 0.6rem;
        padding: 0.15rem 0.6rem;
    }
}

@media (max-width: 1024px) {
    .carousel-card {
        min-width: 280px;
        height: auto;
    }
}

@media (max-width: 768px) {
    .carousel-section {
        padding: 2rem 1rem;
        margin-top: 2vw;
    }

    /* Esconde o divisor de circuito apenas no mobile dentro da carousel */
    .carousel-section .circuit-divider {
        display: none !important;
    }

    .carousel-row {
        height: auto;
        /* evita corte de conteúdo dentro da fileira */
        margin: 0;
        /* zera margens padrões para controle fino */
    }

    .carousel-row+.carousel-row {
        margin-top: 14vw !important;
        /* distância desejada entre 1ª e 2ª fileira */
    }

    .carousel-card {
        max-width: 26vw !important;
        height: auto;
        padding: 1.2rem;
    }
}