;; Events entry card components (all events / page summary)

(defcomp ~events-entry-title-linked (&key href name)
  (a :href href :class "hover:text-emerald-700"
    (h2 :class "text-lg font-semibold text-stone-900" name)))

(defcomp ~events-entry-title-plain (&key name)
  (h2 :class "text-lg font-semibold text-stone-900" name))

(defcomp ~events-entry-title-tile-linked (&key href name)
  (a :href href :class "hover:text-emerald-700"
    (h2 :class "text-base font-semibold text-stone-900 line-clamp-2" name)))

(defcomp ~events-entry-title-tile-plain (&key name)
  (h2 :class "text-base font-semibold text-stone-900 line-clamp-2" name))

(defcomp ~events-entry-page-badge (&key href title)
  (a :href href :class "inline-block px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800 hover:bg-amber-200" title))

(defcomp ~events-entry-cal-badge (&key name)
  (span :class "inline-block px-2 py-0.5 rounded-full text-xs font-medium bg-sky-100 text-sky-700" name))

(defcomp ~events-entry-time-linked (&key href date-str)
  (<> (a :href href :class "hover:text-stone-700" date-str) " · "))

(defcomp ~events-entry-time-plain (&key date-str)
  (<> (span date-str) " · "))

(defcomp ~events-entry-cost (&key cost)
  (div :class "mt-1 text-sm font-medium text-green-600" cost))

(defcomp ~events-entry-card (&key title badges time-parts cost widget)
  (article :class "rounded-xl bg-white shadow-sm border border-stone-200 p-4"
    (div :class "flex flex-col sm:flex-row sm:items-start justify-between gap-3"
      (div :class "flex-1 min-w-0"
        title
        (div :class "flex flex-wrap items-center gap-1.5 mt-1" badges)
        (div :class "mt-1 text-sm text-stone-500" time-parts)
        cost)
      widget)))

(defcomp ~events-entry-card-tile (&key title badges time cost widget)
  (article :class "rounded-xl bg-white shadow-sm border border-stone-200 overflow-hidden"
    (div :class "p-3"
      title
      (div :class "flex flex-wrap items-center gap-1 mt-1" badges)
      (div :class "mt-1 text-xs text-stone-500" time)
      cost)
    widget))

(defcomp ~events-entry-tile-widget-wrapper (&key widget)
  (div :class "border-t border-stone-100 px-3 py-2" widget))

(defcomp ~events-entry-widget-wrapper (&key widget)
  (div :class "shrink-0" widget))

(defcomp ~events-date-separator (&key date-str)
  (div :class "pt-2 pb-1"
    (h3 :class "text-sm font-semibold text-stone-500 uppercase tracking-wide" date-str)))

(defcomp ~events-grid (&key grid-cls cards)
  (div :class grid-cls cards))

(defcomp ~events-main-panel-body (&key toggle body)
  (<> toggle body (div :class "pb-8")))
