/* premium-qr-builder/assets/admin.css */

/* --- LANDING AUTH (SIN LOGUEAR) --- */
.pqb-auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}

.pqb-auth-card {
    display: flex;
    flex-direction: row;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
    border: 1px solid #e2e8f0;
}

.pqb-auth-left {
    color: #fff;
    padding: 50px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pqb-auth-left h2 {
    color: #fff;
    font-size: 32px;
    margin-top: 0;
    margin-bottom: 10px;
    line-height: 1.2;
}

.pqb-auth-features {
    list-style: none;
    padding: 0;
    margin-top: 30px;
}

.pqb-auth-features li {
    margin-bottom: 15px;
    font-size: 15px;
    line-height: 1.5;
}

.pqb-auth-right {
    padding: 50px;
    flex: 1;
    background: #fff;
}

.pqb-auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 10px;
}

.pqb-auth-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    transition: 0.3s;
}

.pqb-auth-tab-btn.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pqb-payment-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.pqb-pm-radio input {
    display: none;
}

.pm-box {
    border: 2px solid #e2e8f0;
    padding: 15px 10px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    color: #64748b;
    transition: 0.2s;
}

.pqb-pm-radio input:checked+.pm-box {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #2563eb;
}

/* --- PANEL LOGUEADO --- */
.pqb-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    margin: 20px 20px 0 0;
    color: #334155;
    background-color: #f3f4f6;
    padding: 20px;
    border-radius: 12px;
}

.pqb-logout-link {
    text-decoration: none;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

.pqb-logout-link:hover {
    color: #dc2626;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
}

.pqb-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.pqb-tab-btn {
    background: transparent;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pqb-tab-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.pqb-tab-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.pqb-tab-btn.active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pqb-tab-content {
    display: none;
}

.pqb-tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pqb-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 24px;
}

.pqb-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    border: 1px solid #f1f5f9;
}

.pqb-card h3 {
    margin-top: 0;
    color: #1e293b;
    font-weight: 700;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 16px;
    margin-bottom: 24px;
    font-size: 18px;
}

.pqb-input,
.pqb-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px !important;
    margin-bottom: 20px;
    font-size: 14px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.01);
    background: #ffffff;
    color: #334155;
    box-sizing: border-box;
    transition: 0.2s;
}

.pqb-input:focus,
.pqb-select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.pqb-input[readonly] {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.pqb-flex-row {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.pqb-flex-row>div {
    flex: 1;
    min-width: 120px;
}

.pqb-controls label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
}

.pqb-color-picker {
    width: 100%;
    height: 44px;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    border-radius: 12px !important;
    padding: 3px;
    background: #ffffff;
}

/* SELECTORES GRÁFICOS INTUITIVOS */
.pqb-shape-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    justify-content: flex-start;
}

.pqb-shape-option {
    cursor: pointer;
}

.pqb-shape-option input[type="radio"] {
    display: none;
}

.pqb-shape-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    background: #ffffff;
    color: #64748b;
    font-weight: 600;
    font-size: 11px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    box-sizing: border-box;
}

.pqb-shape-card svg {
    width: 42px;
    height: 42px;
    fill: #1e293b;
    color: #1e293b;
    transition: all 0.2s ease;
}

.pqb-shape-option input[type="radio"]:checked+.pqb-shape-card {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
}

.pqb-shape-option input[type="radio"]:checked+.pqb-shape-card svg {
    fill: #2563eb;
    color: #2563eb;
}

/* SWITCH TOGGLE */
.pqb-switch-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    font-weight: 600;
    gap: 8px;
    margin-top: 5px;
}

.pqb-switch-input {
    display: none !important;
}

.pqb-switch {
    position: relative;
    display: block;
    min-width: 40px;
    width: 40px;
    height: 22px;
    background-color: #cbd5e1;
    border-radius: 22px;
    transition: 0.3s;
    flex-shrink: 0;
}

.pqb-switch::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.pqb-switch-input:checked+.pqb-switch {
    background-color: #10b981;
}

.pqb-switch-input:checked+.pqb-switch::after {
    transform: translateX(18px);
}

/* QR ANIMATION */
.qr-anim-container svg {
    transition: opacity 0.3s;
}

.qr-anim-paint svg {
    animation: brushReveal 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes brushReveal {
    0% {
        clip-path: polygon(0 0, 0 0, 0 100%, 0% 100%);
        opacity: 0.5;
        filter: blur(2px);
        transform: scale(0.98);
    }

    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
        opacity: 1;
        filter: blur(0);
        transform: scale(1);
    }
}

/* STATUS ALERTS */
.legibility-box {
    margin-bottom: 20px;
    font-size: 13px;
    padding: 10px;
    background: transparent;
    border-left: 5px solid;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 6px;
    justify-content: center;
}

.legibility-box.success {
    color: #1e293b;
    border-color: #10b981;
    background: #ecfdf5;
}

.legibility-box.success strong {
    color: #065f46;
}

.legibility-box.warning {
    color: #991b1b;
    background: #fee2e2;
    border-color: #ef4444;
}

/* BOTONES GLOBALES */
.pqb-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: 0.2s ease;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    display: inline-block;
}

.pqb-btn:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.pqb-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.pqb-btn-secondary {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.pqb-btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.pqb-btn-secondary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ACCIONES RAPIDAS (ICONOS) */
.pqb-actions-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.pqb-action-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: #64748b;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
    padding: 0;
}

.pqb-action-btn:hover {
    border-color: #94a3b8;
    color: #0f172a;
    background: #f8fafc;
}

.pqb-action-btn.delete {
    color: #ef4444;
}

.pqb-action-btn.delete:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.pqb-action-btn.stats-btn {
    color: #10b981;
}

.pqb-action-btn.stats-btn:hover {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #059669;
}

/* DROPDOWNS */
.pqb-dropdown {
    position: relative;
    display: inline-block;
}

.pqb-dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 140px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    z-index: 100;
    right: 0;
    top: 100%;
    overflow: hidden;
}

.pqb-dropdown-content a {
    color: #334155;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid #f1f5f9;
}

.pqb-dropdown-content a:hover {
    background-color: #f8fafc;
    color: #2563eb;
}

.pqb-dropdown:hover .pqb-dropdown-content {
    display: block;
}

.pqb-dropdown:hover .pqb-action-btn {
    border-color: #cbd5e1;
    background: #f8fafc;
}

/* PREVIEW GENERADOR */
.preview-card {
    text-align: center;
    position: sticky;
    top: 40px;
}

.preview-card h3 {
    text-align: center;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 10px;
}

.pqb-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* SPINNER ANIMATION */
.pqb-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* LIBRERÍA RESPONSIVA Y TABLAS */
.pqb-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.pqb-table th {
    background: #f8fafc;
    padding: 14px 16px;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-weight: 600;
}

.pqb-table td {
    padding: 20px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

/* CSS GRID LIBRERÍA */
.lib-row-grid {
    display: grid;
    grid-template-columns: 200px 1fr 150px 200px;
    gap: 20px;
}

.lib-col-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.lib-col-scans {
    text-align: center;
}

.lib-col-actions {
    justify-content: flex-end;
}

/* LIBRERIA TEXTOS Y URLS */
.qr-target-url-prominent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px !important;
    color: #1d4ed8 !important;
    font-weight: 700 !important;
    text-decoration: none;
    margin-bottom: 8px;
    word-break: break-all;
    line-height: 1.3;
    background: #eff6ff;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    transition: all 0.2s ease;
}

.qr-target-url-prominent:hover {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.qr-short-url-discreet {
    font-size: 11px;
    color: #94a3b8;
    display: block;
    margin: 0 0 12px 0;
    font-weight: normal;
}

.qr-short-url-discreet a {
    text-decoration: none;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.qr-short-url-discreet a:hover {
    color: #64748b !important;
    text-decoration: underline;
}

/* EXPIRACIONES Y ANIMACIONES ROJAS */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

.exp-alert-box {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    margin-top: 8px;
}

.exp-warning {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    animation: pulse-red 2s infinite;
}

.exp-expired {
    background: #dc2626;
    color: #fff;
    border: 1px solid #991b1b;
}

.exp-normal {
    display: inline-flex;
    font-size: 11px;
    color: #64748b;
    margin-top: 8px;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
}

.card-pulse-alert {
    animation: pulse-red-border 2s infinite;
    border-color: #ef4444 !important;
}

@keyframes pulse-red-border {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ESTADISTICAS */
.pqb-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-box {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    text-align: center;
}

.pqb-stat-item-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.4s ease;
}

.pqb-stat-item-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
}

.pqb-stat-item-card.highlight {
    box-shadow: 0 0 0 4px #3b82f6;
    border-color: #3b82f6;
    transform: translateY(-3px);
}

.pqb-stat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 15px;
}

.pqb-stat-metrics {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.pqb-metric-box {
    flex: 1;
    min-width: 110px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.pqb-metric-box span {
    display: block;
    font-size: 11px;
    color: #64748b;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.pqb-metric-box strong {
    display: block;
    font-size: 28px;
    color: #0f172a;
    line-height: 1;
}

/* TOAST NOTIFICATION */
#pqb-toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #10b981;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}

#pqb-toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 40px;
}

/* FIX BRAVE SVG */
.qr-mini-preview svg,
.qr-mini-preview canvas {
    width: 100% !important;
    height: 100% !important;
}


/* ==============================================================
   DARK MODE OVERRIDES
   ============================================================== */
.pqb-dark-mode {
    --pqb-bg-main: #0f172a;
    --pqb-bg-card: #1e293b;
    --pqb-text-main: #f8fafc;
    --pqb-text-muted: #94a3b8;
    --pqb-border: #334155;
    --pqb-input-bg: #0f172a;
    --pqb-hover: #334155;
    --pqb-accent: #3b82f6;
}

.pqb-wrapper.pqb-dark-mode {
    background-color: var(--pqb-bg-main) !important;
    color: var(--pqb-text-main) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-header,
.pqb-wrapper.pqb-dark-mode .pqb-card,
.pqb-wrapper.pqb-dark-mode .pqb-stats-card,
.pqb-wrapper.pqb-dark-mode #pqb-theme-menu {
    background-color: var(--pqb-bg-card) !important;
    border-color: var(--pqb-border) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-header h1,
.pqb-wrapper.pqb-dark-mode .pqb-card h3,
.pqb-wrapper.pqb-dark-mode .pqb-stats-card .stat-value,
.pqb-wrapper.pqb-dark-mode .pqb-controls label {
    color: var(--pqb-text-main) !important;
}

.pqb-wrapper.pqb-dark-mode p,
.pqb-wrapper.pqb-dark-mode .stat-label,
.pqb-wrapper.pqb-dark-mode .pqb-tab-btn,
.pqb-wrapper.pqb-dark-mode #pqb-theme-btn {
    color: var(--pqb-text-muted) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-input,
.pqb-wrapper.pqb-dark-mode .pqb-select {
    background-color: var(--pqb-input-bg) !important;
    border-color: var(--pqb-border) !important;
    color: var(--pqb-text-main) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-input[readonly] {
    background-color: var(--pqb-hover) !important;
    color: var(--pqb-text-muted) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-tab-btn:hover,
.pqb-wrapper.pqb-dark-mode .pqb-theme-option:hover {
    background-color: var(--pqb-hover) !important;
    color: var(--pqb-text-main) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-tab-btn.active {
    background-color: var(--pqb-bg-card) !important;
    color: var(--pqb-accent) !important;
    border-bottom-color: var(--pqb-accent) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-shape-card {
    background-color: var(--pqb-bg-card) !important;
    border-color: var(--pqb-border) !important;
}

.pqb-wrapper.pqb-dark-mode input[type="radio"]:checked+.pqb-shape-card {
    border-color: var(--pqb-accent) !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.pqb-wrapper.pqb-dark-mode #pqb-theme-btn {
    background-color: var(--pqb-bg-main) !important;
    border-color: var(--pqb-border) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-theme-option {
    color: var(--pqb-text-muted) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-stat-metrics table th,
.pqb-wrapper.pqb-dark-mode .pqb-stat-metrics table td {
    border-color: var(--pqb-border) !important;
    color: var(--pqb-text-main) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-stat-metrics table th {
    background-color: var(--pqb-hover) !important;
}

.pqb-wrapper.pqb-dark-mode .legibility-box.success {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
}

.pqb-wrapper.pqb-dark-mode .legibility-box.warning {
    background-color: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-shape-card svg {
    fill: var(--pqb-text-main) !important;
    color: var(--pqb-text-main) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-logout-link {
    color: var(--pqb-text-muted) !important;
}

.pqb-wrapper.pqb-dark-mode .pqb-logout-link:hover {
    color: #ef4444 !important;
}

.pqb-wrapper.pqb-dark-mode #qr-preview-container {
    background-color: var(--pqb-hover) !important;
    border-color: var(--pqb-border) !important;
}

/* ==============================================================
   CASCADA RESPONSIVE (ESTRICTAMENTE AL FINAL DEL ARCHIVO)
   ============================================================== */

/* Anclar todo el panel (QR y Botones) globalmente (Desktop, Tablet) */
.pqb-preview-panel {
    align-self: start;
    position: sticky;
    position: -webkit-sticky;
    top: 0px;
    z-index: 999;
}

/* RESPONSIVE LIBRERIA Y DASHBOARD TABLET (Max 768px) */
/* Corrección de Selects cortados en Mac/iOS/Safari */
.pqb-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Flecha SVG personalizada para no perder la funcionalidad visual */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px !important;
    height: 44px;
    /* Soluciona el recorte vertical (cropped text) en iOS/Mac */
    /* Aseguramos que el texto esté centrado verticalmente */
    line-height: normal;
}

@media (max-width: 768px) {
    .pqb-auth-card {
        flex-direction: column;
    }

    .pqb-auth-left,
    .pqb-auth-right {
        padding: 30px;
    }

    .pqb-layout {
        display: grid;
        grid-template-columns: 1fr 280px;
        gap: 15px;
    }


    .pqb-flex-row {
        flex-direction: column;
        gap: 10px;
    }

    /* Fila específica de Logo y Seguridad a 1fr y 280px en Tablet */
    .pqb-row-logo-sec {
        display: grid !important;
        grid-template-columns: 1fr 280px;
        gap: 15px;
    }

    .pqb-shape-selector {
        justify-content: center;
    }

    .pqb-shape-option {
        flex: 1;
        min-width: calc(33% - 10px);
    }

    .pqb-stats-grid-dynamic {
        grid-template-columns: 1fr !important;
    }

    .pqb-stat-metrics {
        flex-direction: column;
    }

    .pqb-actions-group {
        justify-content: center;
        margin-top: 10px;
    }

    .lib-header {
        display: none !important;
    }

    /* Grid de Librería Adaptado para Tablet */
    .lib-row-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        position: relative;
        padding-top: 20px !important;
    }

    .lib-col-qr {
        grid-column: 1 / 2;
        text-align: center;
    }

    .lib-col-info {
        grid-column: 2 / 3;
        text-align: left;
    }

    .lib-col-scans {
        grid-column: 1 / -1;
        display: flex;
        gap: 10px;
        justify-content: center;
        align-items: center;
    }

    .lib-col-actions {
        grid-column: 1 / -1;
        justify-content: center;
        border-top: 1px solid #f1f5f9;
        padding-top: 15px;
        margin-top: 5px;
    }

    .name-display {
        margin-bottom: 10px !important;
    }

    .lib-row-grid .qr-mini-preview {
        margin: 0 auto;
    }

    .lib-row-grid .badge {
        display: inline-block;
        margin-top: 5px;
        margin-bottom: 10px;
    }

    .edit-mode {
        text-align: left;
    }

    .preview-card {
        position: static;
    }

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

/* RESPONSIVE MÓVIL ESTRECHO (Max 480px / 320px / 375px) */
@media (max-width: 480px) {
    .pqb-layout {
        display: flex !important;
        flex-direction: column-reverse;
        gap: 15px;
    }

    /* Forzar que Logo y Seguridad se apilen en móviles pequeños */
    .pqb-row-logo-sec {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Tabs responsivos */
    .pqb-tabs {
        gap: 4px;
        padding-bottom: 8px;
    }

    .pqb-tab-btn {
        padding: 8px 10px;
        font-size: 12px;
        gap: 4px;
    }

    .pqb-tab-btn svg {
        width: 15px;
        height: 15px;
    }

    /* Forzar diseño vertical tipo tarjeta */
    .lib-row-grid {
        display: flex !important;
        flex-direction: column;
        text-align: center;
    }

    .lib-col-info {
        text-align: center;
    }

    /* Solución QRs cortados en Móvil */
    .pqb-card {
        padding: 12px;
    }

    .preview-card {
        padding: 12px 8px;
    }

    #qr-preview-container {
        width: 100%;
        max-width: 100%;
        margin: 0 auto 15px auto;
        overflow: hidden;
        padding: 5px;
        box-sizing: border-box;
        min-height: auto !important;
    }

    #qr-preview-container svg,
    #qr-preview-container canvas {
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
    }

    /* Shape selectors en 3 columnas compactas */
    .pqb-shape-selector {
        gap: 6px;
        justify-content: center;
    }

    .pqb-shape-option {
        flex: 1 1 0;
        min-width: 0;
        max-width: calc(33.333% - 4px);
    }

    .pqb-shape-card {
        padding: 8px 4px;
        border-radius: 8px;
        font-size: 10px;
        gap: 4px;
        min-width: 0;
    }

    .pqb-shape-card svg {
        width: 28px;
        height: 28px;
    }

    /* Forzar botones SVG PNG PDF en bloque y centrados */
    .pqb-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px;
        width: 100%;
        margin-top: 15px;
    }

    .pqb-actions .btn-download {
        width: 100%;
        margin: 0;
    }

    #legibility-panel {
        margin-bottom: 5px;
    }

    /* Header responsive */
    .pqb-header {
        padding: 15px !important;
    }

    .pqb-header h1 {
        font-size: 20px !important;
    }

    .pqb-wrapper {
        padding: 10px;
        margin: 10px 10px 0 0;
    }

    /* Darle una pequeña sombra al QR cuando flota en móvil */
    .pqb-preview-panel .preview-card {
        margin-bottom: 5px;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    }

    /* Ocultar los botones anclados dentro del panel sticky */
    .pqb-preview-panel .pqb-actions {
        display: none !important;
    }

    /* Mostrar nuestra copia de botones que SÍ se desplaza con el resto de opciones */
    .pqb-mobile-only-actions {
        display: block !important;
    }

}