﻿/* ========================================= */
/* Archivo: wwwroot/css/tab-control.css */
/* Tab Control Component - Compatible con Theme Switcher */
/* Ubicación: CellFinPlus.FrontEnd.Client/wwwroot/css/tab-control.css */
/* ========================================= */

/* ========== CONTENEDOR PRINCIPAL ========== */
.tab-control-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .tab-control-container {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========== HEADER DE TABS ========== */
.tab-control-header {
    background: var(--bs-tertiary-bg);
    border-bottom: 2px solid var(--bs-border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

/* ========== NAVEGACIÓN DE TABS ========== */
.tab-nav {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    gap: 0;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

    /* Ocultar scrollbar pero mantener funcionalidad */
    .tab-nav::-webkit-scrollbar {
        height: 4px;
    }

    .tab-nav::-webkit-scrollbar-track {
        background: transparent;
    }

    .tab-nav::-webkit-scrollbar-thumb {
        background: var(--bs-border-color);
        border-radius: 2px;
    }

        .tab-nav::-webkit-scrollbar-thumb:hover {
            background: var(--bs-secondary);
        }

/* ========== ITEM DE TAB ========== */
.tab-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    min-width: 120px;
    border: none;
    background: transparent;
    color: var(--bs-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
    border-bottom: 3px solid transparent;
}

    /* Línea indicadora inferior */
    .tab-item::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--bs-primary);
        transform: scaleX(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* ========== ESTADOS DE TAB ========== */

    /* Tab Activa */
    .tab-item.active {
        color: var(--bs-primary);
        font-weight: 600;
        background: var(--bs-body-bg);
    }

        .tab-item.active::after {
            transform: scaleX(1);
        }

        .tab-item.active .tab-icon {
            color: var(--bs-primary);
            transform: scale(1.1);
        }

    /* Tab Hover (solo si está habilitada) */
    .tab-item:not(.disabled):not(.active):hover {
        color: var(--bs-body-color);
        background: rgba(var(--bs-primary-rgb), 0.05);
    }

[data-bs-theme="dark"] .tab-item:not(.disabled):not(.active):hover {
    background: rgba(var(--bs-primary-rgb), 0.15);
}

/* Tab Deshabilitada */
.tab-item.disabled {
    color: var(--bs-secondary);
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

    .tab-item.disabled .tab-icon {
        opacity: 0.5;
    }

/* ========== ICONOS Y TEXTO ========== */
.tab-icon {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.tab-text {
    line-height: 1.2;
}

/* ========== BADGE DE NOTIFICACIÓN ========== */
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    background: var(--bs-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.625rem;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--bs-danger-rgb), 0.7);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(var(--bs-danger-rgb), 0);
    }
}

/* ========== BODY DE TABS ========== */
.tab-control-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bs-body-bg);
}

/* ========== WRAPPER DE CONTENIDO CON TRANSICIONES ========== */
.tab-content-wrapper {
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

    .tab-content-wrapper.visible {
        opacity: 1;
        transform: translateY(0);
    }

    .tab-content-wrapper.transitioning {
        opacity: 0;
        transform: translateY(-10px);
    }

/* ========== ANIMACIONES ADICIONALES ========== */

/* Animación de entrada para el contenido */
@keyframes slideInContent {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Efecto de brillo al cambiar de tab */
@keyframes shimmerEffect {
    0% {
        background-position: -100% 0;
    }

    100% {
        background-position: 100% 0;
    }
}

.tab-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient( 90deg, transparent, rgba(var(--bs-primary-rgb), 0.1), transparent );
    animation: shimmerEffect 1.5s ease-in-out;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Tablets */
@media (max-width: 768px) {
    .tab-item {
        padding: 0.875rem 1rem;
        min-width: 100px;
        font-size: 0.875rem;
    }

    .tab-icon {
        font-size: 1rem;
    }

    .tab-content-wrapper {
        padding: 1rem;
    }
}

/* Móviles */
@media (max-width: 576px) {
    .tab-nav {
        gap: 0;
    }

    .tab-item {
        flex: 1;
        min-width: 80px;
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 0.25rem;
    }

    .tab-icon {
        font-size: 1.2rem;
        margin-bottom: 0.125rem;
    }

    .tab-text {
        font-size: 0.7rem;
        text-align: center;
    }

    .tab-badge {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        min-width: 1rem;
        height: 1rem;
        font-size: 0.65rem;
    }

    .tab-content-wrapper {
        padding: 0.75rem;
    }
}

/* Móviles pequeños */
@media (max-width: 400px) {
    .tab-item {
        min-width: 70px;
        padding: 0.625rem 0.375rem;
    }

    .tab-icon {
        font-size: 1.1rem;
    }

    .tab-text {
        font-size: 0.65rem;
        line-height: 1.1;
    }
}

/* ========== MODO LANDSCAPE EN MÓVILES ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .tab-item {
        padding: 0.5rem 1rem;
        flex-direction: row;
    }

    .tab-icon {
        font-size: 0.9rem;
    }

    .tab-text {
        font-size: 0.75rem;
    }

    .tab-content-wrapper {
        padding: 0.75rem;
    }
}

/* ========== MEJORAS DE ACCESIBILIDAD ========== */

/* Focus visible para navegación por teclado */
.tab-item:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
    z-index: 1;
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .tab-item {
        border: 1px solid var(--bs-border-color);
    }

        .tab-item.active {
            border-color: var(--bs-primary);
            border-bottom-width: 3px;
        }
}

/* Reducir animaciones para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
    .tab-item,
    .tab-content-wrapper,
    .tab-icon,
    .tab-item::after {
        transition: none;
        animation: none;
    }

    .tab-badge {
        animation: none;
    }
}

/* ========== VARIANTES DE ESTILO ========== */

/* Variante Pills (opcional) */
.tab-control-container.pills .tab-item {
    border-radius: 0.5rem;
    margin: 0.25rem;
}

    .tab-control-container.pills .tab-item.active {
        background: var(--bs-primary);
        color: white;
    }

        .tab-control-container.pills .tab-item.active .tab-icon {
            color: white;
        }

/* Variante Vertical (opcional) */
.tab-control-container.vertical {
    flex-direction: row;
}

    .tab-control-container.vertical .tab-control-header {
        border-bottom: none;
        border-right: 2px solid var(--bs-border-color);
    }

    .tab-control-container.vertical .tab-nav {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .tab-control-container.vertical .tab-item {
        justify-content: flex-start;
        min-width: 200px;
        text-align: left;
    }

        .tab-control-container.vertical .tab-item::after {
            left: auto;
            right: -2px;
            top: 0;
            bottom: 0;
            width: 3px;
            height: 100%;
            transform: scaleY(0);
        }

        .tab-control-container.vertical .tab-item.active::after {
            transform: scaleY(1);
        }

/* ========== ESTADOS DE CARGA ========== */
.tab-item.loading {
    pointer-events: none;
    opacity: 0.6;
}

    .tab-item.loading::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 1rem;
        height: 1rem;
        margin: -0.5rem 0 0 -0.5rem;
        border: 2px solid var(--bs-primary);
        border-right-color: transparent;
        border-radius: 50%;
        animation: spin 0.6s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== MEJORAS PARA DARK MODE ========== */
[data-bs-theme="dark"] .tab-control-header {
    background: rgba(var(--bs-tertiary-bg-rgb), 0.5);
    backdrop-filter: blur(10px);
}

[data-bs-theme="dark"] .tab-item.active {
    background: rgba(var(--bs-body-bg-rgb), 0.8);
}

[data-bs-theme="dark"] .tab-badge {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* ========== SCROLLBAR MEJORADO PARA NAVEGACIÓN ========== */
.tab-nav {
    scrollbar-width: thin;
    scrollbar-color: var(--bs-border-color) transparent;
}

/* ========== SEPARADORES VISUALES (OPCIONAL) ========== */
.tab-item:not(:last-child)::before {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--bs-border-color);
    opacity: 0.3;
}

.tab-item.active:not(:last-child)::before,
.tab-item:hover:not(:last-child)::before {
    opacity: 0;
}
