/**
 * Tabs Component Styles
 * Provides styling for tab navigation and content panels
 */

.tabs-container {
    position: relative;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.tabs-vertical {
    flex-direction: row;
}

.tabs-nav {
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    background-color: #fff;
}

.tabs-vertical .tabs-nav {
    flex-direction: column;
    align-items: stretch;
    border-bottom: none;
    border-right: 1px solid #e9ecef;
    min-width: 200px;
}

.tabs-list {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

.tabs-vertical .tabs-list {
    flex-direction: column;
    align-items: stretch;
    overflow-x: visible;
    overflow-y: auto;
}

.tabs-centered .tabs-list {
    justify-content: center;
}

/* Tab Items */
.tab-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 0;
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
    min-height: 44px;
    border-radius: 0;
}

.tab-item:hover {
    color: #1890ff;
    background-color: #f0f8ff;
}

.tab-item:focus {
    outline: 2px solid #1890ff;
    outline-offset: -2px;
}

.tab-item:focus-visible {
    outline: 2px solid #1890ff;
    outline-offset: -2px;
}

.tab-active {
    color: #1890ff !important;
    background-color: transparent;
}

.tab-disabled {
    color: #ccc !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.tab-disabled:hover {
    color: #ccc !important;
    background-color: transparent !important;
}

.tab-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-label {
    display: flex;
    align-items: center;
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background-color: #ff4d4f;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    border-radius: 9px;
    line-height: 1;
}

.tab-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 6px;
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

.tab-item:hover .tab-close,
.tab-active .tab-close {
    opacity: 1;
    transform: scale(1);
}

.tab-close:hover {
    color: #ff4d4f;
    background-color: #fff2f0;
}

.tab-close:focus {
    outline: 1px solid #1890ff;
    outline-offset: 1px;
}

/* Add Button */
.tabs-add-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: 8px;
    background: none;
    border: 1px dashed #d9d9d9;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.tabs-add-button:hover {
    color: #1890ff;
    border-color: #1890ff;
    background-color: #f0f8ff;
}

.tabs-add-button:focus {
    outline: 2px solid #1890ff;
    outline-offset: 2px;
}

.tabs-add-icon {
    font-size: 14px;
    font-weight: bold;
}

.tabs-vertical .tabs-add-button {
    margin-left: 0;
    margin-top: 8px;
    width: calc(100% - 16px);
    margin-left: 8px;
    margin-right: 8px;
}

/* Active Indicator */
.tabs-indicator {
    position: absolute;
    background-color: #1890ff;
    transition: all 0.3s ease;
    z-index: 1;
}

.tabs-horizontal .tabs-indicator {
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

.tabs-vertical .tabs-indicator {
    right: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
}

/* Tab Content */
.tabs-content {
    position: relative;
    flex: 1;
    padding: 16px;
    background-color: #fff;
}

.tabs-vertical .tabs-content {
    border-left: 1px solid #e9ecef;
}

.tab-panel {
    display: block;
    outline: none;
}

.tab-panel[hidden] {
    display: none;
}

/* Animations */
.tabs-animated .tab-panel {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tabs-animated .tab-panel:not(.tab-panel-active) {
    opacity: 0;
    transform: translateX(10px);
}

.tabs-animated .tab-panel-active {
    opacity: 1;
    transform: translateX(0);
}

/* Size Variations */
.tabs-small .tab-item {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
}

.tabs-small .tabs-content {
    padding: 12px;
}

.tabs-small .tab-badge {
    min-width: 16px;
    height: 16px;
    font-size: 10px;
}

.tabs-large .tab-item {
    padding: 16px 24px;
    font-size: 16px;
    min-height: 52px;
}

.tabs-large .tabs-content {
    padding: 24px;
}

.tabs-large .tab-badge {
    min-width: 20px;
    height: 20px;
    font-size: 12px;
}

/* Variant Styles */

/* Card Variant */
.tabs-card .tabs-nav {
    border-bottom: none;
    background-color: #f5f5f5;
    padding: 4px;
    border-radius: 6px;
}

.tabs-card .tab-item {
    border-radius: 4px;
    margin: 0 2px;
    background-color: transparent;
}

.tabs-card .tab-active {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tabs-card .tabs-indicator {
    display: none;
}

.tabs-card .tabs-content {
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 6px 6px;
}

.tabs-card.tabs-vertical .tabs-content {
    border-top: 1px solid #e9ecef;
    border-left: none;
    border-radius: 0 6px 6px 0;
}

/* Pill Variant */
.tabs-pill .tab-item {
    border-radius: 20px;
    margin: 0 4px;
    background-color: transparent;
}

.tabs-pill .tab-active {
    background-color: #1890ff;
    color: #fff !important;
}

.tabs-pill .tab-active:hover {
    background-color: #40a9ff;
    color: #fff !important;
}

.tabs-pill .tabs-indicator {
    display: none;
}

.tabs-pill .tabs-nav {
    border-bottom: 1px solid #e9ecef;
    padding: 4px 0;
}

/* Underline Variant (Default) */
.tabs-underline .tab-item {
    border-bottom: 2px solid transparent;
}

.tabs-underline .tab-active {
    border-bottom-color: #1890ff;
}

.tabs-underline .tabs-indicator {
    display: none;
}

/* Dark Theme */
.tabs-dark {
    background-color: #001529;
    color: rgba(255, 255, 255, 0.85);
}

.tabs-dark .tabs-nav {
    border-color: #303030;
    background-color: #001529;
}

.tabs-dark .tab-item {
    color: rgba(255, 255, 255, 0.65);
}

.tabs-dark .tab-item:hover {
    color: rgba(255, 255, 255, 0.85);
    background-color: rgba(255, 255, 255, 0.1);
}

.tabs-dark .tab-active {
    color: #1890ff !important;
}

.tabs-dark .tabs-content {
    background-color: #001529;
    border-color: #303030;
}

.tabs-dark .tabs-add-button {
    border-color: #303030;
    color: rgba(255, 255, 255, 0.65);
}

.tabs-dark .tabs-add-button:hover {
    color: #1890ff;
    border-color: #1890ff;
    background-color: rgba(24, 144, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .tabs-container {
        overflow-x: auto;
    }
    
    .tabs-list {
        overflow-x: auto;
        scrollbar-width: thin;
        -ms-overflow-style: auto;
    }
    
    .tabs-list::-webkit-scrollbar {
        display: block;
        height: 4px;
    }
    
    .tabs-list::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .tabs-list::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 2px;
    }
    
    .tabs-list::-webkit-scrollbar-thumb:hover {
        background: #999;
    }
    
    .tab-item {
        padding: 12px 16px;
        min-width: 80px;
    }
    
    .tabs-content {
        padding: 12px;
    }
    
    .tabs-vertical {
        flex-direction: column;
    }
    
    .tabs-vertical .tabs-nav {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        min-width: auto;
    }
    
    .tabs-vertical .tabs-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: visible;
    }
    
    .tabs-vertical .tabs-content {
        border-left: none;
        border-top: 1px solid #e9ecef;
    }
}

@media (max-width: 480px) {
    .tab-item {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 60px;
    }
    
    .tabs-content {
        padding: 8px;
    }
    
    .tab-badge {
        min-width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

/* Accessibility Improvements */
.tab-item:focus-visible {
    outline: 2px solid #1890ff;
    outline-offset: -2px;
}

.tab-panel:focus {
    outline: 2px solid #1890ff;
    outline-offset: -2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .tabs-nav {
        border-bottom: 2px solid;
    }
    
    .tab-item {
        border: 1px solid;
    }
    
    .tab-active {
        border-color: currentColor;
        background-color: ButtonFace;
    }
    
    .tabs-indicator {
        background-color: currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .tab-item,
    .tabs-indicator,
    .tab-panel,
    .tab-close,
    .tabs-add-button {
        transition: none;
    }
    
    .tabs-animated .tab-panel {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .tabs-nav {
        display: none;
    }
    
    .tab-panel {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .tab-panel:not(.tab-panel-active) {
        page-break-before: always;
    }
}

/* Loading State */
.tabs-loading {
    opacity: 0.6;
    pointer-events: none;
}

.tabs-loading .tab-item::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: 2px solid #1890ff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: tabs-spin 1s linear infinite;
}

@keyframes tabs-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollable tabs indicator */
.tabs-list-scrollable {
    position: relative;
}

.tabs-list-scrollable::before,
.tabs-list-scrollable::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.8), transparent);
    pointer-events: none;
    z-index: 2;
}

.tabs-list-scrollable::before {
    left: 0;
}

.tabs-list-scrollable::after {
    right: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.8), transparent);
}