/*
 * Etechflow_OptionsPlugin — theme-adaptive option styling.
 *
 * Every colour here is a CSS custom property that efopt-theme-adopt.js fills in
 * at runtime from the LIVE theme (Luma / Adobe Commerce / Hyvä / custom). The
 * values below are only fallbacks used for the split-second before the JS runs,
 * or if colour detection finds nothing — so the UI is never unstyled or broken.
 *
 * Two layers:
 *   .efopt-choice            → always applied when "Adopt theme colours" is on
 *                              (accent on the radio/checkbox, selected emphasis)
 *   .efopt-card              → added on top when "Themed option cards" is on
 *                              (the bordered card layout)
 */
:root {
    --efopt-accent: #1979c3;                      /* overwritten by JS from theme */
    --efopt-accent-soft: rgba(25, 121, 195, 0.10);
    --efopt-accent-border: rgba(25, 121, 195, 0.45);
    --efopt-text: inherit;
    --efopt-border: rgba(0, 0, 0, 0.16);
    --efopt-muted: rgba(0, 0, 0, 0.6);
    --efopt-surface: #fff;
    --efopt-radius: 8px;
}

/* Accent the native radio/checkbox controls to the theme colour (all browsers
   that support accent-color; harmless elsewhere). */
.efopt-choice input[type="radio"],
.efopt-choice input[type="checkbox"] {
    accent-color: var(--efopt-accent);
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    cursor: pointer;
}

/* Selected emphasis — applies in BOTH "colours only" and "cards" modes. */
.efopt-choice--selected > label,
.efopt-choice--selected label.label {
    color: var(--efopt-accent);
    font-weight: 600;
}

/* ── Card layout (only when .efopt-card is present) ─────────────────────── */
.efopt-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid var(--efopt-border);
    border-radius: var(--efopt-radius);
    padding: 0.7rem 0.9rem;
    margin: 0 0 0.5rem;
    background: var(--efopt-surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.efopt-card:hover {
    border-color: var(--efopt-accent-border);
}

.efopt-card.efopt-choice--selected {
    border-color: var(--efopt-accent);
    background: var(--efopt-accent-soft);
    box-shadow: inset 0 0 0 1px var(--efopt-accent);
}

/* Make the label fill the card and stay clickable; keep the price subtle. */
.efopt-card > label,
.efopt-card label.label {
    flex: 1 1 auto;
    margin: 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.efopt-card .price-notice,
.efopt-card .price-wrapper {
    color: var(--efopt-muted);
    white-space: nowrap;
}

.efopt-card.efopt-choice--selected .price-notice,
.efopt-card.efopt-choice--selected .price-wrapper {
    color: var(--efopt-accent);
}

/* Tighten the group spacing a touch so cards read as a set. */
.efopt-themed .efopt-card + .efopt-card {
    margin-top: 0.15rem;
}

@media (prefers-reduced-motion: reduce) {
    .efopt-card {
        transition: none;
    }
}

/* ── Multi-image / multi-file uploader ─────────────────────────────────── */
.efmf { margin-top: 6px; }
.efmf-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.efmf-item {
    position: relative; width: 74px; height: 74px;
    border: 1px solid var(--efopt-border, rgba(0,0,0,.16)); border-radius: 6px;
    overflow: hidden; background: #f6f6f6; display: flex; align-items: center; justify-content: center;
}
.efmf-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.efmf-file { font-size: 10px; padding: 4px; text-align: center; word-break: break-word; line-height: 1.2; }
.efmf-x {
    position: absolute; top: 3px; right: 3px; width: 18px; height: 18px;
    line-height: 16px; padding: 0; border: none; border-radius: 50%;
    background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; text-align: center;
}
.efmf-x:hover { background: #c0392b; }
.efmf-add {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
    border: 1px dashed var(--efopt-accent, #1979c3); border-radius: 6px;
    color: var(--efopt-accent, #1979c3); cursor: pointer; font-size: 13px;
    background: #fff; transition: background-color .15s;
}
.efmf-add:hover { background: var(--efopt-accent-soft, rgba(25,121,195,.08)); }
.efmf-status { font-size: 12px; color: var(--efopt-muted, #666); margin-top: 4px; }
