/* Table Display Styles */
.ecs-results-container {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1 !important; /* LOW z-index so autocompletion can appear above */
    position: relative !important; /* Ensure z-index works */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.ecs-results-content {
    background: #fff;
    padding: 15px;
    border-radius: 5px;
}

.ecs-full-result-item {
    margin-bottom: 20px;
    padding: 0;
    background: transparent;
    border-radius: 4px;
}

.ecs-full-result-item:last-child {
    margin-bottom: 0;
}

.ecs-result-table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    table-layout: fixed !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
}

.ecs-result-table th {
    background: #f1f1f1;
    border: 1px solid #ddd;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.ecs-result-table td {
    border: 1px solid #ddd;
    padding: 10px 8px;
    vertical-align: top;
    word-wrap: break-word;
    /* Remove fixed max-width to allow flexible sizing */
}

.ecs-result-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.ecs-result-table tbody tr:hover {
    background-color: #f5f5f5;
}

/* RFQ Column Styles - Use available space properly */
.ecs-rfq-cell,
.ecs-filtered-table .ecs-rfq-cell,
.ecs-result-table .ecs-rfq-cell,
table .ecs-rfq-cell,
tbody .ecs-rfq-cell,
tr .ecs-rfq-cell {
    text-align: center !important;
    width: 200px !important;
    min-width: 200px !important;
    max-width: 200px !important;
    padding: 8px 4px !important;
    white-space: nowrap !important;
    display: table-cell !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    position: relative !important;
    height: auto !important;
    z-index: 10 !important;
}

/* For extremely narrow containers, allow controlled wrapping */
@container (max-width: 140px) {
    .ecs-rfq-cell-content {
        flex-direction: column !important;
        gap: 2px !important;
        padding: 2px !important;
    }
}

/* RFQ cell content wrapper for optimal alignment in available space */
.ecs-rfq-cell-content {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 40px !important;
    position: relative !important;
    box-sizing: border-box !important;
    flex-wrap: nowrap !important;
    padding: 4px !important;
    overflow: visible !important;
    z-index: 15 !important;
    margin: 0 !important;
}

.ecs-rfq-checkbox {
    margin: 0;
    vertical-align: middle;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    appearance: none;
    background-color: white;
    border: 1px solid #333;
    border-radius: 3px;
    cursor: pointer;
    position: relative !important;
    z-index: 20 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

.ecs-rfq-checkbox:checked {
    background-color: white;
    border-color: #333;
}

.ecs-rfq-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff6b35;
    font-size: 12px;
    font-weight: bold;
}

.ecs-quantity-controls {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    margin: 0 !important;
    vertical-align: middle;
    flex-shrink: 0;
    position: relative !important;
    z-index: 20 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    max-width: none !important;
}

.ecs-rfq-icon-container {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    flex-shrink: 0;
    cursor: pointer;
    position: relative !important;
    z-index: 20 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

.ecs-rfq-icon {
    width: 22px !important;
    height: 22px !important;
    cursor: pointer;
    transition: opacity 0.2s ease;
    border-radius: 3px;
    display: block;
    margin: 0 !important;
    position: relative !important;
    z-index: 20 !important;
    overflow: visible !important;
}

.ecs-rfq-icon:hover {
    opacity: 0.8;
}

.ecs-quantity-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #333;
    background: #fff;
    cursor: pointer;
    border-radius: 2px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    position: relative !important;
    z-index: 20 !important;
    overflow: visible !important;
    padding: 0;
    line-height: 1;
}

.ecs-quantity-btn:hover {
    background: #f0f0f0;
    border-color: #000;
}

.ecs-quantity-input {
    width: 36px;
    height: 22px;
    text-align: center;
    border: 1px solid #333;
    border-radius: 2px;
    font-size: 11px;
    background-color: white;
    color: #333;
    position: relative !important;
    z-index: 20 !important;
    overflow: visible !important;
    padding: 0;
    box-sizing: border-box;
    -moz-appearance: textfield; /* Firefox */
}

/* Hide spinner arrows in Chrome, Safari, Edge */
.ecs-quantity-input::-webkit-outer-spin-button,
.ecs-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* No Results Style */
.ecs-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* WPBakery handles responsiveness */

/* Scrollable table for very wide content */
.ecs-results-content {
    overflow-x: auto;
}

/* Pagination Styles (if not already in search.css) */
.ecs-pagination {
    margin: 20px 0;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.ecs-pagination-info {
    margin-right: 20px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.ecs-pagination-btn {
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 40px;
}

.ecs-pagination-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.ecs-pagination-btn.active {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
}

.ecs-pagination-btn.active:hover {
    background: #005a87;
    border-color: #005a87;
}

.ecs-pagination-dots {
    padding: 8px 4px;
    color: #999;
    font-size: 14px;
}

.ecs-error {
    color: #dc3545;
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

/* WPBakery handles responsiveness via column settings */



/* Filtered data display styles */
.ecs-filtered-container {
    margin: 20px 0;
    z-index: 1 !important; /* LOW z-index so autocompletion can appear above */
    position: relative !important; /* Ensure z-index works */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

.ecs-filtered-content {
    margin-bottom: 20px;
}

.ecs-filtered-table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #ddd;
    table-layout: fixed !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
}

.ecs-filtered-table th,
.ecs-filtered-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ecs-filtered-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #333;
}

.ecs-filtered-table tr:hover {
    background-color: #f9f9f9;
}

.ecs-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.ecs-error {
    text-align: center;
    padding: 20px;
    color: #d32f2f;
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
}

/* Pagination styles */
.ecs-pagination {
    text-align: center;
    margin-top: 20px;
}

.ecs-pagination-info {
    margin-bottom: 10px;
    color: #666;
    font-size: 14px;
}

.ecs-pagination-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ecs-page-link {
    display: inline-block;
    padding: 8px 12px;
    background-color: #f5f5f5;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.ecs-page-link:hover {
    background-color: #e0e0e0;
    color: #000;
    text-decoration: none;
}

.ecs-current-page {
    display: inline-block;
    padding: 8px 12px;
    background-color: #0073aa;
    color: #fff;
    border: 1px solid #0073aa;
    border-radius: 4px;
    font-weight: bold;
}

/* WPBakery provides responsiveness */ 