.container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: var(--theme-spacing-md);
    overflow: hidden;
    user-select: none;
    background-color: var(--theme-colors-surface);
    border-radius: var(--theme-radius-md);
}

.container.selected {
    outline: 2px solid var(--theme-colors-primary);
    outline-offset: var(--card-gap, var(--theme-spacing-md));
}

.container.dragging {
    opacity: 0.5;
}

.image-container {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    border-radius: var(--theme-radius-md);

    &::before {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 5;
        width: 100%;
        height: 100%;
        pointer-events: none;
        content: '';
        background-color: rgb(0 0 0);
        opacity: 0;
        transition: all 0.2s ease-in-out;
    }

    &:hover {
        @mixin dark {
            &::before {
                opacity: 0.7;
            }
        }

        @mixin light {
            &::before {
                opacity: 0.5;
            }
        }
    }
}

.image-container.is-round {
    &::before {
        border-radius: 50%;
    }
}

.favorite-badge {
    position: absolute;
    top: -50px;
    left: -50px;
    width: 80px;
    height: 80px;
    pointer-events: none;
    background-color: var(--theme-colors-primary);
    box-shadow: 0 0 10px 8px rgb(0 0 0 / 80%);
    opacity: 1;
    transform: rotate(-45deg);
    transition: opacity 0.2s ease-in-out;
}

.rating-badge {
    position: absolute;
    top: var(--theme-spacing-sm);
    right: var(--theme-spacing-sm);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--theme-spacing-xs) var(--theme-spacing-sm);
    font-size: var(--theme-font-size-md);
    font-weight: 600;
    color: var(--theme-colors-foreground);
    text-shadow: 0 1px 2px rgb(0 0 0 / 80%);
    pointer-events: none;
    background-color: var(--theme-colors-primary);
    border-radius: var(--theme-radius-md);
    box-shadow: 0 2px 8px rgb(0 0 0 / 50%);
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

.image-container:hover .favorite-badge,
.image-container:hover .rating-badge {
    opacity: 0;
}

.image {
    width: 100%;
    height: 100%;
    object-fit: var(--theme-image-fit);
}

.image.is-round {
    border-radius: 50%;
}

.genre-placeholder {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: var(--theme-spacing-sm);
    text-align: center;
}

.genre-placeholder-text {
    display: -webkit-box;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    font-weight: 600;
    line-height: 1.2;
    -webkit-box-orient: vertical;
}

.detail-container {
    display: flex;
    flex-direction: column;
    gap: var(--theme-spacing-xs);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding-top: var(--theme-spacing-sm);
    overflow: hidden;
}

.row {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    a {
        display: inline;
        max-width: 100%;
        color: inherit;
        cursor: pointer;

        &:hover {
            text-decoration: underline;
        }
    }
}

.row.bold {
    font-weight: 500;
}

.row.muted {
    color: var(--theme-colors-foreground-muted);
}

.row.align-start {
    text-align: left;
}

.row.align-center {
    text-align: center;
}

.row.align-end {
    text-align: right;
}

.container.poster {
    padding: 0;
    background-color: inherit;
}

.container.compact {
    position: relative;
    padding: 0;
}

.detail-container.compact {
    position: absolute;
    bottom: 0;
    left: 0;
    gap: 0;
    width: 100%;
    padding: var(--theme-spacing-xs);
    background-color: alpha(var(--theme-colors-background), 0.5);
    backdrop-filter: blur(2px);
    transform: translateY(0);
    transition:
        transform 0.2s ease-in-out,
        opacity 0.2s ease-in-out;
}

.image-container:hover .detail-container.compact {
    opacity: 0;
    transform: translateY(100%);
}

.row.muted.compact {
    color: var(--theme-colors-foreground);
}
