---
import WidgetWrapper from '~/components/ui/WidgetWrapper.astro';
import ItemGrid from '~/components/ui/ItemGrid.astro';
import Headline from '~/components/ui/Headline.astro';
import type { Features as Props } from '~/types';

const {
  title = await Astro.slots.render('title'),
  subtitle = await Astro.slots.render('subtitle'),
  tagline = await Astro.slots.render('tagline'),
  items = [],
  columns = 2,

  defaultIcon,

  id,
  isDark = false,
  classes = {},
  bg = await Astro.slots.render('bg'),
} = Astro.props;
---

<WidgetWrapper id={id} isDark={isDark} containerClass={`max-w-5xl ${classes?.container ?? ''}`} bg={bg}>
  <Headline title={title} subtitle={subtitle} tagline={tagline} classes={classes?.headline as Record<string, string>} />
  <ItemGrid
    items={items}
    columns={columns}
    defaultIcon={defaultIcon}
    classes={{
      container: 'gap-6',
      panel: 'bg-white/90 dark:bg-slate-900/90 rounded-2xl shadow-lg hover:shadow-xl transition-shadow duration-200 border border-gray-100 dark:border-slate-800 p-6 flex flex-col gap-2',
      title: 'md:text-[1.3rem] font-semibold text-gray-900 dark:text-white',
      description: 'text-gray-600 dark:text-gray-300',
      icon: 'text-white bg-primary rounded-full w-10 h-10 p-2 md:w-12 md:h-12 md:p-3 mr-4 rtl:ml-4 rtl:mr-0',
      ...((classes?.items as Record<string, never>) ?? {}),
    }}
  />
</WidgetWrapper>
