/*
 * card_listitem_widget — visual layer.
 *
 * The renderer (CardListitemWidgetRenderer.kt) emits this structure:
 *
 *   .card-listitem-widget                ← root (outer wrapper)
 *     .card-listitem-row                 ← horizontal flex: image | body
 *       .card-listitem-image  > <img/>   ← optional thumbnail (square)
 *       .card-listitem-body              ← stacked title + subtitle
 *         .card-listitem-title           ← bold heading line
 *         .card-listitem-subtitle        ← secondary line
 *
 * All visual decisions live here. The renderer never inlines styles —
 * authors override the look from the design panel by attaching their
 * own CSS classes on each region.
 *
 * Designed to look good at any width down to ~240px and to stay
 * vertically aligned regardless of whether the image / title / subtitle
 * are present. Mobile-friendly defaults; no media queries needed.
 */

.card-listitem-widget {
    display: block;
    background: #ffffff;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    padding: 12px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 1px 1px rgba(15, 23, 42, 0.06);
    transition:
        box-shadow 160ms ease,
        transform   160ms ease,
        border-color 160ms ease;
    box-sizing: border-box;
}

.card-listitem-widget:hover {
    border-color: #cfd8e3;
    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.08),
        0 2px 4px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

/* ── Inner row ─────────────────────────────────────────────────────────── */

.card-listitem-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 14px;
    min-height: 64px;
}

/* ── Thumbnail ─────────────────────────────────────────────────────────── */
/* Square avatar-style tile. Fixed width keeps multiple cards aligned in a
   column even when titles wrap to different line counts. */

.card-listitem-image {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-listitem-image > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Body (title + subtitle stack) ────────────────────────────────────── */

.card-listitem-body {
    flex: 1 1 auto;
    min-width: 0;                /* let `text-overflow` work inside flex */
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

/* ── Title ─────────────────────────────────────────────────────────────── */

.card-listitem-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: #0f172a;
    /* Truncate to two lines max — keeps card heights consistent in a list. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* ── Subtitle ──────────────────────────────────────────────────────────── */

.card-listitem-subtitle {
    font-size: 13px;
    line-height: 1.4;
    color: #64748b;
    /* One-line subtitle is the common case; anything longer truncates. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
