/* IBC Product Filter - Frontend Styles */

/* Main container */
.ibc-filter-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Filter form */
.ibc-filter-form {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.ibc-filter-form h3 {
    margin: 0 0 20px 0;
    font-size: 22px;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

/* Parameters table */
.ibc-parameters-table {
    overflow-x: auto;
    margin-bottom: 20px;
}

.ibc-filter-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.ibc-filter-table th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e1e1e1;
}

.ibc-filter-table td {
    padding: 15px;
    border-bottom: 1px solid #e1e1e1;
    vertical-align: top;
}

.ibc-filter-table tr:hover {
    background: #f8f9fa;
}

/* Parameter cells */
.parameter-name {
    width: 60%;
}

.parameter-name strong {
    display: block;
    color: #333;
    font-size: 16px;
    margin-bottom: 5px;
}

.parameter-description {
    color: #666;
    font-style: italic;
    line-height: 1.4;
}

.parameter-checkbox {
    width: 15%;
    text-align: center;
}

.parameter-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}



/* Filter actions */
.ibc-filter-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.ibc-filter-submit {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ibc-filter-submit:hover {
    background: #005177;
}


.ibc-filter-reset {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ibc-filter-reset:hover {
    background: #545b62;
}


/* Products results */
.ibc-products-results {
    margin-top: 30px;
}

.ibc-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 18px;
}

.ibc-no-products {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #666;
}



/* Responsive design */
@media (max-width: 768px) {
    .ibc-filter-container {
        padding: 15px;
    }
    .ibc-filter-form {
        padding: 20px 15px;
    }
    .ibc-parameters-table {
        font-size: 14px;
    }
    .ibc-filter-table th,
    .ibc-filter-table td {
        padding: 10px 8px;
    }
    .parameter-name strong {
        font-size: 15px;
    }

    .ibc-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ibc-filter-actions .button {
        width: 100%;
        margin-bottom: 10px;
    }
}


@media (max-width: 480px) {
    .ibc-filter-table th,
    .ibc-filter-table td {
        padding: 8px 5px;
        font-size: 13px;
    }
    
    .parameter-description {
        font-size: 12px;
    }
}

/* Animation for loading */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.ibc-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* =============================================================================
   UNIFIED TABLE STYLES
   ============================================================================= */

/* Unified table wrapper */
.ibc-unified-table-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 60px 0 20px 0; /* Added top padding for tooltips */
}


.ibc-unified-table-wrapper h3 {
    margin: 0 0 25px 0;
    font-size: 24px;
    color: #333;
    border-bottom: 2px solid #c9d4da;
    padding-bottom: 10px;
    text-align: center;
}

/* Unified table container */
.ibc-unified-table-container {
    background: #fff;
    border-radius: 13px;
    overflow: visible; /* Changed to visible to allow tooltips to show */
    box-shadow: 0 0 14px rgba(0,0,0,0.14);
    margin-bottom: 20px;
    position: relative;
}



.ibc-unified-table-scroll {
    overflow: auto;
}

/* Unified table */
.ibc-unified-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 800px;
    table-layout: auto;
}
.ibc-unified-table.loading {
    filter: blur(2px);
    opacity: 0.3;
    pointer-events: none;
    transition: all 0.3s ease;
}



/* Table header */
.ibc-unified-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ibc-unified-table thead th {
    padding: 5px 7px;
    text-align: center;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e1e1e1;
    border-right: 1px solid #e1e1e1;
    white-space: nowrap;
}


.ibc-unified-table thead th:last-child {
    border-right: none;
}

/* Product column header */
.ibc-unified-table thead th.product-column {
    min-width: 200px;
    text-align: center;
    background-color: #f3f3f3;
}



.ibc-unified-table thead th.parameter-column {
    min-width: 80px;
    background-color: #f3f3f3;
}

.ibc-unified-table thead th.actions-column {
    width: 150px;
    background-color: #f3f3f3;
}

/* Parameter header with checkbox */
.parameter-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.parameter-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.parameter-header label {
    cursor: pointer;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    margin: 0;
    
}

/* Table body */
.ibc-unified-table tbody tr {
    border-bottom: 1px solid #e1e1e1;
    transition: background-color 0.2s ease;
}

.ibc-unified-table tbody tr:hover {
    background: #f8f9fa;
}

.ibc-unified-table tbody tr.product-all {
    background: #fff;
}

.ibc-unified-table tbody tr.product-all:hover {
    background: #f8f9fa;
}

/* Table cells */
.ibc-unified-table tbody td {
    padding: 12px 10px;
    border-right: 1px solid #e1e1e1;
    vertical-align: middle;
}

.ibc-unified-table tbody td:last-child {
    border-right: none;
}

/* Product info cell */
.ibc-unified-table tbody td.product-info__image {
    text-align: left;
}
.ibc-unified-table tbody td.product-info__image img {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: #f8f9fa;
    max-width: 80px !important;
}
.ibc-unified-table tbody td.product-info__title {
    text-align: left;
    min-width: 150px;
}
.ibc-unified-table tbody td.product-info__title h4 {
    margin-bottom: 5px;
}

/* Product price tag styles */
.product-price-tag {
    display: inline-block;
    margin-top: 8px;
    padding: 1px 8px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.product-price-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* Price tag with special styling for sale prices */
.product-price-tag .woocommerce-Price-amount {
    font-weight: 700;
    color: #fff;
}

.product-price-tag del {
    opacity: 0.7;
    margin-right: 8px;
    font-size: 12px;
}

.product-price-tag ins {
    text-decoration: none;
    font-weight: 700;
}

/* Alternative color scheme for sale items */
.product-price-tag:has(del) {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.product-price-tag:has(del):hover {
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}



/* Old loading styles removed - now using overlay approach */

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hide loading row when table is populated */
.ibc-unified-table tbody:not(:has(.loading-row)) .loading-row {
    display: none;
}

/* Loading overlay for unified table */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.3);
    display: none;
    z-index: 100;
    border-radius: 13px;
}

.loading-spinner-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 15px;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e1e1;
}

.loading-spinner-overlay .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e1e1e1;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner-overlay .loading-text {
    color: #666;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* Smooth transitions for loading states */
.ibc-unified-table {
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.loading-overlay {
    transition: opacity 0.2s ease;
}

/* Parameter cells */
.ibc-unified-table tbody td.parameter-cell {
    text-align: center;
    position: relative;
}

.parameter-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #28a745;
    color: white;
    font-size: 12px;
    line-height: 20px;
    font-weight: bold;
}

/* Parameter cell states */
.parameter-cell.has-parameter {
    background: #e8f5e8;
}

.parameter-cell.has-parameter.selected-parameter {
    background: #28a745;
    color: white;
}

.parameter-cell.has-parameter.selected-parameter .parameter-indicator {
    background: white;
    color: #28a745;
}

/* No products message */
.no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}


/* Results counter */
.ibc-results-counter {
    display: inline-block;
    margin-left: 20px;
    color: #333;
}

#ibc-total-count {
    color: #0073aa;
    font-weight: bold;
}


/* Responsive design for unified table */
@media (max-width: 1200px) {
    .ibc-unified-table thead th.parameter-column {
        min-width: 60px;
    }
    
    .parameter-header label {
        font-size: 11px;
        max-width: 50px;
    }
    
    .parameter-header input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 968px) {
    .ibc-unified-table-wrapper {
        padding: 15px 10px;
    }
    
    .ibc-unified-table-wrapper h3 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .ibc-unified-table {
        min-width: 700px;
    }
    
    .ibc-unified-table thead th.product-column {
        width: 200px;
    }
}

/* Small tag variant for mobile */
@media (max-width: 768px) {
    .product-price-tag {
        font-size: 12px;
        padding: 1px 8px;
        margin-top: 6px;
    }

    .ibc-unified-table thead th {
        padding: 10px 8px;
    }
    
    .ibc-unified-table tbody td {
        padding: 8px 6px;
    }
    
    .parameter-header {
        gap: 4px;
    }
    
    .parameter-header label {
        font-size: 10px;
        max-width: 40px;
    }
    
    .ibc-filter-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .ibc-results-counter {
        margin-left: 0;
        text-align: center;
    }
}

/* =============================================================================
   PARAMETER TOOLTIP STYLES
   ============================================================================= */

/* Parameter header with tooltip on hover */
.parameter-header.parameter-tooltip {
    cursor: help;
    position: relative;
    transition: all 0.3s ease;
    padding: 4px;
    border-radius: 6px;
}

.parameter-header.parameter-tooltip:hover {
    background: rgba(0, 124, 186, 0.1);
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.2);
}

/* Dynamic tooltip created by JavaScript */
.ibc-tooltip {
    position: fixed;
    background: rgba(33, 37, 41, 0.95);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: normal;
    line-height: 1.4;
    max-width: 280px;
    width: 280px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999999;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    pointer-events: none;
}

.ibc-tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* Tooltip arrow */
.ibc-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(33, 37, 41, 0.95);
}

/* Arrow for tooltip shown below */
.ibc-tooltip.below::after {
    top: -12px;
    border-top-color: transparent;
    border-bottom-color: rgba(33, 37, 41, 0.95);
}

/* Responsive tooltip adjustments */
@media (max-width: 768px) {
    .parameter-header.parameter-tooltip {
        padding: 2px;
    }
    
    .parameter-header.parameter-tooltip:hover {
        transform: scale(1.01);
    }
    
    .ibc-tooltip {
        font-size: 12px;
        padding: 8px 12px;
        max-width: 200px;
    }
}