/* CSS tab manager styles */

/* Contenedor de las pestañas en el Navbar */
#tab-navigation-container {
    padding-left: 15px;
    margin: 0;
    list-style: none;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    height: 100%;
}
#tab-navigation-container::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

/* Elemento pestaña individual */
.nav-tab-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    margin-right: 5px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--bs-secondary-color);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    height: 35px;
    white-space: nowrap;
}

[data-bs-theme="dark"] .nav-tab-item {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

/* Hover de la pestaña */
.nav-tab-item:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #0d6efd;
}

/* Pestaña Activa */
.nav-tab-item.active {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12) rgba(0, 0, 0, 0.12) transparent rgba(0, 0, 0, 0.12);
    color: #0d6efd !important;
    border-top: 3px solid #0d6efd;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.04);
    height: 38px;
}

/* Botón de cierre X en pestaña */
.nav-tab-close {
    margin-left: 10px;
    font-size: 14px;
    line-height: 1;
    color: var(--bs-secondary-color);
    opacity: 0.6;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 16px;
    height: 16px;
}
.nav-tab-close:hover {
    background-color: var(--bs-danger-bg-subtle);
    color: var(--bs-danger) !important;
    opacity: 1;
}

/* Contenedor de los iframes del Tabbed Workspace */
#iframe-tabs-content-container {
    width: 100%;
    height: calc(100vh - 57px); /* Alto dinámico total menos navbar */
    overflow: hidden;
    position: relative;
    background: #f4f6f9 !important;
}

/* Contenedor wrapper del iframe */
.tab-iframe-wrapper {
    width: 100%;
    height: 100%;
    border: none;
    margin: 0;
    padding: 0;
    background: #f4f6f9 !important;
}

/* --- REGLAS PARA EL HOSPEDADOR DE PESTAÑAS (HOST WINDOW) --- */
html.is-iframe-host main.app-main {
    padding: 0 !important;
    margin-top: 0 !important;
    min-height: auto !important;
}

/* Ocultar el contenido nativo directo de la página si somos host con pestañas activas */
html.is-iframe-host main.app-main > *:not(#iframe-tabs-content-container) {
    display: none !important;
}

/* Ocultar contenedor de iframes si no estamos en modo host */
html:not(.is-iframe-host) #iframe-tabs-content-container {
    display: none !important;
}

/* Panel de bienvenida en el index */
#welcome-dashboard {
    padding: 40px;
    background: #f4f6f9 !important;
    min-height: calc(100vh - 120px);
}
html.is-iframe-host #welcome-dashboard {
    display: none !important;
}

/* --- REGLAS PARA CUANDO EL CONTENIDO ESTÁ ANIDADO DENTRO DE UN IFRAME --- */
html.is-iframe, 
html.is-iframe body {
    overflow-y: auto !important;
    height: 100% !important;
    background: #f4f6f9 !important;
    color: #212529 !important;
}

html.is-iframe .app-header,
html.is-iframe .app-sidebar,
html.is-iframe .app-footer,
html.is-iframe [data-lte-toggle="sidebar"] {
    display: none !important;
}

html.is-iframe .app-wrapper {
    padding-left: 0 !important;
    padding-top: 0 !important;
    background: #f4f6f9 !important;
}

html.is-iframe main.app-main {
    margin-left: 0 !important;
    padding-top: 15px !important;
    min-height: 100vh !important;
    background: #f4f6f9 !important;
    color: #212529 !important;
}
