/* ==========================================================================
   Tab Navigation Bar
   ========================================================================== */

.timu-tab-nav {
    background: #fff;
    position: relative;
    z-index: 10;
    /* No border as per design spec */
}

.tab-nav-scroll {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 0 16px;
    gap: 0;
}

.tab-nav-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tab-item {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 400;
    color: #666;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.tab-item:first-child {
    padding-left: 0;
}

.tab-item:hover {
    color: #333;
}

.tab-item.active {
    color: #000;
    font-weight: 700;
}

.tab-indicator {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: #000;
    border-radius: 1px;
    transition: width 0.2s ease;
}

.tab-item:first-child .tab-indicator {
    left: 0;
    transform: translateX(0);
}

.tab-item.active .tab-indicator {
    width: 16px; /* Short underline like Temu */
}

/* ==========================================================================
   Tab Content Container
   ========================================================================== */

.tab-content-container {
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.tab-content-wrapper {
    display: flex;
    transition: transform 0.3s ease-out;
    will-change: transform;
}

.tab-pane {
    flex: 0 0 100%;
    width: 100%;
    min-height: 50vh;
}

/* ==========================================================================
   Skeleton Loading
   ========================================================================== */

.tab-skeleton {
    padding: 12px;
    background: #f5f5f5;
    min-height: 100vh;
}

.skeleton-subcats {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    background: #fff;
    margin: -12px -12px 12px;
    padding: 12px;
}

.skeleton-subcat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    width: 48px;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.skeleton-product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    padding: 10px;
}

.skeleton-image {
    width: 100%;
    padding-top: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 10px;
}

.skeleton-title {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 8px;
    width: 80%;
}

.skeleton-price {
    height: 18px;
    width: 50%;
    border-radius: 4px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==========================================================================
   Subcategories
   ========================================================================== */

.tab-subcategories {
    padding: 12px 0;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.subcategories-scroll {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 12px;
    gap: 12px;
}

.subcategories-scroll::-webkit-scrollbar {
    display: none;
}

.subcategory-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    width: 56px;
}

.subcategory-item:hover {
    color: #000;
}

.subcategory-item.is-main .subcategory-image {
    border: 2px solid #000;
}

.subcategory-image {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #f5f5f5;
    margin-bottom: 6px;
}

.subcategory-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.subcategory-name {
    font-size: 11px;
    text-align: center;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.4em;
}

/* ==========================================================================
   Tab Products
   ========================================================================== */

.tab-products-section {
    padding: 12px;
    background: #f5f5f5;
    min-height: 300px;
}

.tab-product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 768px) {
    .tab-product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .tab-product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1280px) {
    .tab-product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.no-products-message {
    text-align: center;
    color: #666;
    padding: 48px 16px;
    font-size: 14px;
}

.tab-load-more {
    margin-top: 24px;
    text-align: center;
}

.tab-load-more .infinite-scroll-trigger {
    height: 1px;
    margin-bottom: 16px;
}

.tab-load-more .load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-load-more .load-more-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.tab-load-more .load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tab-load-more .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.tab-load-more .hidden {
    display: none !important;
}

.tab-load-more .products-count {
    margin-top: 12px;
    font-size: 13px;
    color: #666;
}

/* Error message style */
.error-message {
    text-align: center;
    color: #d63638;
    padding: 48px 16px;
    font-size: 14px;
}
