/**
 * Sparkles Tabs Component Styles
 * Tabbed content interface for product details, account sections
 * Extends: sparkles-utilities.css, sparkles-animations.css, sparkles-tokens.css
 * All 3 optimization layers applied: keyframes consolidated, patterns extracted, component organization
 */

/* ========== TABS CONTAINER ========== */
.sparkles-tabs {
    display: flex;
    flex-direction: column;
    background-color: var(--gray-800);
    border-color: var(--gray-700);
    container-type: inline-size;
}

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

/* ========== TAB LIST ========== */
.sparkles-tab-list {
    display: flex;
    margin: 0;
    padding: 0;
    background-color: var(--gray-50);
    border-top-left-radius: .5rem;
    border-top-right-radius: .5rem;
    position: relative;
}

.sparkles-tabs-vertical .sparkles-tab-list {
    min-width: 240px;
    flex-direction: column;
    background-color: initial;
    border-radius: 0;
    border-right-width: 1px;
    border-color: var(--gray-200);
}

/* ========== TAB ITEMS ========== */
.sparkles-tab-item {
    flex: 1 1 0%;
}

.sparkles-tabs-vertical .sparkles-tab-item {
    flex: none;
    width: 100%;
}

.sparkles-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding-top: 1rem;
    padding-bottom: 1rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    background-color: initial;
    border-width: 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 500;
    color: var(--gray-600);
    transition-property: all;
    transition-duration: .2s;
    transition-timing-function: cubic-bezier(.4,0,.2,1);
    position: relative;
    border-radius: .375rem;
    gap: .5rem;
    user-select: none;
}

.sparkles-tab:hover {
    color: var(--color-primary);
    background-color: var(--color-primary);
    --tw-bg-opacity: 0.5;
}

.sparkles-tab:focus {
    outline-color: var(--color-primary);
    outline-offset: -2px;
    outline-width: 2px;
}

.sparkles-tab:disabled,
.sparkles-tab[aria-disabled="true"],
.sparkles-pagination-disabled .sparkles-pagination-link,
.sparkles-pagination-link:disabled,
.sparkles-dropdown-option-disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Active tab */
.sparkles-tab-active {
    color: var(--color-primary);
    --tw-bg-opacity: 1;
    background-color: rgba(255,255,255,var(--tw-bg-opacity,1));
    font-weight: 600;
    --tw-shadow: 0 1px 2px 0 #0000000d;
    --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
}

/* ========== TAB CONTENT ========== */
.sparkles-tab-content {
    min-height: 200px;
    padding: 1.5rem;
    --tw-bg-opacity: 1;
    background-color: rgba(255,255,255,var(--tw-bg-opacity,1));
    border-bottom-right-radius: .5rem;
    border-bottom-left-radius: .5rem;
}

.sparkles-tabs-vertical .sparkles-tab-content {
    border-top-right-radius: .5rem;
    border-bottom-right-radius: .5rem;
    flex: 1 1 0%;
}

.sparkles-tab-panel {
    animation: sparkles-fade-in 300ms ease-out; /* Using shared animation */ display: block; outline: 2px solid #0000; outline-offset: 2px;
}

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

/* sparkles-tab-fade-in replaced with sparkles-fade-in from sparkles-utilities.css */

/* ========== TAB VARIANTS ========== */

/* Pills variant */
.sparkles-tabs-pills .sparkles-tab-list {
    background-color: initial;
    gap: .5rem;
    padding: .5rem;
}

.sparkles-tabs-pills .sparkles-tab {
    border-radius: var(--radius-full);
    background-color: var(--gray-100);
}

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

.sparkles-tabs-pills .sparkles-tab:hover {
    background-color: var(--gray-200);
}

.sparkles-tabs-pills .sparkles-tab-active:hover {
    background-color: var(--color-primary);
}

/* Underline variant */
.sparkles-tabs-underline .sparkles-tab-list,
.sparkles-tabs-underline .sparkles-tab {
    background-color: initial;
    border-radius: 0;
    border-bottom-width: 2px;
}

.sparkles-tabs-underline .sparkles-tab-list {
    border-color: var(--gray-200);
}

.sparkles-tabs-underline .sparkles-tab {
    border-color: #0000;
}

.sparkles-tabs-underline .sparkles-tab:hover {
    background-color: var(--gray-50);
}

.sparkles-tabs-underline .sparkles-tab-active {
    border-bottom-color: var(--color-primary);
    background-color: initial;
    border-bottom-width: 2px;
    --tw-shadow: 0 0 #0000;
    --tw-shadow-colored: 0 0 #0000;
}

.sparkles-tabs-underline .sparkles-tab-content {
    border-radius: 0;
    background-color: initial;
    --tw-shadow: 0 0 #0000;
    --tw-shadow-colored: 0 0 #0000;
}

/* Luxury variant */
.sparkles-tabs-luxury {
    border-color: var(--color-primary);
    background: var(--gradient-premium);
    border-width: 1px;
    --tw-shadow: 0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;
    --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);
}

.sparkles-tabs-luxury .sparkles-tab-list {
    background-color: color-mix(in srgb, var(--color-accent) 80%, transparent);
}

.sparkles-tabs-luxury .sparkles-tab {
    color: var(--color-secondary);
    font-family: var(--font-display);
}

.sparkles-tabs-luxury .sparkles-tab:hover {
    background-color: var(--color-primary) bg-opacity-10;
}

.sparkles-tabs-luxury .sparkles-tab-active {
    background: var(--gradient-premium);
    color: var(--color-primary);
    --tw-shadow: 0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;
    --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);
}

/* ========== TAB ICONS AND BADGES ========== */
.sparkles-social-login-icon,
.sparkles-sidebar-icon,
.sparkles-tab-icon,
.sparkles-batch-icon,
.sparkles-dropdown-option-icon,
.sparkles-alert-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.sparkles-tab-badge {
    background-color: var(--color-secondary);
    min-width: 18px;
    --tw-text-opacity: 1;
    color: rgba(255,255,255,var(--tw-text-opacity,1));
    font-size: .75rem;
    line-height: 1rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    margin-left: .5rem;
    text-align: center;
}

.sparkles-tab-active .sparkles-tab-badge {
    background-color: var(--color-primary);
}

/* ========== RESPONSIVE DESIGN ========== */
@container (max-width: 768px) {
    .sparkles-tab-list {
        /* -webkit-overflow-scrolling: touch; removed - not needed for modern browsers */
        scrollbar-width: none; /* Firefox - no Tailwind equivalent */
        -ms-overflow-style: none; /* IE/Edge - no Tailwind equivalent */ overflow-x: auto;
    }
    
    .sparkles-tab-list::-webkit-scrollbar {
        display: none;
    }
    
    .sparkles-tab,
    .sparkles-table th,
    .sparkles-table td {
        padding-top: .75rem;
        padding-bottom: .75rem;
        padding-left: 1rem;
        padding-right: 1rem;
        font-size: .875rem;
        line-height: 1.25rem;
    }

    .sparkles-tab {
        white-space: nowrap;
    }
    
    .sparkles-tab-content {
        padding: 1rem;
    }
    
    /* Force horizontal on mobile for vertical tabs */
    .sparkles-tabs-vertical {
        flex-direction: column;
    }
    
    .sparkles-tabs-vertical .sparkles-tab-list {
        flex-direction: row;
        border-right-width: 0;
        border-bottom-width: 1px;
        border-color: var(--gray-200);
        min-width: 0;
    }
    
    .sparkles-tabs-vertical .sparkles-tab-content {
        border-bottom-right-radius: .5rem;
        border-bottom-left-radius: .5rem;
    }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    .sparkles-tab,
    .sparkles-tab-panel {
        transition-property: none;
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .sparkles-tab {
        border-width: 1px;
        border-style: solid;
    }
    
    .sparkles-tab:focus {
        outline-width: 3px;
    }
}

/* Focus visible only for keyboard */
.sparkles-tab:focus:not(:focus-visible) {
    outline: none;
}

/* ========== PRODUCT TABS SPECIFIC ========== */
.sparkles-product-tabs {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.sparkles-product-tabs .sparkles-tab-content {
    min-height: 300px;
}

/* Account tabs */
.sparkles-account-tabs .sparkles-tab-list {
    --tw-bg-opacity: 1;
    background-color: rgba(255,255,255,var(--tw-bg-opacity,1));
    border-width: 1px;
    border-color: var(--gray-200);
    border-bottom-width: 0;
}

.sparkles-account-tabs .sparkles-tab-content {
    border-width: 1px;
    border-color: var(--gray-200);
}

/* ========== ANIMATIONS ========== */
.sparkles-tab-slide-enter {
    animation: sparkles-tab-slide-in 300ms ease-out; /* Using tab-specific animation */
}

/* Loading state */
.sparkles-tabs-loading .sparkles-tab-content {
    position: relative;
    overflow: hidden;
}

.sparkles-tabs-loading .sparkles-tab-content::before {
    content: '';
    background: linear-gradient(
        90deg,
        transparent,
        rgba(198, 159, 50, 0.2),
        transparent
    ); /* Shimmer gradient - keep raw */
    animation: sparkles-loading-shimmer 1.5s infinite;
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
}

/* ========== PRINT STYLES ========== */
@media print {
    body .sparkles-tabs {
        flex-direction: column;
    }
    
    body .sparkles-tab-list {
        display: none;
    }
    
    body .sparkles-tab-panel {
        page-break-inside: avoid; /* Print CSS property - no Tailwind equivalent */
        display: block;
    }
    
    body .sparkles-tab-panel[hidden] {
        display: block;
    }
}
