/**
 * Compare Styles
 */

/* Compare Button within Loop */
.aurabricks-compare-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #fff;
    color: #111827;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.abr-product-card:hover .aurabricks-compare-btn {
    opacity: 1;
    transform: translateY(0);
}

.abr-compare-icon {
    width: 18px;
    height: 18px;
    transition: all 0.3s;
}

.aurabricks-compare-btn:hover {
    color: #4f46e5;
    transform: scale(1.05) !important;
}

.aurabricks-compare-btn.in-compare {
    color: #4f46e5;
    background: #eef2ff;
}

/* Single Product Page Button */
.aurabricks-compare-btn.single-product-btn {
    opacity: 1;
    transform: none;
    width: auto;
    height: auto;
    padding: 12px 24px;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    box-shadow: none;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
}

.aurabricks-compare-btn.single-product-btn:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.aurabricks-compare-btn.single-product-btn.in-compare {
    background: #eef2ff;
    color: #4f46e5;
}

/* Loader */
.aurabricks-compare-btn.is-loading {
    opacity: 0.7;
    pointer-events: none;
}
.aurabricks-compare-btn.is-loading .abr-compare-icon {
    animation: abr-spin-pulse 1s linear infinite;
}
@keyframes abr-spin-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

/* --- Container & Table --- */
.aurabricks-compare-wrapper {
    position: relative;
    min-height: 200px;
}

.aurabricks-compare-wrapper.is-loading .aurabricks-compare-table-container {
    opacity: 0.5;
    pointer-events: none;
}

.aurabricks-compare-loading {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.aurabricks-compare-wrapper.is-loading .aurabricks-compare-loading {
    display: flex;
}

.aurabricks-compare-table-container {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
}

.aurabricks-compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px; /* Ensure horizontal scroll */
    table-layout: fixed;
    margin: 0 !important;
}

.aurabricks-compare-table th,
.aurabricks-compare-table td {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    vertical-align: top;
}

.aurabricks-compare-table th:last-child,
.aurabricks-compare-table td:last-child {
    border-right: none;
}

/* Fixed First Column (Criteria names) */
.aurabricks-compare-table th:first-child,
.aurabricks-compare-table td:first-child {
    width: 200px;
    text-align: left;
    font-weight: 600;
    color: #334155;
    background: #f8fafc;
    position: sticky;
    left: 0;
    z-index: 5; /* Stays above scrolling columns */
    border-right: 2px solid #e2e8f0;
}

[dir="rtl"] .aurabricks-compare-table th:first-child,
[dir="rtl"] .aurabricks-compare-table td:first-child {
    text-align: right;
    left: auto;
    right: 0;
}

/* Remove Button Row */
.aurabricks-row-remove th,
.aurabricks-row-remove td {
    padding: 12px;
    background: #fff;
    border-bottom: none;
}

.aurabricks-row-remove td {
    text-align: right;
}

[dir="rtl"] .aurabricks-row-remove td {
    text-align: left;
}

.aurabricks-compare-remove-btn {
    background: transparent;
    color: #94a3b8;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: inline-flex;
    transition: all 0.2s;
    line-height: 1;
}

.aurabricks-compare-remove-btn:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

/* Basic Info Row */
.aurabricks-row-basic-info td {
    vertical-align: top;
}

.compare-product-image {
    display: block;
    margin-bottom: 20px;
}

.compare-product-image img {
    border-radius: 8px;
    max-width: 100%;
    height: auto;
}

.compare-product-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    display: block;
    margin-bottom: 15px;
}
.compare-product-title:hover {
    color: #4f46e5;
}

.compare-product-price {
    font-size: 16px;
    color: #4f46e5;
    font-weight: 700;
    margin-bottom: 20px;
}

.compare-product-add-to-cart .button {
    width: 100%;
    text-align: center;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px;
    text-decoration: none;
    font-weight: 500;
}
.compare-product-add-to-cart .button:hover {
    background: #4338ca;
}

/* Zebra Striping for attributes */
.aurabricks-row-attribute:nth-child(even) td {
    background-color: #fcfcfd;
}

/* Empty State */
.aurabricks-compare-empty {
    text-align: center;
    padding: 60px 20px;
    background: #f8fafc;
    border-radius: 12px;
}

.aurabricks-compare-empty p {
    font-size: 18px;
    color: #475569;
    margin-bottom: 24px;
}

.aurabricks-compare-empty a.button {
    background: #4f46e5;
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
}

@media (max-width: 768px) {
    .aurabricks-compare-btn {
        opacity: 1; /* Always show touch */
        transform: none;
    }
}
