/* FRYMA - Distribuidores · estilos personalizados */

:root {
    --fryma-primary: #0d6efd;
}

/* Sidebar: en mobile colapsar como off-canvas */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        top: 0;
        left: -240px;
        z-index: 1050;
        transition: left 0.2s;
    }
    #sidebar.abierto { left: 0; }
}

/* Backdrop oscuro detrás del sidebar abierto (solo mobile) */
#sidebar-backdrop { display: none; }
@media (max-width: 768px) {
    #sidebar-backdrop.visible {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(0, 0, 0, 0.4);
    }
}

/* Fila activa por teclado en listados */
tr.activa-teclado,
.list-group-item.activa-teclado {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
    background-color: var(--bs-primary-bg-subtle);
}

/* Badges de estado */
.badge-estado {
    font-weight: 500;
    padding: 0.35em 0.65em;
}
.badge-estado.solicitada,
.badge-estado.cargado { background-color: #cfe2ff; color: #084298; }
.badge-estado.laboratorio { background-color: #e2d4f7; color: #4b2a86; }
.badge-estado.pipa { background-color: #cff4e3; color: #0b6b47; }
.badge-estado.enviada,
.badge-estado.enviado { background-color: #ffe5d0; color: #984c0c; }
.badge-estado.finalizada,
.badge-estado.finalizado { background-color: #d1e7dd; color: #0a3622; }
.badge-estado.cancelada,
.badge-estado.cancelado { background-color: #e9ecef; color: #6c757d; text-decoration: line-through; }

/* Badge "pendiente fórmula" */
.badge-pendiente-formula {
    background-color: #fff3cd;
    color: #664d03;
    font-size: 0.75rem;
}

/* Cards mobile en lugar de tablas */
@media (max-width: 768px) {
    .tabla-mobile-cards thead { display: none; }
    .tabla-mobile-cards tr {
        display: block;
        margin-bottom: 0.5rem;
        border: 1px solid var(--bs-border-color);
        border-radius: 0.375rem;
        padding: 0.5rem;
    }
    .tabla-mobile-cards td {
        display: block;
        border: none !important;
        padding: 0.25rem 0.5rem;
    }
    .tabla-mobile-cards td::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--bs-secondary);
    }
}

/* Avatares con iniciales */
.avatar-iniciales {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--bs-primary);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Kbd estilizado */
kbd {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.85em;
    color: var(--bs-body-color);
}

/* Combobox (select con búsqueda) */
.combobox { position: relative; }
.combobox-list {
    position: fixed;
    z-index: 1060;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    display: none;
}
.combobox-list.show { display: block; }
.combobox-item {
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.combobox-item:hover,
.combobox-item.activa { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }

/* Ítems con subtítulo (características) y marca de "compatible" */
.combobox-main { display: block; }
.combobox-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}
.combobox-item.combobox-match { border-left: 3px solid var(--bs-success); }
.combobox-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.25rem;
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis, #0a3622);
    border: 1px solid var(--bs-success-border-subtle, #a3cfbb);
}
/* Cards clickeables del dashboard: indicador visual de que linkean */
a.card { transition: transform 0.1s ease, box-shadow 0.1s ease; }
a.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* Header de grupo dentro del dropdown (no clickeable) */
.combobox-group {
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
    cursor: default;
    user-select: none;
}
.combobox-list > .combobox-group:first-child { border-top: none; }
