/* ========== ANIMACIONES DE TABS MEJORADAS ========== */

/* Contenedor de tabs con indicador móvil */
.tabs {
    position: relative;
    background: var(--bg-tertiary);
    padding: var(--space-xs);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-xl);
    overflow: visible;
}

/* Indicador móvil que se desliza entre tabs */
.tabs::before {
    content: '';
    position: absolute;
    bottom: var(--space-xs);
    left: var(--indicator-left, 8px);
    height: 2px;
    background: var(--color-cyan);
    border-radius: var(--radius-full);
    transition: left 300ms cubic-bezier(0.4, 0, 0.2, 1),
                width 300ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    width: var(--indicator-width, 100px);
    box-shadow: 0 0 8px rgba(0, 162, 181, 0.4);
}

/* Tab buttons */
.tab-btn {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.tab-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--color-dark-teal);
    box-shadow: var(--shadow-xs);
    font-weight: 600;
}

[data-theme="dark"] .tab-btn.active {
    color: var(--color-cyan);
}

/* Eliminar el ::after anterior del indicador */
.tab-btn.active::after {
    display: none;
}

/* ========== CONTENIDO DE TABS CON SLIDE ========== */
.module {
    position: relative;
}

.tab-content {
    display: none;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.tab-content.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
    animation: slideInFromRight 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.prev {
    display: block;
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
}

.tab-content.next {
    display: block;
    opacity: 0;
    transform: translateX(20px);
    pointer-events: none;
}

/* Animación de entrada desde la derecha */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animación de entrada desde la izquierda */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Para tabs que van hacia la izquierda */
.tab-content.slide-left {
    animation: slideInFromLeft 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Para tabs que van hacia la derecha */
.tab-content.slide-right {
    animation: slideInFromRight 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== MEJORAS DE INMERSIÓN ========== */
.module {
    position: relative;
    overflow: hidden;
}

.module::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-cyan), var(--color-dark-teal));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.module.active::before {
    transform: scaleX(1);
}

/* Efecto de profundidad en el contenido activo */
.tab-content.active .card {
    animation: fadeInUp 400ms cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.tab-content.active .card:nth-child(1) {
    animation-delay: 50ms;
}

.tab-content.active .card:nth-child(2) {
    animation-delay: 100ms;
}

.tab-content.active .card:nth-child(3) {
    animation-delay: 150ms;
}

.tab-content.active .card:nth-child(4) {
    animation-delay: 200ms;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }
    
    .tabs::before {
        width: calc(100% / var(--tab-count-mobile, 2) - var(--space-xs) * 2);
    }
    
    .tab-content {
        position: relative;
    }
    
    .tab-content.prev,
    .tab-content.next {
        display: none;
    }
}

