/*
 * ══ topnav-orange.css ══════════════════════════════════════════════════
 * Estilo naranja para la barra de navegación horizontal (modo horizontal).
 * Para revertir: eliminar esta línea en partials/head-css.php:
 *   <link rel="stylesheet" href="<?= base_url('assets/css/topnav-orange.css') ?>">
 * ════════════════════════════════════════════════════════════════════════
 */

/* ── Fondo naranja en la barra horizontal ──────────────────────────── */
:root[data-main-layout="horizontal"] .app-sidebar {
    background: #808080 !important;
    border-bottom: 4px solid #16a34a !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15) !important;
}

/* Separar el contenido de la barra de navegación */
:root[data-main-layout="horizontal"] .app-container {
    padding-top: 28px !important;
}

/* Ocultar el logo del sidebar en horizontal (ya está en el header) */
:root[data-main-layout="horizontal"] .app-sidebar .app-sidebar-logo {
    display: none !important;
}

/* ── Ítems de nivel superior ────────────────────────────────────────── */
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide > .side-menu__item {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    padding: 10px 22px !important;
    min-height: 60px !important;
    color: rgba(255, 255, 255, 0.88) !important;
    border-radius: 0 !important;
    border-bottom: 3px solid transparent !important;
    transition: background 0.15s, border-color 0.15s, color 0.15s !important;
}

/* Ícono */
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide > .side-menu__item .side_menu_icon {
    color: rgba(255, 255, 255, 0.88) !important;
    margin-right: 0 !important;
    line-height: 1 !important;
}
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide > .side-menu__item .side_menu_icon i {
    font-size: 19px !important;
}

/* Texto */
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide > .side-menu__item .side-menu__label {
    color: rgba(255, 255, 255, 0.88) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em !important;
}

/* Ocultar el chevron (↔ en horizontal no hace falta) */
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide > .side-menu__item .side-menu__angle {
    display: none !important;
}

/* ── Hover ─────────────────────────────────────────────────────────── */
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide > .side-menu__item:hover {
    background: rgba(0, 0, 0, 0.14) !important;
    border-bottom-color: rgba(255, 255, 255, 0.55) !important;
    color: #fff !important;
}
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide > .side-menu__item:hover .side-menu__label,
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide > .side-menu__item:hover .side_menu_icon {
    color: #fff !important;
}

/* ── Activo ─────────────────────────────────────────────────────────── */
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide.active > .side-menu__item,
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide.open > .side-menu__item {
    background: rgba(0, 0, 0, 0.20) !important;
    border-bottom-color: #fff !important;
    color: #fff !important;
}
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide.active > .side-menu__item .side-menu__label,
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide.open > .side-menu__item .side-menu__label,
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide.active > .side-menu__item .side_menu_icon,
:root[data-main-layout="horizontal"] .app-sidebar-menu > ul > .slide.open > .side-menu__item .side_menu_icon {
    color: #fff !important;
}

/* ── Filas anuladas en tablas ───────────────────────────────────────────── */
.row-anulada td { background-color: #f5f5f5 !important; color: #aaa !important; }
[data-bs-theme="dark"] .row-anulada td {
    background-color: rgba(255,255,255,0.04) !important;
    color: rgba(255,255,255,0.28) !important;
}

/* ── Dark mode: tablas — thead/tfoot con clases Bootstrap light/secondary ── */
[data-bs-theme="dark"] .table-light > tr > th,
[data-bs-theme="dark"] .table-light > tr > td,
[data-bs-theme="dark"] thead.table-light > tr > th {
    background-color: rgba(255,255,255,0.06) !important;
    color: rgba(255,255,255,0.75) !important;
    border-color: rgba(255,255,255,0.10) !important;
}
[data-bs-theme="dark"] tfoot.table-secondary > tr > td {
    background-color: rgba(255,255,255,0.05) !important;
    color: rgba(255,255,255,0.80) !important;
    border-color: rgba(255,255,255,0.10) !important;
}


/* ── Dark mode: fondo del body y contenido principal ────────────────── */
[data-bs-theme="dark"] body {
    background-color: #141821 !important;
}
[data-bs-theme="dark"] .app-content {
    background-color: #141821 !important;
}

/* ── Menú child2 (flyout): Tablas Maestras → tipos ──────────────────── */

/* Permitir overflow en el child1 para que el flyout sea visible */
.app-sidebar-menu .slide-menu.child1 {
    overflow: visible !important;
}

/* El ítem padre de child2 es el anchor de posicionamiento */
.app-sidebar-menu .slide-menu.child1 > .slide.has-sub {
    position: relative !important;
}

/* child2 como panel flotante a la derecha del child1 */
.app-sidebar-menu .slide-menu.child1 > .slide.has-sub > .slide-menu.child2 {
    position: absolute !important;
    left: 100% !important;
    top: 0 !important;
    min-width: 200px !important;
    padding: 6px 0 !important;
    list-style: none !important;
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.09) !important;
    border-radius: 0 8px 8px 8px !important;
    box-shadow: 6px 6px 20px rgba(0, 0, 0, 0.13) !important;
    z-index: 9999 !important;
    /* Oculto por defecto — se muestra cuando el padre tiene clase open */
    display: none !important;
}
.app-sidebar-menu .slide-menu.child1 > .slide.has-sub.open-menu > .slide-menu.child2 {
    display: block !important;
}

/* Ítems dentro del flyout */
.app-sidebar-menu .slide-menu.child2 .side-menu__item {
    padding: 9px 18px !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #444 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: background 0.12s, color 0.12s !important;
    white-space: nowrap !important;
}
.app-sidebar-menu .slide-menu.child2 .side-menu__item:hover {
    background: #fff8f0 !important;
    color: #f7941d !important;
}
.app-sidebar-menu .slide-menu.child2 .slide.active > .side-menu__item {
    background: #fff3e6 !important;
    color: #f7941d !important;
    font-weight: 600 !important;
}

/* Dark mode */
[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child1 > .slide.has-sub > .slide-menu.child2 {
    background: #1e252e !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 6px 6px 20px rgba(0, 0, 0, 0.35) !important;
}
[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child2 .side-menu__item {
    color: rgba(255, 255, 255, 0.72) !important;
}
[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child2 .side-menu__item:hover {
    background: rgba(244, 93, 8, 0.14) !important;
    color: #f7941d !important;
}
[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child2 .slide.active > .side-menu__item {
    background: rgba(244, 93, 8, 0.20) !important;
    color: #f7941d !important;
}

/* ── Submenú desplegable ─────────────────────────────────────────────── */
:root[data-main-layout="horizontal"] .app-sidebar-menu .slide-menu.child1 {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
    border-radius: 0 0 8px 8px !important;
    padding: 4px 0 !important;
    min-width: 180px !important;
}
[data-bs-theme="dark"] :root[data-main-layout="horizontal"] .app-sidebar-menu .slide-menu.child1,
:root[data-bs-theme="dark"][data-main-layout="horizontal"] .app-sidebar-menu .slide-menu.child1 {
    background: #1e252e !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}
:root[data-main-layout="horizontal"] .app-sidebar-menu .slide-menu.child1 .side-menu__item {
    color: #444 !important;
    padding: 9px 20px !important;
    border-radius: 0 !important;
    border-bottom: none !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    flex-direction: row !important;
    gap: 8px !important;
    min-height: unset !important;
    transition: background 0.12s, color 0.12s !important;
}
:root[data-main-layout="horizontal"] .app-sidebar-menu .slide-menu.child1 .side-menu__item:hover {
    background: #fff8f0 !important;
    color: #f7941d !important;
    border-bottom: none !important;
}
:root[data-main-layout="horizontal"] .app-sidebar-menu .slide-menu.child1 .slide.active > .side-menu__item {
    background: #fff3e6 !important;
    color: #f7941d !important;
    font-weight: 600 !important;
    border-bottom: none !important;
}
[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child1 .side-menu__item,
:root[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child1 .side-menu__item {
    color: rgba(255, 255, 255, 0.75) !important;
}
[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child1 .side-menu__item:hover,
:root[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child1 .side-menu__item:hover {
    background: rgba(244, 93, 8, 0.15) !important;
    color: #f7941d !important;
}
[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child1 .slide.active > .side-menu__item,
:root[data-bs-theme="dark"] .app-sidebar-menu .slide-menu.child1 .slide.active > .side-menu__item {
    background: rgba(244, 93, 8, 0.20) !important;
    color: #f7941d !important;
}

/* ─────────────────────────────────────────────────────────────────
   Override de "secondary" (morado claro) → gris/amarillo branding
   ───────────────────────────────────────────────────────────────── */

/* Footers de tabla y filas marcadas como "table-secondary" → gris claro */
.table-secondary,
.table > :not(caption) > * > .table-secondary,
.table-secondary > th,
.table-secondary > td,
table tfoot.table-secondary,
table tfoot.table-secondary td,
table tfoot.table-secondary th {
    --bs-table-bg:    rgb(236, 236, 236) !important;
    --bs-table-color: rgb(91, 91, 91)   !important;
    background-color: rgb(236, 236, 236) !important;
    color:            rgb(91, 91, 91)   !important;
    border-color:     rgb(220, 220, 220) !important;
}

/* Filas de facturas / pagos en USD → fondo amarillo muy suave */
tr.row-usd > td {
    background-color: rgba(255, 243, 205, 0.80) !important;
}
[data-bs-theme="dark"] tr.row-usd > td {
    background-color: rgba(251, 191, 36, 0.12) !important;
    color: rgba(255, 230, 160, 0.95) !important;
}

/* Variante dark: gris oscuro legible sobre fondo oscuro */
[data-bs-theme="dark"] .table-secondary,
[data-bs-theme="dark"] .table > :not(caption) > * > .table-secondary,
[data-bs-theme="dark"] .table-secondary > th,
[data-bs-theme="dark"] .table-secondary > td,
[data-bs-theme="dark"] table tfoot.table-secondary,
[data-bs-theme="dark"] table tfoot.table-secondary td,
[data-bs-theme="dark"] table tfoot.table-secondary th {
    --bs-table-bg:    rgb(48, 52, 58)    !important;
    --bs-table-color: rgb(220, 220, 220) !important;
    background-color: rgb(48, 52, 58)    !important;
    color:            rgb(220, 220, 220) !important;
    border-color:     rgb(70, 74, 80)    !important;
}

/* Badges / utilidades "secondary-subtle" → amarillo branding */
.bg-secondary-subtle {
    background-color: rgb(255, 208, 67) !important;
}
.text-secondary {
    --bs-text-opacity: 1;
    color: rgb(91, 91, 91) !important;
}
/* Mantener legibilidad cuando se combinan ambas en un badge */
.bg-secondary-subtle.text-secondary,
.badge.bg-secondary-subtle {
    color: rgb(91, 91, 91) !important;
}
