/* ─────────────────────────────────────────────
   QR Generator — Premium Redesign
   Single Source of Truth for QR Styles
   ───────────────────────────────────────────── */

/* ── Layout & Card System ── */

.qr-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(226, 232, 240, 0.8);
    height: 100%;
}

.qr-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    letter-spacing: -0.01em;
}

.qr-section-title i {
    color: var(--tool-primary);
    margin-right: 0.75rem;
    font-size: 1.35rem;
    padding: 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
}

/* ── Custom Tabs (Segmented Control) ── */

.qr-tabs {
    background: #f1f5f9;
    padding: 0.35rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    margin-bottom: 2rem;
}

.qr-tabs .nav-item {
    flex: 1;
}

.qr-tabs .nav-link {
    width: 100%;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-align: center;
}

.qr-tabs .nav-link:hover {
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
}

.qr-tabs .nav-link.active {
    background: #ffffff;
    color: var(--tool-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

/* ── Input Type Grid ── */

.qr-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.qr-type-btn {
    background: #ffffff;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    height: 100%;
    width: 100%;
}

.qr-type-btn i {
    font-size: 1.5rem;
    color: #94a3b8;
    transition: all 0.2s;
}

.qr-type-btn span {
    font-size: 0.75rem;
    font-weight: 600;
}

.qr-type-btn:hover {
    border-color: var(--tool-primary);
    background: #fafafa;
    transform: translateY(-2px);
}

.qr-type-btn:hover i {
    color: var(--tool-primary);
}

.qr-type-btn.active {
    border-color: var(--tool-primary);
    background: rgba(99, 102, 241, 0.05);
    color: var(--tool-primary);
}

.qr-type-btn.active i {
    color: var(--tool-primary);
}


/* ── Inputs ── */

.tool-input {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    width: 100%;
    color: #334155;
}

.tool-input:focus {
    border-color: var(--tool-primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.qr-field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ── Pattern & Design Selectors ── */

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    /* Increased spacing */
}

.pattern-btn {
    width: 100%;
    aspect-ratio: 1;
    background: #ffffff;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    padding: 12px;
}

.pattern-btn:hover {
    border-color: #cbd5e1;
    transform: scale(1.05);
}

.pattern-btn.active {
    border-color: var(--tool-primary);
    background: rgba(99, 102, 241, 0.05);
    color: var(--tool-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.pattern-btn svg {
    width: 100%;
    height: 100%;
}

/* ── Right Panel (Preview) ── */

.qr-preview-sticky {
    position: sticky;
    top: 2rem;
}

.qr-preview-container {
    background: #ffffff;
    border-radius: 20px;
    padding: 2.5rem;
    /* Increased padding to prevent clipping of shadows/corners */
    border: 2px solid #f1f5f9;

    /* Ensure flex centering */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Responsive Square */
    width: 100%;
    max-width: 100%;
    /* Force constraint */
    aspect-ratio: 1;
    margin-bottom: 2rem;
    position: relative;

    /* Checkerboard background */
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;

    overflow: hidden;
    /* Prevent overflow */
}

#qr-canvas {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#qr-canvas canvas,
#qr-canvas svg {
    max-width: 100% !important;
    max-height: 100% !important;
    height: auto !important;
    width: auto !important;
    /* Soft shadow for pop */
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
}

/* ── Download Buttons ── */

.qr-action-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

.btn-primary-qr {
    background: var(--tool-primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.btn-primary-qr:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn-secondary-qr {
    background: #ffffff;
    color: #475569;
    border: 2px solid #e2e8f0;
}

.btn-secondary-qr:hover {
    border-color: var(--tool-primary);
    color: var(--tool-primary);
    background: #f8fafc;
}

/* ── Mobile ── */
@media (max-width: 991.98px) {
    .qr-preview-sticky {
        position: static;
        margin-top: 2rem;
    }

    /* Stack color inputs on mobile */
    .row.g-4>.col-md-6 {
        width: 100%;
        margin-bottom: 1rem;
    }
}