/* Tabs Container */
.tabs-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 3rem;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 0.1rem;
    /* Tighter gap as requested */
    justify-content: center;
    /* Center tabs by default if space permits */
    /* Hide scrollbar Firefox */
}

.tabs-nav::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.tab-btn {
    font-family: inherit;
    padding: 1.5rem 2rem;
    border: none;
    background: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
    white-space: nowrap;
    position: relative;
    border-bottom: 3px solid transparent;
    flex-shrink: 0;
    /* Prevent tabs from shrinking */
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

/* Active State with "Personality" - Bottom Border Slide */
.tab-btn.active {
    /* Fixed Shift: Removed text-shadow to prevent visual shift */
    /* font-weight: 700; Removed to prevent jump */
    /* text-shadow removed to prevent shift */
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: white;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 3rem;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animated Chart */
.chart-container {
    margin-top: 5rem;
    padding: 2rem;
    background: transparent;
    border-radius: var(--radius-md);
    position: relative;
    /* Ensure z-index context */
}

.chart-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--secondary);
    font-size: 1.5rem;
    font-weight: 700;
}

.bar-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 300px;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 15%;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}

.bar {
    width: 100%;
    background: linear-gradient(to top, var(--primary), var(--secondary));
    border-radius: 8px 8px 0 0;
    transition: height 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    height: 0;
    /* Start at 0 for animation */
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.bar-label {
    margin-top: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9rem;
    text-align: center;
}

.bar-value {
    position: absolute;
    left: 0;
    bottom: 100%;
    width: 100%;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.5s ease 1s;
    /* Delay value appearance */
    z-index: 100;
    padding-bottom: 10px;
    /* Space between bar and value */
    white-space: nowrap;
}

/* Animation Trigger Class */
.animate-chart .bar {
    /* Height is set inline or via JS, this class just triggers/allows transition if needed, 
       but actually CSS transition works on property change. 
       We will set height via JS to trigger animation. */
}

.animate-chart .bar-value {
    opacity: 1;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .tabs-nav {
        justify-content: flex-start;
        gap: 0.1rem;
        /* Reduced spacing for mobile to keep tabs closer */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll */
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
    }

    .tabs-nav::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar Chrome/Safari */
    }

    .tab-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .tab-content {
        padding: 1.5rem;
    }

    .tab-content-grid {
        grid-template-columns: 1fr !important;
        /* Force stack on mobile */
        gap: 3rem !important;
    }

    .chart-container {
        width: 100%;
        margin-top: 3rem;
        padding: 1.5rem;
    }

    .bar-chart {
        height: 250px;
        /* Slightly shorter on mobile */
    }

    .bar-group {
        width: 18%;
        /* Slightly wider bars on mobile */
    }

    .bar-value {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
}

/* Grid Layout for Tab Content */
.tab-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    text-align: left;
    align-items: center;
}