/**
 * Flexfit Product Comparison Styles
 */

/* Container */
.flexfit-comparison-section {
    margin: 40px 0;
    padding: 30px 0;
    clear: both;
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
}

.woocommerce .flexfit-comparison-section h2,
.flexfit-comparison-section h2 {
    font-size: 28px;
    line-height: 38px;
    font-weight: 700;
    margin-bottom: 30px;
    color: #1a1a1a;
    width: 72rem;

    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 400;
    margin-top: 8px;
    font-family: "Bebas Neue", Sans-serif;
}

/* Comparison Table */
.flexfit-comparison-table {
    width: 72rem;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e0e0e0;
    table-layout: fixed;
}

.flexfit-comparison-table th,
.flexfit-comparison-table td {
    padding: 15px 20px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #e0e0e0;
}

.flexfit-comparison-table th {
    background-color: #fafafa !important;
    font-weight: 600;
    color: #333 !important;
    width: 140px;
    font-weight: bold !important;
}

.flexfit-comparison-table td {
    color: #666;
    font-size: 14px;
}

/* Product Header Cell */
.comparison-product-header {
    padding: 20px !important;
    vertical-align: top !important;
    background: #fff;
    min-height: 200px;
}

.comparison-product-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.comparison-product-sku {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 5px;
    font-family: "Poppins";
}

.comparison-product-name {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-family: "Poppins";
}

.comparison-product-link {
    display: inline-block;
    font-size: 13px;
    color: #a6343a;
    text-decoration: none;
}

.comparison-product-link:hover {
    text-decoration: underline;
}

/* Current Product Badge */
.current-product-badge {
    display: inline-block;
    background: #1a1a1a;
    color: #fff;
    font-size: 16px;
    line-height: 28px;
    height: 30px;
    min-width: 80px;
    font-weight: 400;
    padding: 3px 8px;
    border-radius: 20px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: "Bebas Neue", Sans-serif;
}

/* Product Selector */
.comparison-product-selector {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.product-selector-container {
    width: 100%;
    max-width: 250px;
    position: relative;
}

/* Dropdown Select */
.product-dropdown-container {
    position: relative;
    width: 100%;
}

.product-dropdown-trigger {
    width: 100%;
    padding: 10px 35px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    font-family: "Poppins";
    position: relative;
    text-align: left;
    color: #666;
}

.product-dropdown-trigger .dropdown-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #666;
}

.product-dropdown-trigger:hover {
    border-color: #999;
}

.product-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-dropdown-list.active {
    display: block;
}

.product-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.product-dropdown-item:last-child {
    border-bottom: none;
}

.product-dropdown-item:hover {
    background: #f5f5f5;
}

.product-dropdown-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-right: 10px;
    border-radius: 4px;
}

.product-dropdown-info {
    flex: 1;
    text-align: left;
}

.product-dropdown-sku {
    font-weight: 600;
    font-size: 13px;
    color: #1a1a1a;
    font-family: "Poppins";
}

.product-dropdown-name {
    font-size: 12px;
    color: #666;
    font-family: "Poppins";
}

.product-dropdown {
    width: 100%;
    padding: 10px 35px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    font-family: "Poppins";
    background-position: right 12px center;
}

.product-dropdown:focus {
    outline: none;
    border-color: #1a1a1a;
}

/* Search Input */
.product-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    
    font-family: "Poppins";
}

.product-search-input:focus {
    outline: none;
    border-color: #1a1a1a;
}

/* Search Results Dropdown */
.product-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-search-results.active {
    display: block;
}

.product-search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.product-search-result-item:last-child {
    border-bottom: none;
}

.product-search-result-item:hover {
    background: #f5f5f5;
}

.product-search-result-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-right: 10px;
    border-radius: 4px;
}

.product-search-result-info {
    flex: 1;
    text-align: left;
}

.product-search-result-sku {
    font-weight: 600;
    font-size: 13px;
    color: #1a1a1a;
    font-family: "Poppins";
}

.product-search-result-name {
    font-size: 12px;
    color: #666;
    font-family: "Poppins";
}

.product-search-no-results,
.product-search-loading {
    padding: 15px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* Selected Product Display */
.selected-product-display {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.selected-product-change {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    color: #a6343a;
    cursor: pointer;
    text-decoration: underline;
    font-family: "Poppins";
}

.selected-product-change:hover {
    color: #004499;
}

/* Selector Toggle */
.selector-toggle {
    display: flex;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    flex-wrap: wrap;
}

.selector-toggle-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    font-family: "Poppins";
    transition: all 0.2s;
}

.selector-toggle-btn.active {
    background: #1a1a1a;
    color: #fff;
    font-family: "Poppins";
}

.selector-toggle-btn:hover:not(.active) {
    background: #e0e0e0;
}

/* Loading State */
.comparison-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
}

.comparison-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Attribute Row Styling */
.flexfit-comparison-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.flexfit-comparison-table tbody tr:hover {
    background: #f5f5f5;
}

/* Value Highlight */
.attribute-value-match {
    color: #2ecc71;
    font-weight: 600;
}

.attribute-value-different {
    color: #e74c3c;
}

/* Empty Slot */
.comparison-empty-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    color: #999;
}

.comparison-empty-slot-icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.3;
}

.comparison-empty-slot-text {
    font-size: 14px;
}

/* Remove Product Button */
.remove-comparison-product {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f5f5f5;
    color: #999;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
}

.remove-comparison-product:hover {
    background: #e74c3c;
    color: #fff;
}

.comparison-product-header {
    position: relative;
}

/* Responsive */
@media (min-width: 960px) and (max-width: 1199px) {
    .woocommerce .flexfit-comparison-section h2,
    .flexfit-comparison-section h2 {
        width: 95%;
    }

    .flexfit-comparison-table {
        width: 95%;
    }
}
@media (max-width: 992px) {
    .flexfit-comparison-section {
        overflow-x: auto;
    }

    .flexfit-comparison-table {
        min-width: 700px;
    }

    .flexfit-comparison-table th {
        width: 100px;
        padding: 10px;
    }

    .flexfit-comparison-table td {
        padding: 10px;
    }

    .comparison-product-image {
        width: 80px;
        height: 80px;
    }
    .woocommerce .flexfit-comparison-section h2,
    .flexfit-comparison-section h2 {
        width: 95%;
    }

    .flexfit-comparison-table {
        width: 95%;
    }
}

@media (max-width: 768px) {
    .flexfit-comparison-section h2 {
        font-size: 22px;
    }

    .selector-toggle-btn {
        padding: 6px 8px;
        font-size: 11px;
    }

    .product-dropdown,
    .product-search-input {
        font-size: 13px;
        padding: 8px 10px;
    }
    .flexfit-comparison-section {
        align-items: flex-start;
        padding: 0 5%;
    }
}

/* Print Styles */
@media print {
    .comparison-product-selector,
    .selected-product-change,
    .remove-comparison-product,
    .selector-toggle {
        display: none !important;
    }

    .flexfit-comparison-table {
        border: 2px solid #000;
    }

    .flexfit-comparison-table th,
    .flexfit-comparison-table td {
        border: 1px solid #000;
    }
}
