/* از متغیرهای تم مرکزی استفاده می‌کنیم. اینجا فقط fallback ها تعریف می‌شود در صورت نبود متغیرها */
:root {
    --surface: #ffffff;
    --surface-muted: #f8f9fa;
    --text-primary: #212121;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
}

/* استایل‌های مقایسه محصولات — بدنهٔ سراسری توسط zinox-theme مدیریت می‌شود */
.compare-container {
    background-color: var(--surface-muted);
    min-height: calc(100vh - 80px);
    padding: 30px 0 50px 0;
    position: relative;
    width: 100%;
}

.compare-header {
    background: var(--surface);
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    position: relative;
}

.compare-title {
    color: var(--brand-primary);
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 1rem;
}

.compare-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--brand-primary);
}

.compare-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 400;
}

.empty-compare {
    background: var(--surface);
    border-radius: 10px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.empty-compare i {
    font-size: 4rem;
    color: #2E7D32;
    margin-bottom: 25px;
}

.empty-compare h3 {
    color: #212121;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1.5rem;
}

.compare-table-container {
    background: var(--surface);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    width: 100%;
}

.compare-table {
    width: 100%;
    border: none;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
    table-layout: auto;
}
.compare-table.modern thead th { position: sticky; top: 0; z-index: 6; }
.compare-table.modern tbody tr td { backdrop-filter: saturate(120%) blur(0px); }
.compare-table.modern thead th, .compare-table.modern tbody td {
    border-right: 1px solid var(--border-color);
}
.compare-table.modern thead th:last-child, .compare-table.modern tbody td:last-child { border-right: none; }
.compare-table.modern tbody tr:hover td { background: color-mix(in oklab, var(--brand-primary, #2E7D32), transparent 92%); }

.compare-table th {
    background: var(--brand-primary, #2E7D32);
    color: var(--on-brand, #ffffff);
    font-weight: 700;
    border: none;
    padding: 20px 15px;
    text-align: center;
    vertical-align: middle;
    font-size: 1rem;
    position: relative;
}

.compare-table th:first-child {
    background: color-mix(in oklab, var(--brand-primary, #2E7D32), #000 20%);
    border-radius: 8px 0 0 0;
    text-align: right;
    width: 200px;
    font-size: 0.95rem;
    border-left: 3px solid var(--brand-primary, #2E7D32);
}

.compare-table th:last-child {
    border-radius: 0 8px 0 0;
}

.compare-table td {
    padding: 20px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    text-align: center;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.compare-table td:first-child {
    background: var(--surface-muted);
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    border-left: 3px solid var(--brand-primary, #2E7D32);
}

.compare-table tbody tr:hover {
    background: color-mix(in oklab, var(--brand-primary, #2E7D32), transparent 90%);
}

.compare-table tbody tr:last-child td {
    border-bottom: none;
}

.compare-table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 8px;
}

.compare-table tbody tr:last-child td:last-child {
    border-radius: 0 0 8px 0;
}

.product-image-compare {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.product-image-compare:hover {
    transform: scale(1.05);
}

.product-name-compare {
    font-weight: 700;
    color: #212121;
    font-size: 1.1rem;
    margin-bottom: 8px;
    line-height: 1.4;
}

.product-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.price-compare {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2E7D32;
    margin-bottom: 5px;
}

.price-original {
    margin-bottom: 2px;
    font-size: 0.9rem;
    text-decoration: line-through;
    color: #999;
}

.discount-badge {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    margin-top: 5px;
    font-weight: 600;
}

.price-unit {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.rating-stars {
    color: #ffc107;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.rating-count, .rating-score {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.rating-score {
    margin-top: 2px;
    color: #2E7D32;
    font-weight: 600;
}

.feature-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e8f5e8;
    color: #2E7D32;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 2px;
    border: 1px solid #c8e6c9;
    transition: transform 0.2s ease;
}

.feature-badge:hover {
    transform: scale(1.05);
}

.remove-product {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.remove-product:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-direction: column;
    align-items: center;
    margin-top: 15px;
}

.btn-compare {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    font-size: 0.85rem;
    width: 100%;
    justify-content: center;
    max-width: 140px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary-compare {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.btn-primary-compare:hover {
    background: var(--brand-primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.4);
}

.btn-secondary-compare {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.btn-secondary-compare:hover {
    background: var(--brand-primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.compare-tools {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.add-more-products {
    background: var(--brand-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
    transition: all 0.3s ease;
}

.add-more-products:hover {
    background: var(--brand-primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.4);
}

.clear-all {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.clear-all:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.container {
    max-width: 1200px;
    position: relative;
}

/* استایل‌های جدید برای ویژگی‌های اضافه شده */
.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
}

.brand-name {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid #e0e0e0;
    font-weight: 600;
    color: #2E7D32;
}

.warranty-info {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #2E7D32;
}

.weight-info, .dimensions-info {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #2E7D32;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--brand-primary);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(400px);
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 350px;
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-notification.error {
    background: #e74c3c;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .compare-table {
        min-width: 900px;
    }
    
    .compare-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 992px) {
    .compare-container {
        padding: 25px 0 40px 0;
    }
    
    .compare-table {
        min-width: 800px;
    }
    
    .compare-table td:first-child {
        width: 160px;
        font-size: 0.9rem;
        padding: 18px 12px;
    }
    
    .compare-table td {
        padding: 18px 12px;
        font-size: 0.9rem;
    }
    
    .product-image-compare {
        width: 100px;
        height: 100px;
    }
    
    .product-name-compare {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .compare-container {
        padding: 20px 0 30px 0;
    }

    .compare-title {
        font-size: 2rem;
    }
    
    .compare-table-container {
        padding: 20px;
        margin: 0 -20px;
        border-radius: 8px;
    }
    
    .compare-table {
        min-width: 700px;
    }
    
    .compare-table td:first-child {
        width: 130px;
        font-size: 0.85rem;
        padding: 15px 10px;
    }
    
    .compare-table td {
        padding: 15px 10px;
        font-size: 0.85rem;
    }
    
    .compare-table th {
        padding: 15px 10px;
        font-size: 0.9rem;
    }
    
    .product-image-compare {
        width: 80px;
        height: 80px;
    }

    .compare-header {
        padding: 20px;
        margin-bottom: 20px;
    }

    .empty-compare {
        padding: 40px 20px;
    }

    .compare-tools {
        padding: 20px 15px;
        margin: 0 -20px 20px -20px;
    }

    .toast-notification {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
        font-size: 0.9rem;
    }

    .toast-notification.show {
        transform: translateY(0);
    }
    
    .btn-compare {
        font-size: 0.8rem;
        padding: 6px 12px;
        max-width: 110px;
    }
    
    .price-compare {
        font-size: 1.3rem;
    }
    
    .product-name-compare {
        font-size: 0.95rem;
        line-height: 1.2;
    }
    
    .remove-product {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .compare-title {
        font-size: 1.8rem;
    }
    
    .compare-subtitle {
        font-size: 1rem;
    }
    
    .compare-table-container {
        padding: 15px;
        margin: 0 -15px;
    }
    
    .compare-table {
        min-width: 600px;
    }
    
    .compare-table td:first-child {
        width: 110px;
        font-size: 0.8rem;
        padding: 12px 8px;
    }
    
    .compare-table td {
        padding: 12px 8px;
        font-size: 0.8rem;
    }
    
    .compare-table th {
        padding: 12px 8px;
        font-size: 0.85rem;
    }
    
    .product-image-compare {
        width: 60px;
        height: 60px;
    }
    
    .btn-compare {
        font-size: 0.75rem;
        padding: 5px 8px;
        max-width: 90px;
    }
    
    .price-compare {
        font-size: 1.2rem;
    }
    
    .price-unit {
        font-size: 0.75rem;
    }
    
    .product-name-compare {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }
    
    .product-category {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .feature-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    .rating-stars {
        font-size: 0.9rem;
    }
    
    .rating-count, .rating-score {
        font-size: 0.7rem;
    }
    
    .compare-header {
        padding: 20px 15px;
    }
    
    .compare-tools {
        padding: 15px;
        margin: 0 -15px 15px -15px;
    }
    
    .add-more-products, .clear-all {
        font-size: 0.85rem;
        padding: 10px 18px;
    }
}

/* رفع مشکل اسکرول - scrollbar styling */
.compare-table-container::-webkit-scrollbar {
    height: 8px;
}

.compare-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.compare-table-container::-webkit-scrollbar-thumb {
    background: #2E7D32;
    border-radius: 10px;
}

.compare-table-container::-webkit-scrollbar-thumb:hover {
    background: #1B5E20;
}

@media (max-width: 768px) {
    .compare-table-container::-webkit-scrollbar {
        height: 6px;
    }
}

/* کارت‌های مقایسه */
.compare-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    width: 100%;
    overflow: hidden;
}

.product-compare-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid #e0e0e0;
    position: relative;
    transition: all 0.3s ease;
    height: fit-content;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.product-compare-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border-color: var(--brand-primary);
}

.remove-product {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 10;
    box-shadow: 0 3px 10px rgba(244, 67, 54, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.remove-product:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.product-image-section {
    text-align: center;
    margin-bottom: 20px;
}

.product-image-compare {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.product-image-compare:hover {
    transform: scale(1.05);
}

.product-name-compare {
    font-weight: 700;
    color: #212121;
    font-size: 1.3rem;
    margin-bottom: 10px;
    line-height: 1.4;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.product-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    overflow: hidden;
}

.product-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.info-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.info-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #212121;
}

.price-section {
    background: linear-gradient(135deg, #e8f5e8, #f1f8e9);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    border: 2px solid #c8e6c9;
}

.price-compare {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2E7D32;
    margin-bottom: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.price-original {
    font-size: 1rem;
    text-decoration: line-through;
    color: #999;
    margin-bottom: 5px;
}

.discount-badge {
    display: inline-block;
    background: #f44336;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.rating-section {
    text-align: center;
    margin-bottom: 20px;
}

.rating-stars {
    color: #ffc107;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.rating-info {
    color: #666;
    font-size: 0.9rem;
}

.rating-score {
    color: #2E7D32;
    font-weight: 600;
}

.features-section {
    margin-bottom: 20px;
}

.features-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2E7D32;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.feature-badge {
    display: inline-block;
    padding: 5px 12px;
    background: #e8f5e8;
    color: #2E7D32;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #c8e6c9;
    transition: transform 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.feature-badge:hover {
    transform: scale(1.05);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.btn-compare {
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    font-size: 0.9rem;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
}

.btn-primary-compare {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.btn-primary-compare:hover {
    background: var(--brand-primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

.btn-secondary-compare {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-secondary-compare:hover {
    background: var(--brand-primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    font-weight: 600;
}

.brand-name {
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 10px;
    display: inline-block;
    border: 1px solid #e0e0e0;
    font-weight: 600;
    color: #2E7D32;
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.warranty-info {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2E7D32;
}

.weight-info, .dimensions-info {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

/* Loading & Toast */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #2E7D32;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--brand-primary);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(400px);
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 350px;
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-notification.error {
    background: #f44336;
}

/* Responsive Design - بهبود یافته */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .compare-cards-container {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 18px;
    }
    
    .compare-title {
        font-size: 2.4rem;
    }
}

@media (max-width: 992px) {
    .compare-container {
        padding: 25px 0 60px 0;
    }
    
    .compare-cards-container {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 15px;
    }
    
    .product-image-compare {
        width: 160px;
        height: 160px;
    }
    
    .product-name-compare {
        font-size: 1.1rem;
    }

    .compare-tools {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 15px;
    }

    .compare-actions {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .compare-container {
        padding: 20px 0 40px 0;
    }

    .container {
        padding: 0 10px;
    }

    .compare-title {
        font-size: 1.8rem;
    }
    
    .compare-cards-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-compare-card {
        padding: 20px;
        border-radius: 15px;
    }
    
    .product-image-compare {
        width: 140px;
        height: 140px;
    }

    .compare-header {
        padding: 25px 15px;
        margin-bottom: 20px;
    }

    .empty-compare {
        padding: 50px 20px;
    }

    .compare-tools {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .toast-notification {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }

    .toast-notification.show {
        transform: translateY(0);
    }
    
    .price-compare {
        font-size: 1.6rem;
    }
    
    .product-name-compare {
        font-size: 1rem;
    }
    
    .product-info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .compare-container {
        padding: 15px 0 30px 0;
    }

    .container {
        padding: 0 5px;
    }

    .compare-title {
        font-size: 1.6rem;
    }
    
    .compare-subtitle {
        font-size: 0.9rem;
    }
    
    .product-compare-card {
        padding: 15px;
    }
    
    .product-image-compare {
        width: 120px;
        height: 120px;
    }
    
    .price-compare {
        font-size: 1.4rem;
    }
    
    .product-name-compare {
        font-size: 0.9rem;
    }
    
    .compare-header {
        padding: 20px 10px;
    }
    
    .compare-tools {
        padding: 15px 10px;
        margin-bottom: 15px;
    }
    
    .btn-action {
        font-size: 0.8rem;
        padding: 10px 15px;
    }

    .info-item {
        padding: 10px;
    }

    .price-section {
        padding: 15px;
    }

    .btn-compare {
        font-size: 0.85rem;
        padding: 10px 15px;
    }
}

@media (max-width: 360px) {
    .compare-cards-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .product-compare-card {
        padding: 12px;
    }

    .product-image-compare {
        width: 100px;
        height: 100px;
    }

    .compare-title {
        font-size: 1.4rem;
    }

    .product-name-compare {
        font-size: 0.85rem;
    }

    .price-compare {
        font-size: 1.2rem;
    }
}

/* AI Comparison Section */
.ai-comparison-section {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid #e0e0e0;
    position: relative;
    overflow: hidden;
}

.ai-comparison-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2E7D32, #4CAF50, #81C784);
}

.ai-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.ai-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2E7D32, #4CAF50);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3); }
    50% { box-shadow: 0 6px 25px rgba(46, 125, 50, 0.5); }
    100% { box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3); }
}

.ai-header-text h3 {
    margin: 0;
    color: #2E7D32;
    font-weight: 700;
    font-size: 1.4rem;
}

.ai-header-text p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 0.95rem;
}

.ai-content {
    background: white;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #e0e0e0;
    position: relative;
    min-height: 200px;
}

.ai-thinking {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-style: italic;
    margin-bottom: 15px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #2E7D32;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.ai-text {
    line-height: 1.8;
    color: #333;
    font-size: 1rem;
    text-align: justify;
}

.ai-text.typing {
    border-right: 2px solid #2E7D32;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { border-color: #2E7D32; }
    51%, 100% { border-color: transparent; }
}

.ai-conclusion {
    background: linear-gradient(135deg, #e8f5e8, #f1f8e9);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border-left: 4px solid #2E7D32;
}

.ai-conclusion h4 {
    color: #2E7D32;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommendation-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2E7D32;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 15px;
    box-shadow: 0 3px 10px rgba(46, 125, 50, 0.3);
}

@media (max-width: 768px) {
    .ai-comparison-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .ai-header {
        gap: 10px;
        margin-bottom: 20px;
    }

    .ai-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .ai-header-text h3 {
        font-size: 1.2rem;
    }

    .ai-content {
        padding: 20px;
    }

    .ai-text {
        font-size: 0.95rem;
    }
}

/* ---------- Sticky first column ---------- */
.compare-table th:first-child,
.compare-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #f5f5f5;
}

/* highlight differing cells */
.diff-cell {
    background: rgba(255, 183, 77, 0.25);
    border: 1px solid var(--warning);
}

/* ---------- Mobile horizontal slider (≤768px) ---------- */
@media (max-width: 768px) {
    .compare-cards-container {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 15px;
    }
    .product-compare-card {
        flex: 0 0 80%;
        scroll-snap-align: center;
    }
}

/* ---------- Floating Action Button (FAB) ---------- */
.fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 2000;
    display: none; /* پیش‌فرض مخفی */
}
.fab:hover {
    background: var(--brand-primary-dark);
    transform: scale(1.05);
}
.fab-menu {
    position: fixed;
    bottom: 90px;
    right: 25px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    min-width: 200px;
    z-index: 2000;
    overflow: hidden;
}
.fab-menu a, .fab-menu button {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    background: none;
    border: none;
    width: 100%;
    text-align: right;
    cursor: pointer;
}
.fab-menu a:hover, .fab-menu button:hover {
    background: #f5f5f5;
}
@media (max-width: 768px) {
    .fab { display: flex; }
    /* fab-menu همچنان با جاوااسکریپت نشان داده می‌شود */
}

/* ----- Theme Toggle Button ----- */
.theme-toggle {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    transition: background 0.3s ease;
}
.theme-toggle:hover {
    background: var(--brand-primary-dark);
}

/* ---------- Compare Summary Badges ---------- */
.compare-summary {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.summary-badge {
    background: var(--brand-primary);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.summary-badge i { font-size: 0.9rem; }

.gallery-thumbs {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}
.gallery-thumbs img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border .2s ease;
}
.gallery-thumbs img:hover {
    border-color: var(--brand-primary);
}

/* heat-highlight */
.best-cell { background: linear-gradient(90deg, rgba(76,175,80,0.15), rgba(76,175,80,0.05)); }
.worst-cell { background: linear-gradient(90deg, rgba(244,67,54,0.15), rgba(244,67,54,0.05)); }

/* ===== Compare page: Specs Rotator ===== */
.compare-specs-rotator {
    position: relative;
    overflow: hidden;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.06), rgba(46, 125, 50, 0.04));
    border: 1px solid rgba(76, 175, 80, 0.12);
    min-height: 40px;
}
.compare-specs-rotator .comp-spec-item {
    position: absolute;
    top: 0; left: 0; right: 0;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 460ms cubic-bezier(0.22, 1, 0.36, 1), transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    direction: rtl;
}
.compare-specs-rotator .comp-spec-item.active { opacity: 1; transform: translateY(0); }
.compare-specs-rotator .comp-spec-header {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(76, 175, 80, 0.08);
    border: 1px solid rgba(76, 175, 80, 0.18);
    border-radius: 8px; padding: 4px 8px; width: fit-content;
    color: var(--theme-text-primary, #2E7D32);
}
.compare-specs-rotator .comp-spec-value { color: var(--theme-text-secondary, #333); font-weight: 600; }
.compare-specs-rotator .comp-spec-icon { color: #2E7D32; }
@media (prefers-color-scheme: dark) {
    .compare-specs-rotator .comp-spec-icon { color: #8ee6a2; }
    .compare-specs-rotator .comp-spec-value { color: #e0e0e0; }
}

/* ===== Preferences UI ===== */
.pref-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
}
.pref-group-title {
    font-weight: 700; color: var(--text-primary); margin-bottom: 8px;
}
.pref-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pref-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    color: var(--text-secondary);
    cursor: pointer; user-select: none;
    transition: all .2s ease;
}
.pref-chip:hover { border-color: var(--brand-primary, #2E7D32); }
.pref-chip.active {
    background: color-mix(in oklab, var(--brand-primary,#2E7D32), #fff 85%);
    color: var(--brand-primary,#2E7D32);
    border-color: var(--brand-primary,#2E7D32);
    box-shadow: 0 2px 8px rgba(46,125,50,.15);
}
.pref-note { color: var(--text-secondary); font-size: .85rem; }
