/* ────────────────────────────────────────────
   Command Palette / Busqueda global  (PYV)
   ──────────────────────────────────────────── */

.bg-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1080;
    display: none;
}
.bg-overlay.active {
    display: flex;
    justify-content: center;
    padding-top: 80px;
}
.bg-search-box {
    background: #fff;
    border-radius: 14px;
    width: 640px;
    max-width: 95vw;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bgSlideDown 0.18s ease;
    overflow: hidden;
}
@keyframes bgSlideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Input */
.bg-search-input {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e9ecef;
}
.bg-search-input i.fa-search {
    color: #94a3b8;
    font-size: 18px;
    margin-right: 12px;
}
.bg-search-input input {
    border: none;
    outline: none;
    font-size: 16px;
    flex: 1;
    background: transparent;
    color: #1e293b;
}
.bg-search-input .bg-shortcut {
    font-size: 11px;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
    white-space: nowrap;
    background: #f8fafc;
}
.bg-search-input .bg-close {
    cursor: pointer;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    margin-left: 10px;
    background: none;
    border: 0;
    padding: 0 4px;
}
.bg-search-input .bg-close:hover { color: #475569; }

/* Resultados */
.bg-results {
    overflow-y: auto;
    padding: 6px 0 10px;
    flex: 1;
}
.bg-results:empty::after {
    content: "Escribe para buscar clientes o ejecutar una accion...";
    display: block;
    text-align: center;
    padding: 30px;
    color: #94a3b8;
    font-size: 14px;
}

/* Headers de seccion */
.bg-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    padding: 10px 18px 4px;
    letter-spacing: 0.5px;
}
.bg-section-header i { font-size: 11px; color: #94a3b8; }

/* Items (base) */
.bg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
    min-height: 44px;
}
.bg-item:hover,
.bg-item.active {
    background: #f1f5f9;
    text-decoration: none;
    color: inherit;
}

.bg-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.bg-item-icon.cliente { background: #e8f5e9; color: #2e7d32; }
.bg-item-icon.prestamo { background: #e3f2fd; color: #1565c0; }
.bg-item-icon.gasto { background: #fce4ec; color: #c62828; }
.bg-item-icon.reporte { background: #fff3e0; color: #e65100; }
.bg-item-icon.config { background: #f3e5f5; color: #6a1b9a; }
.bg-item-icon.sistema { background: #eef2ff; color: #4e73df; }

.bg-item-text { flex: 1; min-width: 0; }
.bg-item-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1e293b;
}
.bg-item-sub {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tag tipo de comando */
.bg-cmd-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    background: #f1f5f9;
    color: #64748b;
}
.bg-cmd-tag-crear   { background: rgba(45, 206, 137, 0.14); color: #1a7548; }
.bg-cmd-tag-ir-a    { background: rgba(78, 115, 223, 0.14); color: #2d4ec0; }
.bg-cmd-tag-reporte { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.bg-cmd-tag-sistema { background: rgba(100, 116, 139, 0.16); color: #475569; }

/* Hint enter en item activo */
.bg-item.active::after {
    content: '\21B5';
    margin-left: 6px;
    font-weight: 700;
    color: #4e73df;
    font-size: 14px;
}

/* Estados especiales */
.bg-no-results {
    text-align: center;
    padding: 30px;
    color: #94a3b8;
}
.bg-no-results i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}
.bg-loading {
    text-align: center;
    padding: 18px;
    color: #94a3b8;
    font-size: 13px;
}

.bg-hint {
    padding: 10px 18px;
    border-top: 1px solid #f1f5f9;
    margin-top: 6px;
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
}
.bg-hint kbd {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 10px;
    color: #475569;
    margin: 0 2px;
}

/* Highlight de matches */
.bg-results mark {
    background: #fff59d;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

/* Trigger boton en el topbar */
.btn-search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    height: 40px;
    border-radius: 20px;
    padding: 0 14px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    cursor: pointer;
    min-width: 220px;
    justify-content: flex-start;
}
.btn-search-trigger:hover,
.btn-search-trigger:focus {
    background: #ffffff;
    border-color: #4e73df;
    color: #475569;
    box-shadow: 0 0 0 4px rgba(78, 115, 223, 0.1);
    outline: none;
}
.btn-search-trigger .bg-shortcut {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
    background: #fff;
}

/* Mobile: el trigger se vuelve circular (solo icono) */
@media (max-width: 575.98px) {
    .btn-search-trigger {
        min-width: 0;
        width: 40px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
    }
    .btn-search-trigger .bg-trigger-label,
    .btn-search-trigger .bg-shortcut {
        display: none;
    }
    .bg-overlay.active {
        padding-top: 12px;
    }
    .bg-search-box {
        border-radius: 10px;
    }
}
