/* SVG QR Code Generator — isolated UI. Every selector is prefixed with .svgqr-. */
/* CssScope: svgqr */

/* ── Shell ──────────────────────────────────────────────────────────────────── */

.svgqr-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Shared card surface ────────────────────────────────────────────────────── */

.svgqr-hero,
.svgqr-controls,
.svgqr-stats,
.svgqr-preview-card,
.svgqr-output-card,
.svgqr-error,
.svgqr-warning {
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.12), transparent 31rem),
        linear-gradient(180deg, rgba(24, 27, 36, 0.98), rgba(17, 19, 24, 0.98));
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.22);
}

/* ── Error / warning ────────────────────────────────────────────────────────── */

.svgqr-error {
    border-color: rgba(248, 113, 113, 0.36);
    background:
        radial-gradient(circle at top left, rgba(248, 113, 113, 0.12), transparent 26rem),
        linear-gradient(180deg, rgba(35, 18, 22, 0.98), rgba(20, 12, 14, 0.98));
    padding: 0.85rem 1rem;
}

.svgqr-error strong { color: #fecaca; }
.svgqr-error p      { color: #fca5a5; margin: 0.22rem 0 0; font-size: 0.85rem; }
.svgqr-error[hidden] { display: none !important; }

.svgqr-warning {
    border-color: rgba(251, 191, 36, 0.38);
    background:
        radial-gradient(circle at top left, rgba(251, 191, 36, 0.1), transparent 26rem),
        linear-gradient(180deg, rgba(35, 28, 12, 0.98), rgba(22, 18, 10, 0.98));
    padding: 0.85rem 1rem;
}

.svgqr-warning strong { color: #fde68a; }
.svgqr-warning p      { color: #fcd34d; margin: 0.22rem 0 0; font-size: 0.85rem; }
.svgqr-warning[hidden] { display: none !important; }

/* ── Hero ───────────────────────────────────────────────────────────────────── */

.svgqr-hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    overflow: hidden;
}

.svgqr-hero__copy { max-width: 820px; }

.svgqr-eyebrow,
.svgqr-card-kicker {
    color: var(--accent-light);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.svgqr-hero h2 {
    margin-top: 0.22rem;
    font-size: clamp(1.45rem, 2.7vw, 2.3rem);
    line-height: 1.04;
    letter-spacing: -0.055em;
}

.svgqr-hero p {
    max-width: 760px;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.svgqr-hero__panel {
    display: flex;
    min-width: 270px;
    align-content: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.svgqr-hero__panel span,
.svgqr-signal-strip span {
    border: 1px solid rgba(129, 140, 248, 0.24);
    border-radius: 999px;
    background: var(--accent-dim);
    color: var(--accent-light);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    padding: 0.45rem 0.65rem;
    white-space: nowrap;
}

/* ── Card headers ───────────────────────────────────────────────────────────── */

.svgqr-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0.95rem 0.7rem;
}

.svgqr-card-header h3 {
    margin-top: 0.12rem;
    font-size: 1rem;
    letter-spacing: -0.03em;
}

.svgqr-card-header p {
    max-width: 520px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.svgqr-card-header--preview { align-items: center; }

/* ── Controls ───────────────────────────────────────────────────────────────── */

.svgqr-controls { overflow: hidden; }

.svgqr-controls .svgqr-card-header {
    border-bottom: 1px solid var(--border);
}

/* ── Content block ──────────────────────────────────────────────────────────── */

.svgqr-content-block {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.95rem 0.95rem 0;
}

.svgqr-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.svgqr-preset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}

.svgqr-preset:hover {
    border-color: rgba(129, 140, 248, 0.5);
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.16);
}

.svgqr-content-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.svgqr-content-meta span {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* ── Fields grid ────────────────────────────────────────────────────────────── */

.svgqr-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    padding: 0.95rem;
}

.svgqr-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.svgqr-field--wide { grid-column: 1 / -1; }

.svgqr-field-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.svgqr-field-label span {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    opacity: 0.75;
    text-transform: none;
}

/* ── Inputs ─────────────────────────────────────────────────────────────────── */

.svgqr-number {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(5, 6, 9, 0.54);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    outline: none;
    padding: 0.55rem 0.75rem;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
}

.svgqr-number::-webkit-outer-spin-button,
.svgqr-number::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.svgqr-number:focus,
.svgqr-color-text:focus,
.svgqr-textarea:focus {
    border-color: rgba(129, 140, 248, 0.48);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.13);
}

/* ── Custom select (project-standard dropdown) ──────────────────────────────── */

.svgqr-custom-select { position: relative; }

.svgqr-native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    opacity: 0;
    pointer-events: none;
}

.svgqr-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(5, 6, 9, 0.54);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 780;
    padding: 0.55rem 0.7rem;
    text-align: left;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
}

.svgqr-select-trigger:hover,
.svgqr-select-trigger[aria-expanded="true"] {
    border-color: rgba(129, 140, 248, 0.48);
    background: rgba(99, 102, 241, 0.12);
}

.svgqr-select-trigger:focus-visible {
    outline: none;
    border-color: rgba(129, 140, 248, 0.48);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.13);
}

.svgqr-select-trigger svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex: 0 0 auto;
}

.svgqr-select-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.35rem);
    left: 0;
    display: grid;
    width: min(280px, 82vw);
    max-height: 280px;
    overflow: auto;
    border: 1px solid rgba(129, 140, 248, 0.32);
    border-radius: 14px;
    background: #11131b;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.46);
    padding: 0.35rem;
}

.svgqr-select-menu[hidden] { display: none; }

.svgqr-select-menu button {
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    padding: 0.6rem 0.65rem;
    text-align: left;
}

.svgqr-select-menu button:hover,
.svgqr-select-menu button:focus,
.svgqr-select-menu button[aria-selected="true"] {
    background: rgba(99, 102, 241, 0.16);
    color: var(--text-primary);
    outline: none;
}

/* ── Color inputs ───────────────────────────────────────────────────────────── */

.svgqr-color-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.svgqr-color-swatch {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(5, 6, 9, 0.54);
    cursor: pointer;
}

.svgqr-color-swatch::-webkit-color-swatch-wrapper { padding: 4px; }
.svgqr-color-swatch::-webkit-color-swatch { border: none; border-radius: 6px; }
.svgqr-color-swatch::-moz-color-swatch { border: none; border-radius: 6px; }

.svgqr-color-text {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(5, 6, 9, 0.54);
    color: var(--text-primary);
    font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
    font-size: 0.82rem;
    font-weight: 600;
    outline: none;
    padding: 0.55rem 0.7rem;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* ── Toggle ─────────────────────────────────────────────────────────────────── */

.svgqr-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.svgqr-toggle:has(input:checked) {
    border-color: rgba(129, 140, 248, 0.5);
    background: rgba(99, 102, 241, 0.07);
}

.svgqr-toggle:hover { border-color: var(--border-hover); }

.svgqr-toggle input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.svgqr-toggle span {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
    pointer-events: none;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.svgqr-action-buttons {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    padding: 0 0.95rem 0.95rem;
}

.svgqr-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 850;
    line-height: 1;
    padding: 0.65rem 0.9rem;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.svgqr-button:hover:not(:disabled) { transform: translateY(-1px); }
.svgqr-button:disabled { cursor: not-allowed; opacity: 0.48; }

.svgqr-button--mini { min-height: 30px; padding: 0.3rem 0.6rem; font-size: 0.74rem; font-weight: 700; }

.svgqr-button--primary {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: #fff;
    box-shadow: 0 14px 32px rgba(99, 102, 241, 0.28);
}

.svgqr-button--primary:hover:not(:disabled) {
    box-shadow: 0 18px 36px rgba(99, 102, 241, 0.36);
}

.svgqr-button--soft {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-light);
    border-color: rgba(99, 102, 241, 0.25);
}

.svgqr-button--soft:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.svgqr-button--ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.svgqr-button--ghost:hover:not(:disabled) {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ── Stats ──────────────────────────────────────────────────────────────────── */

.svgqr-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.svgqr-stat {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.9rem 1rem;
    border-right: 1px solid var(--border);
    min-width: 0;
}

.svgqr-stat:last-child { border-right: none; }

.svgqr-stat span {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    line-height: 1.2;
}

.svgqr-stat strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.svgqr-stat--accent { background: rgba(99, 102, 241, 0.06); }
.svgqr-stat--accent strong { color: var(--accent-light); }

/* ── Preview ────────────────────────────────────────────────────────────────── */

.svgqr-preview-card { padding: 0; overflow: hidden; }

.svgqr-preview-tools {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.svgqr-preview-tools button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}

.svgqr-preview-tools button:hover {
    border-color: var(--border-hover);
    color: var(--text-secondary);
}

.svgqr-preview-tools button[aria-pressed="true"] {
    border-color: rgba(129, 140, 248, 0.5);
    color: var(--accent-light);
    background: var(--accent-dim);
}

.svgqr-preview-surface {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 1.25rem;
    overflow: hidden;
    border-top: 1px solid var(--border);
    position: relative;
}

.svgqr-preview-surface p {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

.svgqr-preview-surface svg {
    max-width: 100%;
    max-height: 420px;
    display: block;
}

.svgqr-preview-surface.is-checker {
    background-image:
        linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,0.06) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.06) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.06) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

/* ── Signal strip ───────────────────────────────────────────────────────────── */

.svgqr-signal-strip {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding: 0.75rem;
}

/* ── Output ─────────────────────────────────────────────────────────────────── */

.svgqr-output-card { overflow: hidden; }

.svgqr-output-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0 0.95rem 0.75rem;
}

.svgqr-textarea {
    display: block;
    width: 100%;
    resize: vertical;
    padding: 0.75rem;
    background: rgba(5, 6, 9, 0.54);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    outline: none;
    tab-size: 2;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.svgqr-textarea::placeholder { color: var(--text-muted); }

.svgqr-textarea--input { min-height: 92px; }

.svgqr-textarea--output {
    min-height: 240px;
    color: var(--accent-light);
    background: rgba(0, 0, 0, 0.28);
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0 0 17px 17px;
    cursor: default;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .svgqr-hero { flex-direction: column; }

    .svgqr-hero__panel {
        min-width: 0;
        justify-content: flex-start;
    }

    .svgqr-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .svgqr-stat:nth-child(3) { border-right: none; }
    .svgqr-stat:nth-child(1),
    .svgqr-stat:nth-child(2),
    .svgqr-stat:nth-child(3) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 640px) {
    .svgqr-card-header,
    .svgqr-card-header--preview {
        align-items: stretch;
        flex-direction: column;
        display: flex;
    }

    .svgqr-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .svgqr-stat:nth-child(3) { border-right: 1px solid var(--border); }
    .svgqr-stat:nth-child(2) { border-right: none; }
    .svgqr-stat:nth-child(4) { border-right: none; }
    .svgqr-stat:nth-child(1),
    .svgqr-stat:nth-child(2),
    .svgqr-stat:nth-child(3),
    .svgqr-stat:nth-child(4) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 460px) {
    .svgqr-action-buttons { flex-direction: column; align-items: stretch; }
    .svgqr-action-buttons .svgqr-button { width: 100%; }

    .svgqr-output-actions { flex-direction: column; }
    .svgqr-output-actions .svgqr-button { width: 100%; }

    .svgqr-select-menu { width: 100%; }

    .svgqr-hero,
    .svgqr-controls,
    .svgqr-stats,
    .svgqr-preview-card,
    .svgqr-output-card { border-radius: 14px; }

    .svgqr-stats { grid-template-columns: 1fr; }

    .svgqr-stat {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .svgqr-stat:last-child { border-bottom: none; }

    .svgqr-preview-surface { min-height: 240px; }
}
