/* ==========================================================================
   ERPTOTALES - TEMA DEL DASHBOARD Y MARCO DE TRABAJO (SOLO AUTENTICADO)
   ========================================================================== */

/* Contenedor del Layout Maestro con Sidebar y Workspace */
.erp-layout-root {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 70px);
    background: var(--bg, #F2F4F7);
    color: var(--ink, #10233F);
    font-family: var(--font-tf, "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    font-size: 14px;
    line-height: 1.45;
}

/* Sidebar mejorado para navegación jerárquica */
.erp-layout-root .tf-side {
    width: 260px;
    background: var(--side, #10233F);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.erp-layout-root .tf-side::-webkit-scrollbar {
    width: 5px;
}

.erp-layout-root .tf-side::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Grupos y Categorías de Menú (Acordeón) */
.tf-menu-group {
    margin-bottom: 4px;
}

.tf-menu-category {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    color: #C9D3E3;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tf-menu-category:hover,
.tf-menu-category.category-open {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
}

.tf-chevron {
    font-size: 11px;
    transition: transform 0.2s ease;
}

.tf-chevron.chevron-open {
    transform: rotate(180deg);
}

/* Submenús */
.tf-submenu {
    margin-left: 12px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 3px;
    margin-bottom: 6px;
}

.tf-sub-btn {
    background: none;
    border: 0;
    text-align: left;
    padding: 6px 10px;
    border-radius: 6px;
    color: #A0AEC0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    width: 100%;
    cursor: pointer;
}

.tf-sub-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #FFFFFF;
}

.tf-sub-btn.active {
    background: var(--brand, #2450D6);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(36, 80, 214, 0.35);
}

/* Área de trabajo central donde se renderizan los componentes del ERP */
.erp-main-workspace {
    min-width: 0;
    padding: 20px 24px 48px;
    background: var(--bg, #F2F4F7);
    overflow-y: auto;
}

/* ══════════════════════════════════════════════════════════════════════════
   ESTILOS SCOPED (.tf-dashboard-theme)
   Aplica únicamente a los componentes que se ubican en el canvas autenticado
   ══════════════════════════════════════════════════════════════════════════ */
.tf-dashboard-theme {
    font-family: var(--font-tf, "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    color: var(--ink, #10233F);
}

/* Títulos y encabezados */
.tf-dashboard-theme h1,
.tf-dashboard-theme h2,
.tf-dashboard-theme h3,
.tf-dashboard-theme h4,
.tf-dashboard-theme h5,
.tf-dashboard-theme h6 {
    color: var(--ink, #10233F);
    font-weight: 700;
    letter-spacing: -0.015em;
}

/* Tarjetas y Contenedores */
.tf-dashboard-theme .card,
.tf-dashboard-theme .form-card,
.tf-dashboard-theme .table-card {
    background-color: var(--surface, #FFFFFF) !important;
    border: 1px solid var(--line, #E1E5EB) !important;
    border-radius: var(--radius-card, 12px) !important;
    box-shadow: 0 1px 3px rgba(16, 35, 63, 0.05) !important;
    margin-bottom: 16px;
}

.tf-dashboard-theme .card-header {
    background-color: var(--surface2, #F7F8FA) !important;
    border-bottom: 1px solid var(--line, #E1E5EB) !important;
    padding: 12px 18px !important;
    font-weight: 600;
    color: var(--ink, #10233F);
}

/* Controles de Formulario (Inputs, Selects, Textareas) */
.tf-dashboard-theme .form-control,
.tf-dashboard-theme .form-select,
.tf-dashboard-theme input.form-control,
.tf-dashboard-theme select.form-select {
    background-color: var(--surface, #FFFFFF);
    border: 1px solid var(--line, #D5DAE1);
    color: var(--ink, #10233F);
    border-radius: var(--radius-btn, 8px);
    font-size: 13.5px;
    padding: 7px 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tf-dashboard-theme .form-control:focus,
.tf-dashboard-theme .form-select:focus {
    outline: none;
    border-color: var(--brand, #2450D6);
    box-shadow: 0 0 0 3px rgba(36, 80, 214, 0.14);
}

.tf-dashboard-theme .input-group-text {
    background-color: var(--surface2, #F7F8FA);
    border: 1px solid var(--line, #D5DAE1);
    color: var(--muted, #5B6B80);
    border-radius: var(--radius-btn, 8px);
}

/* Etiquetas de Formularios */
.tf-dashboard-theme label.form-label,
.tf-dashboard-theme .form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted, #4B5565);
    margin-bottom: 4px;
}

/* Botones con estilo Dashboard */
.tf-dashboard-theme .btn-primary {
    background-color: var(--brand, #2450D6) !important;
    border-color: var(--brand, #2450D6) !important;
    color: #FFFFFF !important;
    border-radius: var(--radius-btn, 8px);
    font-weight: 600;
    font-size: 13.5px;
    box-shadow: 0 1px 3px rgba(36, 80, 214, 0.25);
    transition: all 0.15s ease;
}

.tf-dashboard-theme .btn-primary:hover {
    background-color: #1a3fb3 !important;
    border-color: #1a3fb3 !important;
    box-shadow: 0 2px 6px rgba(36, 80, 214, 0.35);
}

.tf-dashboard-theme .btn-cyan {
    background-color: #00B4D8 !important;
    border-color: #00B4D8 !important;
    color: #FFFFFF !important;
    border-radius: var(--radius-pill, 99px);
    font-weight: 600;
    font-size: 13.5px;
    box-shadow: 0 2px 6px rgba(0, 180, 216, 0.3);
    transition: all 0.15s ease;
}

.tf-dashboard-theme .btn-cyan:hover {
    background-color: #0096C7 !important;
    border-color: #0096C7 !important;
    color: #FFFFFF !important;
}

.tf-dashboard-theme .btn-outline-secondary,
.tf-dashboard-theme .btn-light {
    border: 1px solid var(--line, #D5DAE1) !important;
    background-color: var(--surface, #FFFFFF) !important;
    color: var(--ink, #10233F) !important;
    border-radius: var(--radius-btn, 8px);
    font-size: 13.5px;
}

.tf-dashboard-theme .btn-outline-secondary:hover,
.tf-dashboard-theme .btn-light:hover {
    background-color: var(--surface2, #F7F8FA) !important;
    border-color: var(--muted, #5B6B80) !important;
}

/* Tablas Administrativas */
.tf-dashboard-theme .table {
    margin-bottom: 0;
    color: var(--ink, #10233F);
}

.tf-dashboard-theme .table thead th {
    background-color: var(--surface2, #F7F8FA) !important;
    color: var(--muted, #5B6B80) !important;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--line, #E1E5EB);
    padding: 10px 14px;
}

.tf-dashboard-theme .table tbody td {
    border-bottom: 1px solid var(--line, #E1E5EB);
    padding: 11px 14px;
    font-size: 13.5px;
    vertical-align: middle;
}

.tf-dashboard-theme .table tbody tr:hover {
    background-color: rgba(36, 80, 214, 0.025) !important;
}

/* Badges y Pastillas */
.tf-dashboard-theme .badge {
    font-weight: 600;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-pill, 99px);
}

/* Adaptación responsive: Sidebar Off-Canvas / Drawer en pantallas pequeñas */
.erp-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
}

.erp-sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 992px) {
    .erp-sidebar-backdrop {
        display: none !important;
    }

    .erp-layout-root {
        grid-template-columns: 250px 1fr;
    }

    .erp-layout-root .tf-side {
        width: 250px;
    }
}

@media (max-width: 991.98px) {
    .erp-layout-root {
        grid-template-columns: 1fr !important;
        position: relative;
    }
    
    .erp-layout-root .tf-side {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 1060 !important;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        overflow-y: auto;
        padding-top: 14px;
    }

    .erp-layout-root.sidebar-mobile-open .tf-side {
        transform: translateX(0) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    }
    
    .erp-main-workspace {
        padding: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* ==========================================================================
   ESTILOS DE MENÚ EN COLUMNAS (ESTILO SIIGO) - COMPARTIDO PARA HUBS
   ========================================================================== */
.siigo-group-card {
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    background-color: #ffffff !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.siigo-group-card:hover {
    border-color: #cbd5e1 !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06) !important;
}

.siigo-menu-list {
    margin: 0;
    padding: 0;
}

.siigo-menu-item {
    padding: 8px 10px;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.siigo-menu-item:hover {
    background-color: #f8fafc;
}

.siigo-menu-link {
    color: #1e293b;
    font-size: 0.9rem;
    line-height: 1.35;
    transition: color 0.15s ease;
}

.siigo-menu-item:hover .siigo-menu-link {
    color: #0284c7;
}

.cursor-pointer {
    cursor: pointer;
}
