/**
 * AUTOCORE360 Admin Panel - Tabs
 * Tab navigation, tab content, tab variants
 */

/* ============ TABS ============ */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

/* Tabs wrapper for scrollable indicator */
.tabs-wrapper {
    position: relative;
}

.tabs-wrapper::before,
.tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 24px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast) ease;
}

.tabs-wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--surface), transparent);
}

.tabs-wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--surface), transparent);
}

.tabs-wrapper.scroll-left::before,
.tabs-wrapper.scroll-right::after {
    opacity: 1;
}

.tab {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast) ease, background var(--transition-fast) ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-shrink: 0;
}

.tab i {
    font-size: 0.8125rem;
    opacity: 0.7;
    transition: opacity var(--transition-fast) ease;
}

.tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.tab:hover i {
    opacity: 1;
}

.tab.active {
    color: var(--primary);
    font-weight: 600;
}

.tab.active i {
    opacity: 1;
}

/* Animated underline indicator */
.tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    border-radius: 2px 2px 0 0;
    transition: width var(--transition-normal) var(--ease-out), left var(--transition-normal) var(--ease-out);
}

.tab.active::after {
    left: 0;
    width: 100%;
}

/* Tab with badge/count */
.tab .tab-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    background: var(--surface-hover);
    color: var(--text-muted);
    border-radius: var(--radius-full);
    min-width: 1.25rem;
    text-align: center;
    transition: background var(--transition-fast) ease, color var(--transition-fast) ease;
}

.tab.active .tab-badge {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

/* Tab variants */
.tabs.tabs-pills {
    border-bottom: none;
    gap: 0.5rem;
    background: var(--surface-hover);
    padding: 0.375rem;
    border-radius: var(--radius-lg);
    width: fit-content;
}

.tabs.tabs-pills .tab {
    border-radius: var(--radius);
    padding: 0.625rem 1.25rem;
    transition: var(--transition);
}

.tabs.tabs-pills .tab::after {
    display: none;
}

.tabs.tabs-pills .tab:hover {
    transform: var(--hover-lift-sm);
}

.tabs.tabs-pills .tab.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-primary);
}

.tabs.tabs-pills .tab.active:hover {
    transform: none;
}

/* Vertical tabs */
.tabs.tabs-vertical {
    flex-direction: column;
    border-bottom: none;
    border-right: 1px solid var(--border);
    margin-bottom: 0;
    margin-right: 1.5rem;
    gap: 0.25rem;
}

.tabs.tabs-vertical .tab {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    text-align: left;
    justify-content: flex-start;
}

.tabs.tabs-vertical .tab::after {
    left: auto;
    right: -1px;
    top: 50%;
    bottom: auto;
    width: 2px;
    height: 0;
    border-radius: 2px 0 0 2px;
}

.tabs.tabs-vertical .tab.active::after {
    top: 0;
    height: 100%;
}

.tab-content {
    display: none;
    animation: tabFadeIn var(--transition-normal) ease;
}

.tab-content.active {
    display: block;
}

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

/* Mobile responsive tabs */
@media (max-width: 640px) {
    .tabs {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .tab {
        padding: 0.75rem 1rem;
    }
}
