/* ViewPage Tabs - Standardized CSS Implementation */
/* Following VIEWPAGE-STANDARD.md specifications */

/* ============================================
   Tab Navigation Container
   ============================================ */
.vpt-navigation {
    position: relative;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #E2E8F0;
}

.vpt-scroll-container {
    display: flex;
    align-items: center;
    position: relative;
}

.vpt-scroll-area {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.vpt-nav {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.vpt-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* ============================================
   Individual Tab Buttons
   ============================================ */
.vpt-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
    font-weight: 500;
    font-size: 0.9rem;
    color: #64748B;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: fit-content;
}

.vpt-tab:hover {
    background: #F8FAFC;
    color: #334155;
    border-color: #E2E8F0;
}

.vpt-tab:focus {
    outline: 2px solid #3B82F6;
    outline-offset: -2px;
    z-index: 1;
}

.vpt-tab:focus:not(:focus-visible) {
    outline: none;
}

.vpt-tab:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: -2px;
    z-index: 1;
}

/* Active Tab State */
.vpt-tab--active,
.vpt-tab.active {
    background: #FFFFFF;
    color: #3B82F6;
    border-color: #E2E8F0;
    border-bottom-color: #FFFFFF;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.vpt-tab--active::after,
.vpt-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #3B82F6;
    border-radius: 1px 1px 0 0;
}

/* ============================================
   Tab Label and Count
   ============================================ */
.vpt-label {
    font-size: inherit;
    font-weight: inherit;
}

.vpt-count {
    font-size: 0.8rem;
    color: #64748B;
    font-weight: 500;
    background: #F1F5F9;
    padding: 0.125rem 0.375rem;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.vpt-tab--active .vpt-count,
.vpt-tab.active .vpt-count {
    background: #EBF4FF;
    color: #3B82F6;
}

/* ============================================
   Scroll Controls
   ============================================ */
.vpt-controls {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.vpt-scroll-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.vpt-scroll-btn:hover:not(:disabled) {
    background: #F1F5F9;
    color: #334155;
    border-color: #CBD5E1;
}

.vpt-scroll-btn:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

.vpt-scroll-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.vpt-scroll-btn i {
    font-size: 0.8rem;
}

/* ============================================
   Tab Content Areas
   ============================================ */
.vpt-content {
    position: relative;
    min-height: 200px;
}

.vpt-panel {
    display: none;
    animation: vptFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vpt-panel--active,
.vpt-panel.active {
    display: block;
}

@keyframes vptFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tab Content Header */
.vpt-content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #F1F5F9;
}

.vpt-content-summary h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1E293B;
}

.vpt-content-summary-text {
    margin: 0;
    color: #64748B;
    font-size: 0.9rem;
}

.vpt-content-actions {
    flex-shrink: 0;
    margin-left: 1rem;
}

/* Tab Loading State */
.vpt-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #64748B;
    font-size: 0.9rem;
}

.vpt-loading .spinner-border-sm {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet (768px-1199px) */
@media (max-width: 1199px) {
    .vpt-tab {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .vpt-count {
        font-size: 0.75rem;
        padding: 0.125rem 0.3125rem;
    }
    
    .vpt-controls {
        margin-left: 0.375rem;
    }
    
    .vpt-content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .vpt-content-actions {
        margin-left: 0;
        width: 100%;
    }
    
    .vpt-content-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile (≤767px) */
@media (max-width: 767px) {
    .vpt-navigation {
        margin-bottom: 1rem;
    }
    
    .vpt-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-width: auto;
    }
    
    /* Hide labels on mobile, show only counts */
    .vpt-label {
        display: none;
    }
    
    .vpt-count {
        font-size: 0.7rem;
        min-width: 20px;
        padding: 0.125rem 0.25rem;
    }
    
    /* Show full labels on active tab */
    .vpt-tab--active .vpt-label,
    .vpt-tab.active .vpt-label {
        display: inline;
    }
    
    .vpt-scroll-btn {
        width: 28px;
        height: 28px;
    }
    
    .vpt-scroll-btn i {
        font-size: 0.7rem;
    }
    
    /* Make tabs swipeable on touch devices */
    .vpt-nav {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .vpt-tab {
        scroll-snap-align: start;
    }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
    .vpt-tab {
        padding: 0.4375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    .vpt-count {
        font-size: 0.65rem;
        min-width: 18px;
        padding: 0.0625rem 0.1875rem;
    }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .vpt-tab,
    .vpt-count,
    .vpt-scroll-btn {
        transition: none;
    }
    
    .vpt-panel {
        animation: none;
    }
    
    .vpt-nav {
        scroll-behavior: auto;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .vpt-tab {
        border-color: #000000;
    }
    
    .vpt-tab--active,
    .vpt-tab.active {
        background: #FFFFFF;
        border-color: #000000;
        color: #000000;
    }
    
    .vpt-tab--active::after,
    .vpt-tab.active::after {
        background: #000000;
    }
    
    .vpt-count {
        background: #FFFFFF;
        border: 1px solid #000000;
        color: #000000;
    }
    
    .vpt-scroll-btn {
        border-color: #000000;
        background: #FFFFFF;
        color: #000000;
    }
}

/* Focus indicators for better accessibility */
.vpt-tab:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

.vpt-scroll-btn:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}