/* ============================================================
   LibreCOD Form Templates — base + 4 template styles
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

/* ── Root ──────────────────────────────────────────────────────────────── */
#lc-form-root {
    --lf-primary:   #EF4444;
    --lf-secondary: #1e293b;
    --lf-radius:    8px;
    --lf-input-h:   44px;
    --lf-gap:       10px;
    font-family: 'Cairo', sans-serif;
    color: var(--lf-secondary);
    box-sizing: border-box;
}
#lc-form-root *,#lc-form-root *::before,#lc-form-root *::after { box-sizing: inherit; }

/* ── Shared inputs ──────────────────────────────────────────────────────── */
.lf-input {
    display: block;
    width: 100%;
    height: var(--lf-input-h);
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: var(--lf-radius);
    background: #fff;
    color: var(--lf-secondary);
    font-size: .9rem;
    font-family: inherit;
    transition: border-color .15s;
    outline: none;
}
.lf-input:focus { border-color: var(--lf-primary); box-shadow: 0 0 0 2px rgba(239,68,68,.12); }
.lf-input--city { cursor: pointer; }
.lf-label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 4px; }
.lf-req { color: #ef4444; }

/* ── Field rows ─────────────────────────────────────────────────────────── */
.lf-fields { display: flex; flex-direction: column; gap: var(--lf-gap); margin-bottom: 14px; }
.lf-field-row { display: flex; flex-direction: column; }
.lf-fields--2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--lf-gap); }
.lf-fields--2col .lf-field-row--full { grid-column: 1 / -1; }
.lf-fields--icons .lf-field-row { flex-direction: row; align-items: flex-start; gap: 8px; }
.lf-fields--icons .lf-field-inner { flex: 1; }
.lf-field-icon { width: 36px; height: var(--lf-input-h); display: flex; align-items: center; justify-content: center; color: var(--lf-primary); flex-shrink: 0; margin-top: 20px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.lf-btn-buy {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--lf-primary); color: #fff;
    border: none; border-radius: var(--lf-radius);
    padding: 0 20px; height: 48px;
    font-size: .95rem; font-weight: 700; cursor: pointer;
    transition: filter .15s, opacity .15s;
    white-space: nowrap;
}
.lf-btn-buy:hover { filter: brightness(.92); }
.lf-btn-buy:disabled { opacity: .6; cursor: wait; }
.lf-btn-buy.lf-btn--block { width: 100%; margin-top: 10px; border-radius: 50px; }
.lf-btn-buy.lf-btn--caps { letter-spacing: .06em; text-transform: uppercase; border-radius: 50px; }

.lf-btn-cart {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; height: 44px; margin-top: 8px;
    background: transparent; color: var(--lf-secondary);
    border: 1.5px solid currentColor; border-radius: var(--lf-radius);
    font-size: .9rem; font-weight: 600; cursor: pointer;
    transition: background .15s, color .15s;
}
.lf-btn-cart:hover { background: #f1f5f9; }
.lf-btn-cart.lf-btn--outline { border-color: var(--lf-primary); color: var(--lf-primary); border-radius: 50px; }
.lf-btn-cart.lf-btn--block { border-radius: 50px; }
.lf-btn-cart.lf-btn--caps { letter-spacing: .06em; text-transform: uppercase; border-radius: 50px; }

.lf-btn-wa {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%; height: 48px; margin-top: 8px;
    background: #25D366; color: #fff;
    border: none; border-radius: var(--lf-radius);
    font-size: .9rem; font-weight: 700; cursor: pointer;
}
.lf-btn-wa.lf-btn--block { border-radius: 50px; }
.lf-btn-wa:hover { filter: brightness(.93); }

/* ── Qty controls ────────────────────────────────────────────────────────── */
.lf-qty { display: flex; align-items: center; gap: 6px; }
.lf-qty-btn {
    width: 36px; height: 36px;
    background: #f1f5f9; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 1.1rem; font-weight: 700; cursor: pointer; color: var(--lf-secondary);
    display: flex; align-items: center; justify-content: center;
}
.lf-qty-btn:hover { background: #e2e8f0; }
.lf-qty-val { min-width: 30px; text-align: center; font-weight: 700; font-size: 1rem; }

/* ── Legacy actions row (kept for back-compat) ───────────────────────────── */
.lf-actions {
    display: flex; align-items: center; gap: 10px; margin: 12px 0 6px;
}
.lf-actions .lf-btn-buy { flex: 1; }

/* ── Unified action rows ─────────────────────────────────────────────────── */
.lf-act-row { display: flex; align-items: stretch; gap: 8px; margin: 10px 0 4px; }
.lf-act-buy, .lf-act-cart {
    flex: 2; min-width: 0; height: 48px; padding: 0 16px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: var(--lf-radius);
    font-family: inherit; font-size: .95rem; font-weight: 700;
    cursor: pointer; transition: background .15s; white-space: nowrap;
}
.lf-act-buy { background: var(--lf-primary); color: #fff; }
.lf-act-buy:hover, .lf-act-buy:active { background: var(--lf-buy-hover); }
.lf-act-buy:disabled { opacity: .6; cursor: wait; }
.lf-act-cart { background: var(--lf-cart-bg); color: #fff; }
.lf-act-cart:hover, .lf-act-cart:active { background: var(--lf-cart-hover); }
.lf-act-wa {
    flex: 1; min-width: 0; height: 48px; padding: 0 10px;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    background: #25D366; color: #fff;
    border: none; border-radius: var(--lf-radius);
    font-family: inherit; font-size: .85rem; font-weight: 700;
    cursor: pointer; transition: background .15s; white-space: nowrap;
}
.lf-act-wa:hover, .lf-act-wa:active { background: var(--lf-wa-hover); }
.lf-act-row--primary .lf-qty { flex: 1; min-width: 0; justify-content: center; }


/* ── Summary ─────────────────────────────────────────────────────────────── */
.lf-summary { border-top: 1px solid #e5e7eb; margin-top: 14px; padding-top: 12px; }
.lf-sum-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: .9rem; }
.lf-sum-total { font-weight: 700; font-size: 1rem; border-top: 1px solid #e5e7eb; margin-top: 4px; padding-top: 8px; }

/* ── Collapsible summary ─────────────────────────────────────────────────── */
.lf-collapsible-summary { margin-top: 14px; }
.lf-sum-toggle {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; padding: 10px 0; border-top: 1px solid #e5e7eb;
    font-size: .9rem; font-weight: 600; user-select: none;
}
.lf-sum-toggle-arrow { font-size: .85rem; transition: transform .2s; color: var(--lf-primary); }
.lf-sum-toggle.lf-open .lf-sum-toggle-arrow { transform: rotate(180deg); }
.lf-sum-body { overflow: hidden; max-height: 0; transition: max-height .28s ease; }
.lf-sum-body.lf-open { max-height: 160px; }

/* ── Btn group (flat-ar) ─────────────────────────────────────────────────── */
.lf-btn-group { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.lf-btn-group .lf-btn-buy,.lf-btn-group .lf-btn-cart,.lf-btn-group .lf-btn-wa { width: 100%; height: 48px; border-radius: var(--lf-radius); margin: 0; }

/* ── Section label ───────────────────────────────────────────────────────── */
.lf-section-label { font-size: .8rem; font-weight: 700; color: #64748b; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Variation units ─────────────────────────────────────────────────────── */
#lf-var-container { margin: 0 0 12px; }
.lf-var-container.lf-vc--top { margin-bottom: 14px; }
.lf-var-container.lf-vc--minimal { margin-bottom: 12px; }
.lf-unit-card + .lf-unit-card { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e5e7eb; }
.lf-unit-header { font-size: .78rem; font-weight: 700; color: #64748b; margin-bottom: 6px; }
.lf-var-group { margin-bottom: 10px; }
.lf-var-group-name { font-size: .8rem; font-weight: 600; margin-bottom: 6px; }
.lf-var-values { display: flex; flex-wrap: wrap; gap: 6px; }

/* Variation text buttons */
.lf-var-btn {
    padding: 5px 12px; height: 34px;
    border: 1.5px solid #cbd5e1; border-radius: 6px;
    background: #fff; color: var(--lf-secondary);
    font-size: .85rem; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.lf-var-btn:hover { border-color: var(--lf-primary); }
.lf-var-btn.lf-active { border-color: var(--lf-primary); border-width: 2px; color: var(--lf-primary); background: rgba(239,68,68,.05); }

/* Color swatch buttons */
.lf-var-swatch {
    width: 34px; height: 34px; border-radius: 50%; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12);
}
.lf-var-swatch.lf-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--lf-primary); }
.lf-swatch-check { color: #fff; font-size: .75rem; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* ── Trust badges ────────────────────────────────────────────────────────── */
.lf-trust { display: flex; justify-content: space-around; margin-top: 18px; padding-top: 14px; border-top: 1px solid #e5e7eb; }
.lf-trust-item { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .72rem; text-align: center; color: #64748b; }
.lf-ti-icon { color: var(--lf-primary); }


/* ══════════════════════════════════════════════════════════════════════════
 *  TEMPLATE 1 — Dashed border, image bundle rows, icon 2-col fields
 * ══════════════════════════════════════════════════════════════════════════ */
.lf-t1-wrap {
    border: 2px dashed #c7d0dc; border-radius: 14px; padding: 18px;
}
.lf-t1-header {
    text-align: center; font-size: 1rem; font-weight: 700;
    margin: 0 0 16px; color: var(--lf-secondary);
}
/* T1 vars: label right + values left in a horizontal row */
.lf-t1-vars .lf-var-group {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.lf-t1-vars .lf-var-group-name { flex-shrink: 0; font-size: .88rem; font-weight: 600; }
.lf-t1-vars .lf-var-values { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
/* T1 bundle rows */
.lf-t1-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 8px;
    border: 1.5px solid #e2e8f0; border-radius: 10px;
    cursor: pointer; transition: background .15s, border-color .15s;
}
.lf-t1-row:hover { border-color: var(--lf-primary); }
.lf-t1-row.lf-active { background: #f0f0f0; border-color: transparent; }
.lf-t1-check { color: #c7d0dc; flex-shrink: 0; line-height: 1; }
.lf-t1-row.lf-active .lf-t1-check { color: var(--lf-primary); }
.lf-t1-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lf-t1-title { font-weight: 600; font-size: .9rem; }
.lf-t1-badge {
    background: var(--lf-primary); color: #fff;
    border-radius: 50px; padding: 1px 7px; font-size: .7rem; font-weight: 700;
    display: inline-block; width: fit-content;
}
.lf-t1-price-col { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 68px; }
.lf-t1-price { font-weight: 700; color: var(--lf-primary); font-size: .9rem; }
.lf-t1-old { font-size: .74rem; color: #94a3b8; }


/* ══════════════════════════════════════════════════════════════════════════
 *  TEMPLATE 2 — No border, radio-card bundles, 3 stacked buttons
 * ══════════════════════════════════════════════════════════════════════════ */
.lf-t2-header { font-size: .88rem; color: #64748b; margin: 0 0 14px; line-height: 1.5; }
/* T2 vars: same compact label+values row as T1 */
.lf-t2-vars .lf-var-group {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.lf-t2-vars .lf-var-group-name { flex-shrink: 0; font-size: .88rem; font-weight: 600; }
.lf-t2-vars .lf-var-values { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
/* T2 bundle cards */
.lf-t2-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.lf-t2-card {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border: 1.5px solid #e2e8f0; border-radius: var(--lf-radius);
    cursor: pointer; transition: border-color .15s, background .15s;
}
.lf-t2-card:hover { border-color: var(--lf-primary); }
.lf-t2-card.lf-active { border-color: var(--lf-primary); background: rgba(0,0,0,.03); }
.lf-t2-radio {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid #cbd5e1; flex-shrink: 0; transition: border-color .15s, background .15s;
}
.lf-t2-card.lf-active .lf-t2-radio { border-color: var(--lf-primary); background: var(--lf-primary); box-shadow: inset 0 0 0 3px #fff; }
.lf-t2-body { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lf-t2-title { font-weight: 600; font-size: .9rem; }
.lf-t2-free { background: #dcfce7; color: #16a34a; border-radius: 50px; padding: 1px 8px; font-size: .72rem; font-weight: 700; }
.lf-t2-badge { background: var(--lf-primary); color: #fff; border-radius: 50px; padding: 1px 7px; font-size: .7rem; font-weight: 700; }
.lf-t2-price { text-align: end; flex-shrink: 0; }
.lf-t2-amount { font-weight: 700; color: var(--lf-primary); display: block; font-size: .95rem; }
.lf-t2-old { font-size: .75rem; color: #94a3b8; }


/* ══════════════════════════════════════════════════════════════════════════
 *  TEMPLATE 3 — Fields first, corner-badge offer cards, golden buy
 * ══════════════════════════════════════════════════════════════════════════ */
.lf-t3-header {
    background: #f8fafc; border-radius: 8px; padding: 10px 14px;
    font-size: .88rem; color: #475569; text-align: center;
    margin-bottom: 14px; border: 1px solid #e2e8f0; line-height: 1.5;
}
.lf-t3-offers { display: flex; gap: 8px; margin-bottom: 14px; }
.lf-t3-offer {
    flex: 1; position: relative; padding: 12px 10px 10px;
    border: 1.5px solid #e2e8f0; border-radius: 10px;
    cursor: pointer; transition: border-color .15s, box-shadow .15s;
    text-align: center; overflow: visible;
}
.lf-t3-offer:hover { border-color: var(--lf-primary); }
.lf-t3-offer.lf-active { border-color: var(--lf-primary); box-shadow: 0 0 0 3px rgba(239,68,68,.1); }
.lf-t3-badge {
    position: absolute; top: -10px; left: 8px;
    color: #fff; border-radius: 50px; padding: 2px 8px;
    font-size: .68rem; font-weight: 700; white-space: nowrap; z-index: 1;
}
.lf-t3-body { display: flex; flex-direction: column; gap: 4px; }
.lf-t3-title { font-weight: 700; font-size: .88rem; }
.lf-t3-prices { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 4px; }
.lf-t3-old { font-size: .74rem; color: #94a3b8; }
.lf-t3-sale { font-weight: 700; color: var(--lf-primary); font-size: .92rem; }


/* ══════════════════════════════════════════════════════════════════════════
 *  TEMPLATE 4 — Section labels, compact radio bundles, radio-style vars
 * ══════════════════════════════════════════════════════════════════════════ */
.lf-t4-section {
    font-size: .8rem; font-weight: 700; letter-spacing: .04em;
    color: #1e293b; margin: 14px 0 8px; padding-bottom: 6px;
    border-bottom: 2px solid #e2e8f0;
}
.lf-t4-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.lf-t4-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 1.5px solid #e2e8f0; border-radius: var(--lf-radius);
    cursor: pointer; transition: border-color .15s, background .15s;
}
.lf-t4-card:hover { border-color: var(--lf-primary); }
.lf-t4-card.lf-active { border-color: var(--lf-primary); background: rgba(239,68,68,.04); }
.lf-t4-radio {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid #cbd5e1; flex-shrink: 0; transition: border-color .15s, background .15s;
}
.lf-t4-card.lf-active .lf-t4-radio { border-color: var(--lf-primary); background: var(--lf-primary); box-shadow: inset 0 0 0 3px #fff; }
.lf-t4-body { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lf-t4-title { font-weight: 600; font-size: .9rem; }
.lf-t4-badge { color: #fff; border-radius: 50px; padding: 1px 7px; font-size: .7rem; font-weight: 700; }
.lf-t4-price { text-align: end; flex-shrink: 0; line-height: 1.3; }
.lf-t4-sale { font-weight: 700; color: var(--lf-primary); }
.lf-t4-old { font-size: .74rem; color: #94a3b8; }
/* T4 vars: radio-button-style text buttons, horizontal wrap */
.lf-t4-vars .lf-var-btn:not(.lf-var-swatch) {
    border: none; background: none; padding: 6px 10px;
    display: inline-flex; align-items: center; gap: 8px;
    height: auto; min-width: auto; border-radius: 0; font-size: .9rem;
}
.lf-t4-vars .lf-var-btn:not(.lf-var-swatch)::before {
    content: ''; display: inline-block; flex-shrink: 0;
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid #cbd5e1; transition: border-color .15s, background .15s;
}
.lf-t4-vars .lf-var-btn:not(.lf-var-swatch).lf-active::before {
    border-color: var(--lf-primary); background: var(--lf-primary); box-shadow: inset 0 0 0 3px #fff;
}
.lf-t4-vars .lf-var-btn:not(.lf-var-swatch):hover::before { border-color: var(--lf-primary); }
.lf-t4-vars .lf-var-values--text { flex-direction: row; flex-wrap: wrap; display: flex; gap: 2px 0; }


/* ══════════════════════════════════════════════════════════════════════════
 *  7 — FULL-AR
 * ══════════════════════════════════════════════════════════════════════════ */
.lf-tpl--full-ar .lf-btn-buy.lf-btn--block  { margin-top: 14px; border-radius: 6px; }
.lf-tpl--full-ar .lf-btn-cart.lf-btn--block { border-radius: 6px; border-color: #64748b; color: #64748b; }
.lf-tpl--full-ar .lf-btn-wa.lf-btn--block   { border-radius: 6px; }
.lf-tpl--full-ar .lf-var-swatch { width: 36px; height: 36px; }
.lf-tpl--full-ar .lf-trust { flex-wrap: wrap; gap: 12px; }
.lf-tpl--full-ar .lf-trust-item { flex: 0 0 calc(25% - 9px); min-width: 60px; }


/* ══════════════════════════════════════════════════════════════════════════
 *  8 — COMPACT
 * ══════════════════════════════════════════════════════════════════════════ */
.lf-compact-wrap {
    border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 18px; background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.lf-pill-bundles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.lf-pill {
    padding: 7px 14px; border: 1.5px solid #e2e8f0; border-radius: 50px;
    background: #f8fafc; color: var(--lf-secondary);
    font-size: .85rem; font-weight: 600; cursor: pointer;
    transition: border-color .15s, background .15s;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.lf-pill:hover { border-color: var(--lf-primary); background: rgba(239,68,68,.04); }
.lf-pill.lf-active { border-color: var(--lf-primary); background: var(--lf-primary); color: #fff; }
.lf-pill-price { font-size: .75rem; opacity: .85; }
.lf-compact-wrap .lf-actions { margin: 14px 0 6px; }
.lf-compact-wrap .lf-btn-buy { border-radius: 50px; flex: 1; }
.lf-compact-wrap .lf-btn-cart.lf-btn--block { border-radius: 50px; }
