/* ===========================================================
   QR Builder — shared styles for static / dynamic / free pages
   =========================================================== */

.qrb {
    --qrb-border: #e5e7eb;
    --qrb-border-strong: #d1d5db;
    --qrb-accent: #009ef7;
    --qrb-accent-soft: #eaf6ff;
    --qrb-bg-soft: #f9fafb;
    --qrb-text-mute: #6b7280;
    --qrb-radius: 10px;
}

/* Section title */
.qrb-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #1f2937;
    margin: 18px 0 10px;
}
.qrb-section-title i { color: var(--qrb-accent); }

/* Tile grid (presets / shapes / frames / corners) */
.qrb-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
}
.qrb-tile {
    background: #fff;
    border: 2px solid var(--qrb-border);
    border-radius: var(--qrb-radius);
    padding: 8px 4px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    aspect-ratio: 1 / 1.05;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.qrb-tile:hover { border-color: var(--qrb-accent); transform: translateY(-1px); }
.qrb-tile.is-active {
    border-color: var(--qrb-accent);
    background: var(--qrb-accent-soft);
    box-shadow: 0 0 0 3px rgba(0, 158, 247, 0.15);
}
.qrb-tile .qrb-tile-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.qrb-tile .qrb-tile-icon svg { width: 100%; height: 100%; }
.qrb-tile .qrb-tile-label {
    font-size: 10px;
    font-weight: 600;
    color: #4b5563;
    line-height: 1.1;
}
.qrb-tile.is-active .qrb-tile-label { color: var(--qrb-accent); }

/* Color row */
.qrb-color-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.qrb-color-field label {
    font-size: 11px;
    font-weight: 600;
    color: #4b5563;
    display: block;
    margin-bottom: 4px;
}
.qrb-color-field input[type="color"] {
    width: 100%;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--qrb-border);
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
}

/* Toggle switches row */
.qrb-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 6px 0 10px;
}
.qrb-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    user-select: none;
}
.qrb-toggle input[type="checkbox"] {
    width: 36px;
    height: 20px;
    appearance: none;
    background: #d1d5db;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.qrb-toggle input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.qrb-toggle input[type="checkbox"]:checked {
    background: var(--qrb-accent);
}
.qrb-toggle input[type="checkbox"]:checked::before {
    transform: translateX(16px);
}

/* Frame text input */
.qrb-frame-text {
    margin-top: 8px;
}
.qrb-frame-text label {
    font-size: 11px;
    font-weight: 600;
    color: #4b5563;
    display: block;
    margin-bottom: 4px;
}
.qrb-frame-text input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--qrb-border);
    border-radius: 6px;
    font-size: 13px;
}

/* Logo grid */
.qrb-logos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 6px;
    margin-top: 8px;
}
.qrb-logo-tile {
    border: 2px solid var(--qrb-border);
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: border-color 0.15s;
}
.qrb-logo-tile:hover { border-color: var(--qrb-accent); }
.qrb-logo-tile.is-active {
    border-color: var(--qrb-accent);
    background: var(--qrb-accent-soft);
}
.qrb-logo-tile img { width: 100%; height: 100%; object-fit: contain; }

/* Preview area */
.qrb-preview-wrap {
    background: var(--qrb-bg-soft);
    border: 1px dashed var(--qrb-border-strong);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}
.qrb-preview-wrap canvas,
.qrb-preview-wrap svg {
    max-width: 100%;
    max-height: 100%;
    display: block;
}
.qrb-preview-empty {
    text-align: center;
    color: var(--qrb-text-mute);
    font-size: 13px;
}

/* Slider for frame text size */
.qrb-slider-row {
    margin-top: 8px;
}
.qrb-slider-row label {
    font-size: 11px;
    font-weight: 600;
    color: #4b5563;
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.qrb-slider-row input[type="range"] {
    width: 100%;
}

/* Make existing options panel a bit roomier */
.qrb-panel { padding: 6px 0 4px; }

/* Tile preview SVG strokes / fills follow currentColor for theming */
.qrb-tile svg { color: #374151; }
.qrb-tile.is-active svg { color: var(--qrb-accent); }

/* Native <select> elements render with browser defaults that don't match
   <input>s side by side (smaller height, native arrow, different padding).
   Normalize selects within the QR builder area to look identical to inputs.
   Specificity is intentionally aggressive (body prefix + !important) to beat
   theme overrides on WordPress (dt-the7 has high-specificity form rules). */
body .qr-main-container select,
body .qr-main-container select.form-control,
body .qr-main-container select.form-special {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    height: auto !important;
    line-height: 1.5 !important;
    padding: 10px 32px 10px 5px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 12px 8px !important;
}

/* Pill-shape "clear" action (e.g. remove selected logo) — neutral by default,
   red-tinted on hover to signal a destructive/reset action without screaming. */
.qrb-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid var(--qrb-border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    user-select: none;
}
.qrb-clear-btn:hover {
    border-color: #fca5a5;
    color: #dc2626;
    background: #fef2f2;
}
.qrb-clear-btn:active {
    transform: translateY(1px);
}
.qrb-clear-btn i {
    font-size: 10px;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
    color: #9ca3af;
    transition: all 0.15s ease;
}
.qrb-clear-btn:hover i {
    background: #fee2e2;
    color: #dc2626;
}

/* ===========================================================
   Sticky preview panel (desktop only)
   - Flex parent must use align-items: flex-start so the sticky
     child is not stretched to full row height (silent sticky kill).
   - Top offset uses Metronic's CSS var so header height is honored
     even on toolbar/no-toolbar layouts; falls back to 90px.
   - !important is used because Metronic's compiled bundle defines
     .main-cont-2 with higher specificity than our cascade.
   =========================================================== */
@media (min-width: 768px) {
    .qr-main-container {
        align-items: flex-start !important;
    }
    .main-cont-2 {
        position: sticky !important;
        top: calc(var(--bs-app-header-height-actual, 70px) + 20px) !important;
        align-self: flex-start !important;
    }
}
