/* ============================================
   صفحه مقایسه محصولات — قالب Comma
   ============================================ */

.comma-product-compare-page {
    background: linear-gradient(180deg, #f0f4fa 0%, #f8fafc 40%, #ffffff 100%);
}

.comma-compare-page {
    direction: rtl;
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 20px 56px;
}

/* ---- هدر ---- */
.comma-compare-page__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.comma-compare-page__header-main {
    flex: 1;
    min-width: 220px;
}

.comma-compare-page__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: rgba(55, 143, 198, 0.12);
    color: #378fc6;
    font-size: 0.8rem;
    font-weight: 600;
}

.comma-compare-page__title {
    margin: 0 0 8px;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 800;
    color: #1a0744;
    line-height: 1.35;
}

.comma-compare-page__subtitle {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 520px;
}

.comma-compare-page__count-badge {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 52px;
    padding: 0 14px;
    border-radius: 16px;
    background: #1c274c;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(28, 39, 76, 0.22);
}

.comma-compare-page__count-badge.is-visible {
    display: inline-flex;
}

.comma-compare-page__count-badge small {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.85;
    margin-top: 2px;
}

/* ---- حالت‌ها: لودینگ / خالی / خطا ---- */
.comma-compare-page__state {
    text-align: center;
    padding: 56px 28px;
    border-radius: 24px;
    background: #fff;
    border: 1px solid #e8edf5;
    box-shadow: 0 4px 24px rgba(28, 39, 76, 0.06);
}

.comma-compare-page__state-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(55, 143, 198, 0.15), rgba(28, 39, 76, 0.08));
    color: #378fc6;
    font-size: 2rem;
}

.comma-compare-page__state h2 {
    margin: 0 0 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1c274c;
}

.comma-compare-page__state p {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.7;
}

.comma-compare-page__spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 16px;
    border: 3px solid #e2e8f0;
    border-top-color: #378fc6;
    border-radius: 50%;
    animation: commaCompareSpin 0.75s linear infinite;
}

@keyframes commaCompareSpin {
    to { transform: rotate(360deg); }
}

.comma-compare-page__error {
    border-color: #fecaca;
    background: #fff5f5;
}

.comma-compare-page__error .comma-compare-page__state-icon {
    background: #fee2e2;
    color: #dc2626;
}

/* ---- دکمه‌ها ---- */
.comma-compare-page__actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.comma-compare-page__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 14px;
    background: #1c274c;
    color: #fff !important;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 14px rgba(28, 39, 76, 0.18);
}

.comma-compare-page__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(28, 39, 76, 0.22);
    color: #fff !important;
}

.comma-compare-page__btn.is-secondary {
    background: #378fc6;
    box-shadow: 0 4px 14px rgba(55, 143, 198, 0.28);
}

.comma-compare-page__btn.is-ghost {
    background: #fff;
    color: #1c274c !important;
    border: 1px solid #dbe3f0;
    box-shadow: none;
}

.comma-compare-page__btn.is-ghost:hover {
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.comma-compare-page__footer-actions {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e8edf5;
}

/* ---- جدول مقایسه ---- */
.comma-compare-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 24px;
    background: #fff;
    border: 1px solid #e8edf5;
    box-shadow: 0 8px 40px rgba(28, 39, 76, 0.08);
    scrollbar-width: thin;
    scrollbar-color: #378fc6 #f1f5f9;
}

.comma-compare-table-wrap::-webkit-scrollbar {
    height: 8px;
}

.comma-compare-table-wrap::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 0 0 24px 24px;
}

.comma-compare-table-wrap::-webkit-scrollbar-thumb {
    background: #378fc6;
    border-radius: 999px;
}

.comma-compare-table {
    width: 100%;
    min-width: 680px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.comma-compare-table th,
.comma-compare-table td {
    padding: 16px 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    text-align: center;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
}

.comma-compare-table tbody tr:last-child td,
.comma-compare-table tbody tr:last-child th {
    border-bottom: none;
}

.comma-compare-table tbody tr:nth-child(even) td:not(:first-child) {
    background: rgba(248, 250, 252, 0.85);
}

.comma-compare-table thead th {
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    font-weight: 700;
    color: #1c274c;
    border-bottom: 2px solid #e2e8f0;
    vertical-align: top;
    padding-top: 20px;
    padding-bottom: 20px;
}

.comma-compare-table thead th:first-child {
    vertical-align: middle;
}

.comma-compare-table th:first-child,
.comma-compare-table td:first-child {
    width: 130px;
    min-width: 130px;
    text-align: right;
    font-weight: 700;
    color: #1c274c;
    background: #fafbfd;
    position: sticky;
    right: 0;
    z-index: 2;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.04);
    border-left: 1px solid #eef2f7;
}

.comma-compare-table thead th:first-child {
    z-index: 3;
    border-radius: 0;
}

.comma-compare-table__corner-label {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 0.85rem;
}

.comma-compare-table__corner-label span {
    font-size: 1.5rem;
}

/* ---- کارت محصول در هدر جدول ---- */
.comma-compare-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 0;
}

.comma-compare-product-card__remove {
    position: absolute;
    top: -4px;
    left: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.2s, color 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comma-compare-product-card__remove:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: scale(1.08);
}

.comma-compare-product-card__image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    height: 110px;
    border-radius: 20px;
    border: 1px solid rgba(255, 103, 0, 0.25);
    background: #fbfbfb;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.comma-compare-product-card__image:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(255, 103, 0, 0.12);
}

.comma-compare-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.comma-compare-product-card__title {
    display: block;
    font-weight: 700;
    font-size: 0.88rem;
    color: #1a0744;
    text-decoration: none;
    line-height: 1.55;
    max-width: 160px;
    transition: color 0.2s;
}

.comma-compare-product-card__title:hover {
    color: #ff6700;
}

/* ---- سلول‌های داده ---- */
.comma-compare-table__price {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 6px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff6700, #ff8534);
    color: #fff;
    font-weight: 700;
}

.comma-compare-table__price .amount,
.comma-compare-table__price ins,
.comma-compare-table__price bdi {
    color: #fff !important;
    text-decoration: none;
}

.comma-compare-table__price del {
    opacity: 0.75;
    font-size: 0.82em;
    margin-left: 6px;
}

.comma-compare-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
}

.comma-compare-badge.is-in-stock {
    background: #dcfce7;
    color: #15803d;
}

.comma-compare-badge.is-out-of-stock {
    background: #fee2e2;
    color: #b91c1c;
}

.comma-compare-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.comma-compare-table__desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.65;
    text-align: center;
}

.comma-compare-table__empty-val {
    color: #cbd5e1;
    font-size: 1.1rem;
}

.comma-compare-table .star-rating {
    margin: 0 auto;
}

.comma-compare-table__no-rating {
    font-size: 0.85rem;
    color: #94a3b8;
}

.comma-compare-row--actions td {
    padding-top: 20px;
    padding-bottom: 20px;
    background: #fafbfd !important;
}

.comma-compare-table__cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 160px;
    padding: 10px 16px;
    border-radius: 12px;
    background: #1c274c;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 3px 10px rgba(28, 39, 76, 0.15);
}

.comma-compare-table__cart-btn:hover {
    background: #378fc6;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(55, 143, 198, 0.3);
}

.comma-compare-table__cart-btn.is-outline {
    background: #fff;
    color: #1c274c !important;
    border: 1px solid #dbe3f0;
    box-shadow: none;
}

.comma-compare-table__cart-btn.is-outline:hover {
    border-color: #378fc6;
    color: #378fc6 !important;
    background: rgba(55, 143, 198, 0.06);
}

.comma-compare-table tbody tr:hover td:not(:first-child) {
    background: rgba(55, 143, 198, 0.04);
}

/* ---- ریسپانسیو ---- */
@media (max-width: 768px) {
    .comma-compare-page {
        padding: 16px 12px 40px;
    }

    .comma-compare-page__header {
        margin-bottom: 20px;
    }

    .comma-compare-page__count-badge {
        min-width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .comma-compare-table th:first-child,
    .comma-compare-table td:first-child {
        width: 100px;
        min-width: 100px;
        font-size: 0.82rem;
        padding: 12px 10px;
    }

    .comma-compare-product-card__image {
        width: 88px;
        height: 88px;
        border-radius: 16px;
    }

    .comma-compare-table th,
    .comma-compare-table td {
        padding: 12px 10px;
        font-size: 0.85rem;
    }
}
