.carousel-container {
    position: relative;
    width: 100%;
    margin-bottom: var(--theme-spacing-md);
    container-type: inline-size;
    overflow: hidden;
    border-radius: var(--theme-radius-md);
}

.carousel {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--items-per-row, 1), 1fr);
    gap: var(--theme-spacing-sm);
    width: 100%;
    min-height: 280px;
    padding: 0 var(--theme-spacing-md);
    overflow: hidden;
}

.carousel-item {
    position: relative;
    width: 100%;
    min-height: 280px;
    overflow: hidden;
    border-radius: var(--theme-radius-md);
    isolation: isolate;
}

.blurred-background {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    opacity: 0.8;
    transform: scale(1.1);
}

.carousel-item :global(.overlay) {
    border-radius: var(--theme-radius-md);
}

.carousel-link {
    display: block;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: var(--theme-spacing-xs);
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    min-height: 280px;
    padding: var(--theme-spacing-md);
}

.single-carousel-container .carousel {
    min-height: 240px;
}

.single-carousel-container .carousel-item {
    min-height: 240px;
}

.single-carousel-container .carousel-item .content {
    flex-direction: row;
    gap: var(--theme-spacing-md);
    align-items: flex-end;
    min-height: 240px;
    padding: var(--theme-spacing-xl);
}

.title-section {
    display: flex;
    flex-shrink: 0;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    text-align: left;
}

.image-section {
    position: relative;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 160px;
    min-height: 160px;
    max-height: 160px;
}

.single-carousel-container .carousel-item .content .image-section {
    flex-shrink: 0;
    justify-content: flex-start;
    width: auto;
    height: auto;
    min-height: auto;
    max-height: none;
}

.play-button-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

.image-section:hover .play-button-overlay {
    pointer-events: auto;
    opacity: 1;
}

.metadata-section {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 60px;
    min-height: 60px;
    max-height: 60px;
    text-align: center;
}

.single-carousel-container .carousel-item .content .metadata-section {
    flex: 1;
    align-items: flex-start;
    justify-content: center;
    height: auto;
    min-height: auto;
    max-height: none;
    text-align: left;
}

/* Hide metadata on screens smaller than xs */
@media (width < 36em) {
    .single-carousel-container .carousel-item .content .metadata-section {
        display: none;
    }
}

.image-link {
    display: block;
    transition: transform 0.3s ease;
}

.image-link:hover {
    transform: scale(1.02);
}

.image-link:active {
    transform: scale(0.98);
}

.album-image-container {
    position: relative;
    width: 100%;
    max-width: 120px;
    overflow: hidden;
    border-radius: var(--theme-radius-md);
    filter: drop-shadow(0 6px 20px rgb(0 0 0 / 50%)) drop-shadow(0 2px 8px rgb(0 0 0 / 40%));
    transition: filter 0.3s ease;
}

.single-carousel-container .album-image-container {
    width: 200px;
    max-width: 200px;
}

.album-image-container::before {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    width: 100%;
    height: 100%;
    pointer-events: none;
    content: '';
    background-color: rgb(0 0 0 / 0%);
    border-radius: var(--theme-radius-md);
    transition: background-color 0.3s ease;
}

.image-section:hover .album-image-container::before {
    background-color: rgb(0 0 0 / 40%);
}

.album-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--theme-radius-md);
}

.carousel-item:hover .album-image-container,
.carousel-link:hover .album-image-container {
    filter: drop-shadow(0 16px 40px rgb(0 0 0 / 60%)) drop-shadow(0 6px 16px rgb(0 0 0 / 50%));
}

/* Single carousel: remove hover shadow effect */
.single-carousel-container .carousel-item:hover .album-image-container,
.single-carousel-container .carousel-link:hover .album-image-container {
    filter: drop-shadow(0 6px 20px rgb(0 0 0 / 50%)) drop-shadow(0 2px 8px rgb(0 0 0 / 40%));
}

.artist-link {
    display: inline-block;
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.artist-link:hover {
    opacity: 0.8;
}

.title {
    margin-bottom: 0;
    color: white;
    text-shadow: 0 0 8px rgb(0 0 0 / 50%);
}

.artist {
    width: 100%;
    color: white;
    text-shadow: 0 0 8px rgb(0 0 0 / 50%);
}

.badge {
    color: white;
    text-shadow: 0 0 8px rgb(0 0 0 / 50%);
}

.nav-arrow-left,
.nav-arrow-right {
    position: absolute;
    top: 50%;
    z-index: 20;
    border: 1px solid rgb(255 255 255 / 25%);
    backdrop-filter: blur(10px);
    transform: translateY(-50%);
    transition: all 0.2s ease;
}

.nav-arrow-left {
    left: var(--theme-spacing-xs);
}

.nav-arrow-right {
    right: var(--theme-spacing-xs);
}

.nav-arrow-left:hover,
.nav-arrow-right:hover {
    background: transparent !important;
    border-color: rgb(255 255 255 / 35%);
    transform: translateY(-50%) scale(1.1);
}

.nav-arrow-left:active,
.nav-arrow-right:active {
    transform: translateY(-50%) scale(0.95);
}

.single-carousel-container .nav-arrow-left,
.single-carousel-container .nav-arrow-right {
    pointer-events: none;
    opacity: 0;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.single-carousel-container:hover .nav-arrow-left,
.single-carousel-container:hover .nav-arrow-right {
    pointer-events: auto;
    opacity: 1;
}

@container (min-width: $mantine-breakpoint-xs) {
    .carousel-item {
        min-height: 300px;
    }

    .content {
        min-height: 300px;
    }

    .title-section {
        height: 45px;
        min-height: 45px;
        max-height: 45px;
    }

    .image-section {
        height: 180px;
        min-height: 180px;
        max-height: 180px;
    }

    .metadata-section {
        height: 65px;
        min-height: 65px;
        max-height: 65px;
    }

    .album-image-container {
        max-width: 140px;
    }
}

@container (min-width: $mantine-breakpoint-sm) {
    .carousel {
        gap: var(--theme-spacing-md);
    }

    .carousel-item {
        min-height: 320px;
    }

    .content {
        min-height: 320px;
    }

    .title-section {
        height: 50px;
        min-height: 50px;
        max-height: 50px;
    }

    .image-section {
        height: 200px;
        min-height: 200px;
        max-height: 200px;
    }

    .metadata-section {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
    }

    .album-image-container {
        max-width: 160px;
    }
}

@container (min-width: $mantine-breakpoint-md) {
    .carousel-item {
        min-height: 340px;
    }

    .content {
        min-height: 340px;
    }

    .title-section {
        height: 55px;
        min-height: 55px;
        max-height: 55px;
    }

    .image-section {
        height: 220px;
        min-height: 220px;
        max-height: 220px;
    }

    .metadata-section {
        height: 75px;
        min-height: 75px;
        max-height: 75px;
    }

    .album-image-container {
        max-width: 180px;
    }
}

@container (min-width: $mantine-breakpoint-xl) {
    .carousel-item {
        min-height: 360px;
    }

    .content {
        min-height: 360px;
    }

    .title-section {
        height: 60px;
        min-height: 60px;
        max-height: 60px;
    }

    .image-section {
        height: 240px;
        min-height: 240px;
        max-height: 240px;
    }

    .metadata-section {
        height: 80px;
        min-height: 80px;
        max-height: 80px;
    }

    .album-image-container {
        max-width: 200px;
    }
}
