/* Product compare */
.compare-page {
    direction: rtl;
}

.compare-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 30px #ccc;
    overflow: hidden;
}

.compare-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.compare-header-title {
    font-family: yekan, iransans;
    font-size: 18px;
    color: #222;
}

.compare-header-title i {
    color: #4285F4;
    margin-left: 8px;
}

.compare-type-badge {
    display: inline-block;
    margin-right: 8px;
    padding: 3px 10px;
    font-size: 12px;
    background: #e8f0fe;
    color: #1967d2;
    border-radius: 20px;
    font-family: iransans;
}

.compare-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.compare-diff-toggle {
    font-family: iransans;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.compare-diff-count {
    background: #fbbc04;
    color: #222;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
}

.compare-link-btn {
    font-family: yekan, iransans;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.compare-link-btn:hover {
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
}

.compare-link-btn.primary {
    background: #4285F4;
    border-color: #4285F4;
    color: #fff;
}

.compare-link-btn.primary:hover {
    background: #3367d6;
    color: #fff;
}

.compare-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compare-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-family: iransans;
    font-size: 13px;
}

.compare-table th,
.compare-table td {
    border: 1px solid #eee;
    vertical-align: top;
    padding: 12px;
    text-align: center;
}

.compare-sticky-col {
    position: sticky;
    right: 0;
    background: #fafafa;
    z-index: 2;
    min-width: 140px;
    max-width: 180px;
    text-align: right !important;
    font-weight: bold;
    color: #333;
    box-shadow: -2px 0 6px rgba(0,0,0,0.04);
}

.compare-product-col {
    min-width: 180px;
    max-width: 220px;
    background: #fff;
}

.compare-product-head {
    position: relative;
    padding-top: 8px;
}

.compare-product-head img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 0 auto 10px;
    display: block;
}

.compare-product-title {
    display: block;
    color: #333;
    text-decoration: none;
    font-family: iransans2, iransans;
    font-size: 13px;
    line-height: 1.6;
    min-height: 42px;
    margin-bottom: 8px;
}

.compare-product-title:hover {
    color: #4285F4;
    text-decoration: none;
}

.compare-product-price {
    font-family: BYekan, iransans;
    font-size: 18px;
    color: #111;
}

.compare-product-price small {
    font-family: yekan;
    font-size: 12px;
    color: #666;
    margin-right: 4px;
}

.compare-na {
    color: #999;
    font-size: 13px;
    font-family: iransans;
}

.compare-remove-x {
    position: absolute;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #f1f3f4;
    color: #555;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.compare-remove-x:hover {
    background: #ea4335;
    color: #fff;
}

.compare-cart-btn {
    background: #4285F4;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-family: yekan;
    font-size: 13px;
    cursor: pointer;
}

.compare-cart-btn:hover {
    background: #3367d6;
}

.compare-feature-key {
    font-size: 12px;
    line-height: 1.7;
}

.compare-feature-val {
    font-size: 13px;
    line-height: 1.7;
    color: #333;
    direction: rtl;
}

.compare-feature-row.is-diff .diff-val {
    background: #fff8e1;
    font-weight: 600;
}

.compare-feature-row.is-same {
    background: #fff;
}

.compare-table tbody tr:nth-child(even).is-same {
    background: #fafafa;
}

.compare-table tbody tr.is-same .compare-sticky-col {
    background: #f5f5f5;
}

.compare-table tbody tr.is-diff .compare-sticky-col {
    background: #fff3cd;
}

.compare-empty-features {
    padding: 40px !important;
    color: #888;
    text-align: center !important;
}

.compare-page.hide-same .compare-feature-row.is-same {
    display: none;
}

/* Floating compare bar */
#compare_float_bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #1a2332;
    color: #fff;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.25);
    transform: translateY(110%);
    transition: transform 0.28s ease;
    font-family: yekan, iransans;
    direction: rtl;
}

#compare_float_bar.is-visible {
    transform: translateY(0);
}

.compare-bar-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.compare-bar-items {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.compare-bar-slot {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px dashed rgba(255,255,255,0.25);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-bar-slot.filled {
    border-style: solid;
    border-color: rgba(255,255,255,0.2);
    background: #fff;
}

.compare-bar-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.compare-bar-slot .cmp-x {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: #ea4335;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.compare-bar-slot .cmp-plus {
    color: rgba(255,255,255,0.35);
    font-size: 20px;
}

.compare-bar-meta {
    font-size: 13px;
    color: #c5d0de;
    min-width: 90px;
}

.compare-bar-meta strong {
    color: #fff;
    font-size: 16px;
}

.compare-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.compare-bar-btn {
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-family: yekan;
    font-size: 14px;
    cursor: pointer;
}

.compare-bar-btn.go {
    background: #4285F4;
    color: #fff;
}

.compare-bar-btn.go:disabled {
    background: #555;
    color: #aaa;
    cursor: not-allowed;
}

.compare-bar-btn.clear {
    background: transparent;
    color: #c5d0de;
    border: 1px solid rgba(255,255,255,0.2);
}

.compare-bar-btn.clear:hover {
    background: rgba(255,255,255,0.08);
}

/* Product card / detail compare toggle */
.compare-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 8px;
    padding: 7px 10px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    background: #fff;
    color: #444;
    font-family: yekan, iransans;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.compare-toggle-btn:hover {
    border-color: #4285F4;
    color: #4285F4;
}

.compare-toggle-btn.is-active {
    background: #e8f0fe;
    border-color: #4285F4;
    color: #1967d2;
}

.compare-toggle-btn i {
    font-size: 13px;
}

.compare-toggle-btn.detail {
    width: auto;
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 15px;
}

/* Icon-only compare button over product image */
.product-main-image-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 100%;
}

.product-main-image-wrap > img {
    display: block;
    width: 100%;
    height: auto;
}

.compare-toggle-btn.compare-icon-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    width: 40px;
    height: 40px;
    min-width: 40px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.06);
    background: rgba(255,255,255,.92);
    color: #6b7280;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
    gap: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.compare-toggle-btn.compare-icon-btn:hover,
.compare-toggle-btn.compare-icon-btn:focus,
.compare-toggle-btn.compare-icon-btn:active,
.compare-toggle-btn.compare-icon-btn:focus-visible {
    outline: none;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.compare-toggle-btn.compare-icon-btn::-moz-focus-inner {
    border: 0;
    padding: 0;
}

.compare-toggle-btn.compare-icon-btn:hover {
    color: #4285F4;
    border-color: #4285F4;
    background: #fff;
}

.compare-toggle-btn.compare-icon-btn.is-active {
    background: #e8f0fe;
    border-color: #4285F4;
    color: #1967d2;
}

.compare-toggle-btn.compare-icon-btn i {
    font-size: 15px;
    margin: 0;
    padding: 0;
}

/* Listing cards (product type page) */
.product-card-box > .compare-toggle-btn.compare-icon-btn {
    z-index: 6;
    width: 34px;
    height: 34px;
    min-width: 34px;
    top: 8px;
    left: 8px;
}

.product-card-box > .compare-toggle-btn.compare-icon-btn i {
    font-size: 13px;
}

@media screen and (max-width: 576px) {
    .compare-toggle-btn.compare-icon-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        top: 8px;
        left: 8px;
    }
    .compare-toggle-btn.compare-icon-btn i {
        font-size: 13px;
    }
}

#compare_toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #323232;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-family: iransans;
    font-size: 13px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    max-width: 90%;
    text-align: center;
    direction: rtl;
}

#compare_toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#compare_toast.is-error {
    background: #c5221f;
}

@media screen and (max-width: 576px) {
    .compare-bar-slot {
        width: 48px;
        height: 48px;
    }
    .compare-header-title {
        font-size: 15px;
    }
    .compare-product-head img {
        width: 90px;
        height: 90px;
    }
    body.has-compare-bar {
        padding-bottom: 90px;
    }
}
