/* ECS Tabs Wrapper - Main container */
.ecs-tabs-wrapper {
    margin: 20px 0;
    /* CSS Custom Properties for dynamic colors */
    --active-color: #ff6b35; /* Default orange */
}

/* Color Variants */
.ecs-tabs-wrapper[data-active-color="orange"] { --active-color: #ff6b35; }
.ecs-tabs-wrapper[data-active-color="blue"] { --active-color: #007cba; }
.ecs-tabs-wrapper[data-active-color="green"] { --active-color: #46b450; }
.ecs-tabs-wrapper[data-active-color="purple"] { --active-color: #6f42c1; }

/* Tab Navigation Wrapper - separate from table */
.ecs-tabs-navigation-wrapper {
    background: transparent;
    margin-bottom: 20px;
    padding: 10px 0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
}

/* Tab Navigation */
.ecs-tabs-wrapper .ecs-tab-navigation {
    display: inline-flex;
    background: transparent;
    border: none;
    margin: 0 auto;
    padding: 0;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.ecs-tabs-wrapper .ecs-tab-btn {
    background: #f8f9fa;
    border: none;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 8px;
    white-space: nowrap;
    min-width: auto;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover effect - turn orange */
.ecs-tabs-wrapper .ecs-tab-btn:hover:not(.active) {
    background: #ff6b35;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

/* Active tab gets the dynamic color */
.ecs-tabs-wrapper .ecs-tab-btn.active {
    color: #fff;
    background: var(--active-color);
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

/* Table Container - separate white container for tables */
.ecs-tabs-wrapper .ecs-tabs-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Tab Content */
.ecs-tabs-wrapper .ecs-tab-content {
    padding: 0;
    background: #fff;
    min-height: 200px;
}

.ecs-tabs-wrapper .ecs-tab-pane {
    display: none;
    padding: 0;
    animation: fadeIn 0.3s ease-in-out;
}

.ecs-tabs-wrapper .ecs-tab-pane.active {
    display: block;
}

/* During processing phase, show all tab panes to ensure proper shortcode processing */
.ecs-tabs-wrapper.ecs-tabs-processing .ecs-tab-pane {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    height: auto !important;
    overflow: visible !important;
}

/* Hide inactive tabs only after processing is complete */
.ecs-tabs-wrapper:not(.ecs-tabs-processing) .ecs-tab-pane:not(.active) {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ensure nested content works properly */
.ecs-tabs-wrapper .ecs-tab-pane > * {
    margin-top: 0;
}

.ecs-tabs-wrapper .ecs-tab-pane > *:last-child {
    margin-bottom: 0;
}

/* Style for filtered tables inside tabs - hide the header with filter info */
.ecs-tabs-wrapper .ecs-filtered-container {
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
}

/* Hide the filtered header completely in tabs context */
.ecs-tabs-wrapper .ecs-filtered-header {
    display: none !important;
}

/* Override filter description to be completely hidden */
.ecs-tabs-wrapper .ecs-filter-description {
    display: none !important;
}

/* Table styling within tabs */
.ecs-tabs-wrapper table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: #fff;
}

.ecs-tabs-wrapper table th {
    padding: 12px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ecs-tabs-wrapper table td {
    padding: 12px;
    border-bottom: 1px solid #f1f3f4;
    color: #495057;
    font-size: 14px;
    vertical-align: middle;
}

.ecs-tabs-wrapper table tbody tr {
    transition: background-color 0.2s ease;
}

.ecs-tabs-wrapper table tbody tr:hover {
    background-color: #f8f9fa;
}

.ecs-tabs-wrapper table tbody tr:last-child td {
    border-bottom: none;
}

/* RFQ functionality preservation */
.ecs-tabs-wrapper .ecs-rfq-cell {
    width: 120px;
    text-align: center;
    padding: 8px !important;
}

.ecs-tabs-wrapper .ecs-rfq-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--active-color);
}

.ecs-tabs-wrapper .ecs-quantity-controls {
    display: none !important;
    margin-top: 8px;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.ecs-tabs-wrapper .ecs-quantity-controls.show {
    display: flex !important;
}

/* Alternative: using style attribute override */
.ecs-tabs-wrapper .ecs-quantity-controls[style*="display: flex"],
.ecs-tabs-wrapper .ecs-quantity-controls[style*="display:flex"] {
    display: flex !important;
}

.ecs-tabs-wrapper .ecs-quantity-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ecs-tabs-wrapper .ecs-quantity-btn:hover {
    background: #f8f9fa;
    border-color: var(--active-color);
}

.ecs-tabs-wrapper .ecs-quantity-input {
    width: 45px;
    height: 24px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    padding: 0 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ecs-tabs-wrapper .ecs-tab-navigation {
        flex-direction: column;
        gap: 2px;
    }

    .ecs-tabs-wrapper .ecs-tab-btn {
        flex: none;
        min-width: auto;
        padding: 12px 20px;
    }
    
    .ecs-tabs-wrapper .ecs-tab-pane {
        padding: 15px;
    }
    
    .ecs-tabs-wrapper .ecs-filtered-header {
        margin: -15px -15px 15px -15px;
        padding: 12px 15px;
    }
    
    .ecs-tabs-wrapper table th,
    .ecs-tabs-wrapper table td {
        padding: 8px;
        font-size: 12px;
    }
    
    .ecs-tabs-wrapper .ecs-rfq-cell {
        width: 100px;
        padding: 6px !important;
    }
}

@media (max-width: 480px) {
    .ecs-tabs-wrapper {
        margin: 10px -15px;
    }
    
    .ecs-tabs-wrapper .ecs-tabs-container {
        border-radius: 0;
    }
    
    .ecs-tabs-wrapper .ecs-tab-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .ecs-tabs-wrapper .ecs-tab-pane {
        padding: 10px;
    }
    
    .ecs-tabs-wrapper table th,
    .ecs-tabs-wrapper table td {
        padding: 6px;
        font-size: 11px;
    }
}

/* Loading state for content within tabs */
.ecs-tabs-wrapper .ecs-loading {
    padding: 40px;
    text-align: center;
    color: #6c757d;
    font-size: 16px;
}

.ecs-tabs-wrapper .ecs-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--active-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination within tabs */
.ecs-tabs-wrapper .ecs-pagination {
    padding: 15px 0;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin: 20px -20px -20px -20px;
}

.ecs-tabs-wrapper .ecs-pagination-links {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.ecs-tabs-wrapper .ecs-page-link {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ecs-tabs-wrapper .ecs-page-link:hover {
    background: var(--active-color);
    color: #fff;
    border-color: var(--active-color);
}

.ecs-tabs-wrapper .ecs-current-page {
    padding: 8px 12px;
    background: var(--active-color);
    color: #fff;
    border: 1px solid var(--active-color);
    border-radius: 4px;
    font-weight: 600;
}

.ecs-tabs-wrapper .ecs-pagination-info {
    text-align: center;
    margin-bottom: 15px;
    color: #6c757d;
    font-size: 14px;
}

/* 
  Re-styled CSS to match the original "button" look.
  This targets the new structure: .ecs-simple-tabs-container > .ecs-simple-tabs-nav > li > a
*/

.ecs-simple-tabs-container {
    margin: 20px 0;
    --active-color: #ff6b35; /* Default orange */
}

/* Color Variants from data attribute */
.ecs-simple-tabs-container[data-active-color="orange"] { --active-color: #ff6b35; }
.ecs-simple-tabs-container[data-active-color="blue"] { --active-color: #007cba; }
.ecs-simple-tabs-container[data-active-color="green"] { --active-color: #46b450; }
.ecs-simple-tabs-container[data-active-color="purple"] { --active-color: #6f42c1; }

.ecs-simple-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    list-style: none !important;
    list-style-type: none !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 4px; /* Space between buttons */
    justify-content: center; /* Center the tab buttons */
}

.ecs-simple-tabs-nav li {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    list-style-type: none !important;
}

.ecs-simple-tabs-nav li::before,
.ecs-simple-tabs-nav li::after {
    content: none !important;
    display: none !important;
}

/* Additional bullet point removal for themes that force bullet styles */
.ecs-simple-tabs-nav li,
.ecs-simple-tabs-nav li:before,
.ecs-simple-tabs-nav li:after {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    background-image: none !important;
}

/* Override any theme-specific list styling */
ul.ecs-simple-tabs-nav,
ul.ecs-simple-tabs-nav li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    background-image: none !important;
    text-indent: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.ecs-simple-tabs-nav a {
    display: block;
    padding: 8px 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    background: #f8f9fa;
    color: #6c757d;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* Hover effect */
.ecs-simple-tabs-nav a:hover {
    background: #e9ecef;
    color: #343a40;
}

/* Active tab style */
.ecs-simple-tabs-nav li.active a {
    background-color: var(--active-color);
    color: #fff;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Tab Content Styling */
.ecs-simple-tabs-content {
    padding-top: 20px;
}

.ecs-simple-tab-pane {
    display: none;
}

.ecs-simple-tab-pane.active {
    display: block;
    animation: fadeIn 0.4s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Container for Tab Content */
.ecs-simple-tabs-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.ecs-simple-tabs-content {
    width: 100% !important;
    overflow-x: auto !important;
    box-sizing: border-box !important;
}

.ecs-simple-tab-pane {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Ensure tables inside look good and are responsive */
.ecs-simple-tab-pane table {
    width: 100% !important;
    border-collapse: collapse;
    table-layout: auto !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.ecs-simple-tab-pane th,
.ecs-simple-tab-pane td {
    padding: 12px;
    border: 1px solid #e0e0e0;
    text-align: left;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 200px; /* Prevent extremely wide columns */
}

.ecs-simple-tab-pane th {
    background-color: #f9f9f9;
    font-weight: 600;
}

/* WordPress Block Editor and Page Builder Compatibility */
.wp-block .ecs-simple-tabs-container,
.vc_row .ecs-simple-tabs-container,
.vc_column .ecs-simple-tabs-container,
.vc_column_container .ecs-simple-tabs-container,
.wpb_column .ecs-simple-tabs-container,
.elementor-widget .ecs-simple-tabs-container,
.et_pb_module .ecs-simple-tabs-container {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* WPBakery specific fixes */
.vc_row .ecs-simple-tabs-container table,
.vc_column .ecs-simple-tabs-container table,
.wpb_column .ecs-simple-tabs-container table {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Fix potential WPBakery column width issues */
.vc_col-sm-12 .ecs-simple-tabs-container,
.vc_col-md-12 .ecs-simple-tabs-container,
.vc_col-lg-12 .ecs-simple-tabs-container {
    width: 100% !important;
}

/* Special handling for filtered content inside tabs */
.ecs-simple-tab-pane .ecs-filtered-container,
.ecs-simple-tab-pane .ecs-results-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.ecs-simple-tab-pane .ecs-filtered-table,
.ecs-simple-tab-pane .ecs-result-table {
    width: 100% !important;
    table-layout: auto !important;
}

/* RFQ Column specific width control */
.ecs-simple-tab-pane .ecs-rfq-cell {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .ecs-simple-tab-pane th,
    .ecs-simple-tab-pane td {
        padding: 8px 4px;
        font-size: 12px;
        max-width: 120px;
    }
    
    .ecs-simple-tab-pane .ecs-rfq-cell {
        width: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
    }
} 