/* ===== QR Code Generator Pro – Scoped Styles ===== */
.qrg-tool {
    /* Reusable tokens */
    --qrg-bg: #ffffff;
    --qrg-surface: #f8fafc;
    --qrg-border: #e2e8f0;
    --qrg-text: #1e293b;
    --qrg-text-muted: #64748b;
    --qrg-primary: #2563eb;
    --qrg-primary-hover: #1d4ed8;
    --qrg-radius: 12px;
    --qrg-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --qrg-transition: 0.2s ease;

    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--qrg-text);
    background: var(--qrg-bg);
}

/* ------ Utility: Screen Reader Only ------ */
.qrg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ------ Header ------ */
.qrg-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.qrg-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}
.qrg-description {
    font-size: 1.1rem;
    color: var(--qrg-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* ------ Tabs ------ */
.qrg-tabs {
    border: 0;
    margin: 0 0 2rem;
    padding: 0;
}
.qrg-tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    background: var(--qrg-surface);
    border-radius: var(--qrg-radius);
    padding: 0.25rem;
}
.qrg-tab {
    flex: 1 1 auto;
}
.qrg-tab-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.qrg-tab-label {
    display: block;
    text-align: center;
    padding: 0.6rem 0.75rem;
    border-radius: calc(var(--qrg-radius) - 2px);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--qrg-transition), color var(--qrg-transition);
}
.qrg-tab-radio:checked + .qrg-tab-label {
    background: var(--qrg-primary);
    color: #fff;
}
.qrg-tab-radio:focus-visible + .qrg-tab-label {
    outline: 2px solid var(--qrg-primary);
    outline-offset: 2px;
}

/* ------ Form Container ------ */
.qrg-form-container {
    background: var(--qrg-surface);
    border: 1px solid var(--qrg-border);
    border-radius: var(--qrg-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.qrg-form-group {
    margin-bottom: 1.2rem;
}
.qrg-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.qrg-input,
.qrg-textarea,
.qrg-select {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--qrg-border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    transition: border var(--qrg-transition);
}
.qrg-input:focus,
.qrg-textarea:focus,
.qrg-select:focus {
    outline: none;
    border-color: var(--qrg-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.qrg-char-count {
    font-size: 0.8rem;
    color: var(--qrg-text-muted);
}

/* ------ Preview & Summary ------ */
.qrg-preview-panel {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
    margin-bottom: 2rem;
}
.qrg-preview {
    background: var(--qrg-surface);
    border: 1px solid var(--qrg-border);
    border-radius: var(--qrg-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 1.5rem;
}
.qrg-canvas-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    overflow: auto;
}
.qrg-canvas-wrapper canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
.qrg-svg-wrapper svg {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
.qrg-empty-state {
    color: var(--qrg-text-muted);
    font-style: italic;
}
.qrg-summary {
    background: var(--qrg-surface);
    border: 1px solid var(--qrg-border);
    border-radius: var(--qrg-radius);
    padding: 1.5rem;
}
.qrg-summary-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    font-size: 0.9rem;
}
.qrg-summary-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px dashed var(--qrg-border);
}
.qrg-summary-list li:last-child {
    border-bottom: 0;
}
.qrg-validation-message {
    color: #b91c1c;
    font-weight: 500;
    margin: 0;
    font-size: 0.9rem;
}

/* ------ Options Grid ------ */
.qrg-options {
    margin-bottom: 2rem;
}
.qrg-section-title {
    font-size: 1.3rem;
    margin: 0 0 1rem;
}
.qrg-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.qrg-option-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.qrg-slider {
    width: 100%;
}
.qrg-color {
    width: 100%;
    height: 40px;
    padding: 0;
    border: 1px solid var(--qrg-border);
    border-radius: 6px;
    cursor: pointer;
}
.qrg-select {
    /* already styled */
}

/* ------ Action Buttons ------ */
.qrg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.qrg-button {
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--qrg-transition), box-shadow var(--qrg-transition);
}
.qrg-button-primary {
    background: var(--qrg-primary);
    color: #fff;
}
.qrg-button-primary:hover {
    background: var(--qrg-primary-hover);
}
.qrg-button-secondary {
    background: #fff;
    border-color: var(--qrg-border);
    color: var(--qrg-text);
}
.qrg-button-secondary:hover {
    background: var(--qrg-surface);
}
.qrg-button:focus-visible {
    outline: 2px solid var(--qrg-primary);
    outline-offset: 2px;
}
.qrg-feedback {
    font-size: 0.9rem;
    color: var(--qrg-text-muted);
    min-height: 1.5em;
}

/* ------ Use Cases ------ */
.qrg-usecases {
    margin-top: 3rem;
}
.qrg-usecase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.qrg-card {
    background: var(--qrg-surface);
    border: 1px solid var(--qrg-border);
    border-radius: var(--qrg-radius);
    padding: 1.2rem;
}
.qrg-card h3 {
    font-size: 1rem;
    margin: 0 0 0.4rem;
}
.qrg-card p {
    font-size: 0.85rem;
    color: var(--qrg-text-muted);
    margin: 0;
}

/* ------ FAQ ------ */
.qrg-faq {
    margin-top: 3rem;
    border-top: 1px solid var(--qrg-border);
    padding-top: 2rem;
}
.qrg-faq dl {
    margin: 1rem 0 0;
}
.qrg-faq dt {
    font-weight: 700;
    margin-top: 1rem;
}
.qrg-faq dd {
    margin-left: 0;
    color: var(--qrg-text-muted);
    margin-top: 0.3rem;
}

/* ------ Responsive ------ */
@media (max-width: 700px) {
    .qrg-preview-panel {
        grid-template-columns: 1fr;
    }
    .qrg-tab-label {
        font-size: 0.8rem;
        padding: 0.5rem 0.5rem;
    }
}