/* Enhanced CSS that matches product card styling */
:root {
    --primary-color: #163A5F;
    --primary-dark: #0e2a44;
    --primary-light: #1e4a78;
    --secondary-color: #A2FF86;
    --danger-color: #EC5550;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

/* Product Options Badge */
.product-has-options-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    background: var(--gray-100);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 20px;
    margin-top: 6px;
}

.product-options-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.product-options-info i {
    color: var(--primary-color);
    font-size: 1rem;
}

.view-options-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.75rem;
}

.view-options-link:hover {
    text-decoration: underline;
}

.product-options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.option-tag {
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    color: var(--gray-700);
}

.more-options {
    font-size: 0.7rem;
    color: var(--primary-color);
    font-weight: 500;
}

.quantity-info {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Enhanced Compare Button on Product Card */
.compare-btn {
    position: absolute;
    top: 10px;
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--gray-200);
    color: var(--primary-color);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.compare-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.compare-btn.in-compare {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Drawer styling matching product card */
.compare-drawer {
    position: fixed;
    top: 5%;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    max-width: 95vw;
    height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9998;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.compare-drawer.expanded {
    width: 90vw;
    max-width: 1400px;
    pointer-events: auto;
}

/* Trigger Button */
.compare-minimized-trigger {
    position: fixed;
    top: 50%;
    right: -60px;
    transform: translateY(-50%);
    width: 60px;
    height: auto;
    min-height: 140px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px 0 0 12px;
    cursor: pointer;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 600;
}

.compare-minimized-trigger.has-products {
    display: flex;
    right: 0;
}

.compare-minimized-trigger:hover {
    transform: translateY(-50%) scale(1.02);
    width: 66px;
    background: var(--primary-dark);
}

.compare-minimized-trigger .count-badge {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.75rem;
}

/* Header */
.compare-header {
    padding: 20px 24px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.compare-header h3 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--gray-800);
}

.compare-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-count {
    font-size: 0.85rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 6px 12px;
    border-radius: 20px;
}

.compare-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gray-100);
    border: none;
    color: var(--gray-600);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
}

.compare-close:hover {
    background: var(--danger-color);
    color: white;
}

/* Table Styles */
.comparison-table-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.comparison-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    min-width: 720px;
}

.comparison-table .feature-column {
    width: 180px;
    background: var(--gray-50);
}

.comparison-table .product-column {
    min-width: 260px;
}

/* Header */
.comparison-table thead tr {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.comparison-table thead th {
    padding: 0;
    text-align: center;
    border-right: 1px solid var(--gray-200);
}

.comparison-table thead th:last-child {
    border-right: none;
}

.product-header-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    position: relative;
}

.remove-product-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: white;
    border: 1px solid var(--gray-200);
    color: var(--gray-400);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}

.product-header-cell:hover .remove-product-btn {
    opacity: 1;
}

.remove-product-btn:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.header-product-img-wrap {
    width: 100px;
    height: 100px;
    background: var(--gray-50);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
}

.header-product-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.header-product-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-800);
    text-decoration: none;
    text-align: center;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.header-product-title:hover {
    color: var(--primary-color);
}

/* Body */
.comparison-table tbody tr {
    border-bottom: 1px solid var(--gray-200);
}

.comparison-table tbody tr:hover {
    background: var(--gray-50);
}

.feature-cell {
    padding: 16px 20px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    vertical-align: middle;
}

.feature-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-icon {
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.feature-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.value-cell {
    padding: 16px 20px;
    text-align: center;
    color: var(--gray-700);
    border-right: 1px solid var(--gray-200);
}

.value-cell:last-child {
    border-right: none;
}

/* Price */
.price-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.current-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.compare-price {
    font-size: 0.75rem;
    color: var(--gray-400);
    text-decoration: line-through;
}

.discount-badge {
    background: var(--danger-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tax Status */
.tax-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tax-status.taxable {
    background: #dbeafe;
    color: #1e40af;
}

.tax-status.tax-free {
    background: #d1fae5;
    color: #065f46;
}

/* Rating */
.rating-reviews-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.rating-stars {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stars {
    color: #fbbf24;
    font-size: 0.85rem;
}

.rating-value {
    font-weight: 600;
    font-size: 0.85rem;
}

.reviews-count {
    font-size: 0.7rem;
    color: var(--gray-500);
}

.reviews-count i {
    margin-right: 4px;
}

/* Description */
.product-description {
    margin: 0;
    font-size: 0.8rem;
    color: var(--gray-600);
    line-height: 1.5;
    text-align: left;
    max-width: 280px;
    margin: 0 auto;
}

/* Quantity Display */
.quantity-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.quantity-infinite {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #d1fae5;
    color: #065f46;
}

.quantity-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-700);
}

.quantity-zero {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #fee2e2;
    color: #991b1b;
}

/* Availability Badges */
.availability-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.availability-badge.in-stock {
    background: #d1fae5;
    color: #065f46;
}

.availability-badge.low-stock {
    background: #fed7aa;
    color: #9b2c1d;
}

.availability-badge.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

/* Brand & SKU */
.brand-value, .sku-value {
    background: var(--gray-100);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    display: inline-block;
}

.sku-value {
    font-family: monospace;
}

/* Specifications */
.specifications-list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
    max-width: 280px;
    margin: 0 auto;
}

.specifications-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.75rem;
}

.specifications-list li:last-child {
    border-bottom: none;
}

.spec-name {
    font-weight: 600;
    color: var(--gray-700);
}

.spec-value {
    color: var(--gray-600);
    text-align: right;
}

.more-specs {
    justify-content: center !important;
    color: var(--primary-color);
    border-bottom: none !important;
}

/* Buttons */
.btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

/* Empty State */
.empty-state-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    text-align: center;
    padding: 60px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    color: var(--gray-500);
}

.empty-state small {
    font-size: 0.8rem;
}

/* Notifications */
.compare-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 10px;
    color: white;
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

.compare-notification.success { background: #10b981; }
.compare-notification.error { background: var(--danger-color); }
.compare-notification.warning { background: #f59e0b; }
.compare-notification.info { background: var(--primary-color); }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .compare-drawer.expanded {
        width: 95vw;
    }
    
    .comparison-table .feature-column {
        width: 140px;
    }
    
    .feature-content {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
}

@media (max-width: 768px) {
    .compare-header {
        padding: 16px;
    }
    
    .compare-header h3 {
        font-size: 1.1rem;
    }
    
    .header-product-img-wrap {
        width: 70px;
        height: 70px;
    }
    
    .feature-cell, .value-cell {
        padding: 12px;
    }
}