﻿/* Superficie principal BC */
.bc-shell {
    background: #ffffff;
    border: none;
    border-radius: 6px;
    box-shadow: none;
    overflow: visible;
}

/* Página BC: NO uses 100vh aquí (conflicta con .nexa-content) */
.bc-page {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* =====================================================
   ✅ NUEVO: Sticky header ÚNICO (Title + Commandbar)
   Se pega al AppBar porque el scroll real es .nexa-content
   y este sticky está dentro de ese contenedor.
   ===================================================== */
.bc-sticky-header {
    position: sticky;
    top: 0; /* altura del AppBar fijo */
    z-index: 50;
    background: #ffffff;
}

/* Titlebar (ya NO sticky; ahora vive dentro de .bc-sticky-header) */
.bc-titlebar {
    position: static;
    z-index: auto;
    background: #ffffff;
    border-bottom: 1px solid #edebe9;
    padding: 8px 12px;
}

/* Commandbar (ya NO sticky; ahora vive dentro de .bc-sticky-header) */
.bc-commandbar {
    position: static;
    top: auto;
    z-index: auto;
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(0,0,0,.06);
    border-bottom: 1px solid #edebe9;
    min-height: 48px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
}

/* Layout interno del commandbar */
.bc-cbar {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
}

.bc-cbar-left, .bc-cbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.bc-commandbar .mud-button-root {
    border-radius: 4px;
    text-transform: none;
    font-weight: 500;
}

/* Buscador */
.bc-search {
    width: 420px;
    max-width: 48vw;
}

/* Grid host: el scroll del grid vive adentro */
.bc-gridhost {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

    /* MudDataGrid: que sea flex y pueda encogerse */
    .bc-gridhost .mud-data-grid {
        flex: 1 1 auto;
        min-height: 0;
        border: none !important;
        border-radius: 0 !important;
    }

        /* ✅ Scroll vertical + horizontal SOLO aquí */
        .bc-gridhost .mud-table-container,
        .bc-gridhost .mud-data-grid .mud-table-container {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto !important;
            overflow-x: auto !important;
        }

    /* Ancho mínimo para muchas columnas (desktop) */
    .bc-gridhost table {
        width: 100%;
        min-width: 1100px;
    }

    /* Tabla BC */
    .bc-gridhost .mud-table th {
        font-weight: 600;
        font-size: 13px;
        background: #faf9f8;
        border-bottom: 1px solid #e1dfdd;
    }

    .bc-gridhost .mud-table td {
        font-size: 13px;
        border-bottom: 1px solid #edebe9;
    }

    .bc-gridhost .mud-table tbody tr:hover {
        background: #f3f2f1;
    }

    /* Pager */
    .bc-gridhost .mud-table-pagination,
    .bc-gridhost .mud-data-grid-pager,
    .bc-gridhost .mud-data-grid .mud-table-pagination {
        flex: 0 0 auto;
        padding: 8px 12px;
        border-top: 1px solid #e1dfdd;
        background: #faf9f8;
        font-size: 13px;
    }

/* Header filtros */
.bc-hdr {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bc-hdr-title {
    white-space: nowrap;
}

/* Inputs */
.mud-input-outlined .mud-input-outlined-border {
    border-color: #c8c6c4;
}

.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: #0078d4;
}

/* Primary */
.mud-button-filled {
    background-color: #0078d4;
    border-radius: 4px;
}

    .mud-button-filled:hover {
        background-color: #106ebe;
    }

/* Responsive */
@media (max-width: 900px) {
    .bc-gridhost table {
        min-width: 0;
    }

    .bc-cbar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bc-cbar-right {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .bc-search {
        width: 100%;
        max-width: 100%;
    }

    /* ✅ Ya no necesitamos hacks de sticky separados */
    .bc-titlebar {
        position: static;
    }

    .bc-commandbar {
        position: static;
    }
}

/* Hace que la página BC use todo el alto disponible dentro del scroll container */
.bc-page-fill {
    height: 100%;
    min-height: 0;
}

.bc-divider {
    height: 24px;
    opacity: 0.6;
}
