/**
 * QR Code Generator.
 *
 * Scoped under .em-qr. The theme ships Tailwind's Preflight, which resets
 * svg and canvas to display:block — fine here, since both are block anyway.
 */

.em-qr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    gap: 28px;
    align-items: start;
    margin: 0 0 2em;
}

.em-qr__types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.1em; }

.em-qr__type {
    padding: .5em 1em;
    border: 1px solid var(--em-line, #e5e7eb);
    border-radius: 999px;
    background: var(--em-surface, #fff);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
    color: var(--em-soft, #6b7280);
}

.em-qr__type.is-active {
    background: var(--em-brand, #2563eb);
    border-color: var(--em-brand, #2563eb);
    color: #fff;
    font-weight: 600;
}

.em-qr__panel { display: flex; flex-direction: column; gap: .3em; }

.em-qr__panel label,
.em-qr__styling label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--em-soft, #6b7280);
}

.em-qr__panel label:not(:first-child) { margin-top: .8em; }

.em-qr__panel input,
.em-qr__panel select,
.em-qr__styling input,
.em-qr__styling select {
    width: 100%;
    padding: .6em .75em;
    border: 1px solid var(--em-line, #e5e7eb);
    border-radius: 7px;
    font: inherit;
    font-size: .95rem;
    box-sizing: border-box;
}

.em-qr__panel input[type="color"],
.em-qr__styling input[type="color"] { padding: 2px; height: 40px; cursor: pointer; }

.em-qr__note {
    margin: .7em 0 0;
    font-size: .82rem;
    line-height: 1.55;
    color: var(--em-soft, #6b7280);
}

.em-qr__styling { margin-top: 1.2em; }

.em-qr__styling > summary {
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    color: var(--em-brand, #2563eb);
    padding: .4em 0;
}

.em-qr__styling-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: .9em;
    margin-top: .6em;
}

.em-qr__styling-grid > span { display: flex; flex-direction: column; gap: .3em; }
.em-qr__logo { grid-column: 1 / -1; }

.em-qr__logo-clear {
    align-self: flex-start;
    margin-top: .4em;
    padding: .35em .8em;
    border: 1px solid var(--em-line, #e5e7eb);
    border-radius: 6px;
    background: var(--em-surface, #fff);
    color: inherit;
    font: inherit;
    font-size: .82rem;
    cursor: pointer;
}

/* ── Output ─────────────────────────────────────────────────────────────── */
.em-qr__output { position: sticky; top: 20px; }

.em-qr__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: 18px;
    border: 1px solid var(--em-line, #e5e7eb);
    border-radius: 12px;
    /* The code itself needs a light field whatever the page does. */
    background: #fff;
}

.em-qr__preview canvas,
.em-qr__preview svg { max-width: 100%; height: auto; }

/* Nothing typed yet — say so rather than leaving a blank box. */
.em-qr__preview[data-empty]::after {
    content: attr(data-empty-text);
    font-size: .88rem;
    color: var(--em-soft, #6b7280);
}

.em-qr__actions { display: flex; gap: 8px; margin-top: 12px; }

.em-qr__download {
    flex: 1;
    padding: .7em 1em;
    border: 1px solid var(--em-brand, #2563eb);
    border-radius: 8px;
    background: var(--em-brand, #2563eb);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.em-qr__download:last-child { background: transparent; color: var(--em-brand, #2563eb); }
.em-qr__download:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 782px) {
    .em-qr { grid-template-columns: minmax(0, 1fr); }
    .em-qr__output { position: static; }
}

/* ── Scannability warning ───────────────────────────────────────────────── */
.em-qr__warning {
    margin: 10px 0 0;
    padding: .7em .9em;
    background: rgba(217, 119, 6, .12);
    border-left: 3px solid #d97706;
    border-radius: 6px;
    font-size: .84rem;
    line-height: 1.55;
    color: inherit;
}
