/**
 * Step 1 transaction picker — 3 styles × 3 layouts (8 combos).
 *
 * Class contract (from cq_step1_wrapper_class() in cq-step1-config.php):
 *   .cq-step1                                  (base wrapper)
 *   .cq-step1--{style}                         (large-button | icon-box | text-box)
 *   .cq-step1--layout-{layout}                 (grid | row | stacked)
 *   .cq-step1--icon-{position}                 (top | left — Icon Box + Grid only)
 *
 * Every option tile has the same DOM structure:
 *   button.cq-step1-option
 *     span.cq-step1-option-icon > i.fa
 *     span.cq-step1-option-body
 *       span.cq-step1-option-label
 *       span.cq-step1-option-desc
 *     span.cq-step1-option-arrow
 *
 * Style CSS hides/shows/reorders the parts appropriately per combo, so the
 * markup stays uniform and the config-driven renderer stays simple.
 *
 * Loaded on both the frontend (customer-facing form) and the admin Styling
 * page (live preview). Same rules → same visual result.
 */

/* ============ Base wrapper + option ============ */

.cq-step1 {
    display: grid;
    gap: 12px;
    margin: 4px 0;
}

/* Transaction Step tokens (--mcq-tx-*) fall back to Choice buttons
   (--mcq-choice-*) when unset, so partners who don't override on the
   Transaction Step tab inherit their existing Choice button styling.
   Set any --mcq-tx-* on the Transaction Step tab to override just for
   Step 1 tiles. */
.cq-step1-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--mcq-tx-bg, var(--mcq-choice-bg, rgba(111, 123, 138, 0.15)));
    color: var(--mcq-tx-fg, var(--mcq-choice-fg, #1f2937));
    border: 1.5px solid var(--mcq-tx-border, var(--mcq-choice-border, transparent));
    border-radius: var(--mcq-choice-radius, 999px);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 100ms ease;
    width: 100%;
    box-sizing: border-box;
}

.cq-step1-option:hover:not(.is-active) {
    background: var(--mcq-tx-bg-hover, var(--mcq-choice-bg-hover, #d5e8db));
    color: var(--mcq-tx-fg-hover, var(--mcq-choice-fg-hover, #2b2a67));
    border-color: var(--mcq-tx-border-hover, var(--mcq-choice-border-hover, #2b2a67));
}
.cq-step1-option.is-active {
    background: var(--mcq-tx-bg-active, var(--mcq-choice-bg-active, #2b2a67));
    color: var(--mcq-tx-fg-active, var(--mcq-choice-fg-active, #ffffff));
    border-color: var(--mcq-tx-border-active, var(--mcq-choice-border-active, #2b2a67));
}
.cq-step1-option:focus-visible {
    outline: 2px solid var(--mcq-primary, #2b2a67);
    outline-offset: 2px;
}

.cq-step1-option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    line-height: 1;
}
.cq-step1-option-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.cq-step1-option-label {
    font-size: 15px;
    font-weight: 600;
}
.cq-step1-option-desc {
    font-size: 12px;
    opacity: 0.75;
    line-height: 1.4;
    /* Line-clamp so a long description doesn't blow the tile height. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cq-step1-option-arrow {
    flex-shrink: 0;
    font-size: 18px;
    opacity: 0.55;
    transition: transform 150ms ease, opacity 150ms ease;
}
.cq-step1-option:hover .cq-step1-option-arrow {
    transform: translateX(2px);
    opacity: 1;
}

/* Disabled tile (admin preview only — the frontend doesn't render disabled
   ones at all). Faded + non-interactive. */
.cq-step1-option--disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* ============ Style modifiers — control what SHOWS on the tile ============ */

/* Large Buttons: label only. Hide icon, description, arrow. */
.cq-step1--large-button .cq-step1-option-icon,
.cq-step1--large-button .cq-step1-option-desc,
.cq-step1--large-button .cq-step1-option-arrow {
    display: none;
}
.cq-step1--large-button .cq-step1-option {
    justify-content: center;
    padding: 16px 20px;
}
.cq-step1--large-button .cq-step1-option-label {
    font-size: 16px;
    text-align: center;
}

/* Icon Boxes: icon + label. Hide description. Arrow only in stacked. */
.cq-step1--icon-box .cq-step1-option-desc {
    display: none;
}
.cq-step1--icon-box:not(.cq-step1--layout-stacked) .cq-step1-option-arrow {
    display: none;
}

/* Text Boxes: label + description. Hide icon. Show arrow in stacked. */
.cq-step1--text-box .cq-step1-option-icon {
    display: none;
}
.cq-step1--text-box:not(.cq-step1--layout-stacked) .cq-step1-option-arrow {
    display: none;
}

/* ============ Layout modifiers ============ */

/* Grid — 2×2 (or single-column at very narrow widths). */
.cq-step1--layout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 480px) {
    .cq-step1--layout-grid { grid-template-columns: 1fr; }
}

/* Row — single horizontal ribbon. Auto-columns so tiles size to content. */
.cq-step1--layout-row {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}
.cq-step1--layout-row .cq-step1-option {
    justify-content: center;
    padding: 12px 14px;
}
.cq-step1--layout-row .cq-step1-option-label { font-size: 14px; text-align: center; }

/* Stacked — full-width vertical list. Each tile spans the row. */
.cq-step1--layout-stacked {
    grid-template-columns: 1fr;
}
.cq-step1--layout-stacked .cq-step1-option {
    padding: 16px 20px;
}
.cq-step1--layout-stacked .cq-step1-option-body {
    align-items: flex-start;
}

/* ============ Icon-position modifier (Icon Boxes + Grid only) ============ */

/* Icon Top — icon centered above label. */
.cq-step1--icon-box.cq-step1--layout-grid.cq-step1--icon-top .cq-step1-option {
    flex-direction: column;
    text-align: center;
    padding: 20px 16px;
    align-items: center;
    justify-content: center;
}
.cq-step1--icon-box.cq-step1--layout-grid.cq-step1--icon-top .cq-step1-option-icon {
    font-size: 32px;
    margin-bottom: 4px;
}
.cq-step1--icon-box.cq-step1--layout-grid.cq-step1--icon-top .cq-step1-option-body {
    align-items: center;
    flex: 0 0 auto;
}

/* Icon Left — icon beside label (grid layout — already the default). */
/* No overrides needed; base .cq-step1-option is already flex-row with icon left. */

/* ============ Icon Box + Row — always icon on top (compact chip style) ============ */

.cq-step1--icon-box.cq-step1--layout-row .cq-step1-option {
    flex-direction: column;
    text-align: center;
    gap: 6px;
    padding: 14px 12px;
    align-items: center;
    justify-content: center;
}
.cq-step1--icon-box.cq-step1--layout-row .cq-step1-option-icon {
    font-size: 20px;
}

/* ============ Text Box + Grid — cards with heading + description ============ */

.cq-step1--text-box.cq-step1--layout-grid .cq-step1-option {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 20px;
    text-align: left;
    border-radius: var(--mcq-radius-card, 16px);
}
.cq-step1--text-box.cq-step1--layout-grid .cq-step1-option-body {
    gap: 6px;
    width: 100%;
}
.cq-step1--text-box.cq-step1--layout-grid .cq-step1-option-label {
    font-size: 16px;
}
.cq-step1--text-box.cq-step1--layout-grid .cq-step1-option-desc {
    font-size: 13px;
    -webkit-line-clamp: 3;
}

/* ============ Text Box + Stacked — richest layout ============ */

.cq-step1--text-box.cq-step1--layout-stacked .cq-step1-option {
    padding: 18px 22px;
    border-radius: var(--mcq-radius-card, 16px);
}
.cq-step1--text-box.cq-step1--layout-stacked .cq-step1-option-desc {
    font-size: 13px;
    -webkit-line-clamp: 3;
}

/* ============ Icon Box + Stacked — icon left, label + arrow right ============ */

.cq-step1--icon-box.cq-step1--layout-stacked .cq-step1-option-icon {
    font-size: 22px;
}
