/**
 * Product Comparison — Styles
 */

/* ── Compare Button on Cards ─────────────────────── */
.catalog-card-compare-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(4px);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    z-index: 20;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.catalog-card-compare-btn:hover,
.catalog-card-compare-btn.active {
    background: var(--cat-primary, #6366f1);
    color: #fff;
    transform: scale(1.1);
}
.catalog-card-compare-btn.active {
    box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
.catalog-card-img-wrap { position: relative; }

/* ── Floating Compare Bar ────────────────────────── */
.compare-bar {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(99,102,241,0.4);
    padding: 12px 24px;
    display: none;
    align-items: center;
    gap: 16px;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.35);
    animation: compareBarIn 0.3s ease;
}
.compare-bar.visible { display: flex; }
@keyframes compareBarIn {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.compare-bar-label {
    font-size: 0.82rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}
.compare-bar-items {
    display: flex;
    gap: 10px;
    flex: 1;
    overflow-x: auto;
}
.compare-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 6px 10px 6px 8px;
    min-width: 160px;
    max-width: 200px;
    flex-shrink: 0;
}
.compare-bar-item img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.compare-bar-item-placeholder {
    width: 36px; height: 36px;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    color: #475569; font-size: 0.9rem;
    flex-shrink: 0;
}
.compare-bar-item-name {
    font-size: 0.78rem;
    color: #e2e8f0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}
.compare-bar-item-name:hover {
    color: #a1a2fe;
}
.compare-bar-item-remove {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px;
    font-size: 0.75rem;
    transition: color 0.15s;
    flex-shrink: 0;
}
.compare-bar-item-remove:hover { color: #ef4444; background-color: #6365f100; }
.compare-bar-slot-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 52px;
    border: 2px dashed rgba(255,255,255,0.12);
    border-radius: 10px;
    color: #475569;
    font-size: 0.78rem;
    flex-shrink: 0;
}
.compare-bar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.compare-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s;
}
.compare-bar-btn-primary {
		background: linear-gradient(135deg, #474766, #485075);
    color: #fff;
}
.compare-bar-btn-primary:hover {
		background: linear-gradient(135deg, #6366f1, #4446b5);
		color: #ffffff;
}
.compare-bar-btn-ghost {
    background: rgba(255,255,255,0.08);
    color: #94a3b8;
}
.compare-bar-btn-ghost:hover { background: rgba(255,255,255,0.15); color: #e2e8f0; }

.compare-bar-minimize {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1rem;
    padding: 8px;
    margin-left: -8px;
    transition: color 0.2s;
}
.compare-bar-minimize:hover { color: #94a3b8;background-color: #282e40; }

.compare-bar-restore {
    display: none;
    position: fixed;
    bottom: 65px;
    left: 5px;
    width: 32px;
    height: 32px;
    background: var(--cat-primary, #6366f1);
    color: #fff;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 15px rgba(99,102,241,0.4);
    z-index: 1002;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.compare-bar-restore .restore-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

.compare-bar.minimized {
    display: none !important;
}
.compare-bar.minimized ~ .compare-bar-restore {
    display: flex;
}

/* ── Compare Tabs / CFG Select (compare.php) ───────── */
.compare-tabs-carousel {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 16px;
}

.compare-tabs-arrow {
    /* width: 34px;
    height: 34px; */
    border-radius: 10px;
    border: none;
    cursor: pointer;
    background: rgba(255,255,255,0.08);
    color: #c5c8f8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex: 0 0 auto;
}

.compare-tabs-arrow:hover {
    background: rgba(255,255,255,0.14);
    color: #6366f1;
}

.compare-tabs-bar {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    /* padding: 2px 0 6px; */
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none; /* Firefox */
    flex: 1 1 auto;
}

.compare-tabs-bar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.compare-tab-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    background: transparent;
    border: none;
    color: #94a3b8;
    border-radius: 0;
    padding: 0 5px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s;
    white-space: nowrap;
}

.compare-tab-btn:hover {
    background: transparent;
    border-color: transparent;
    color: #9c9efd;
	}

.compare-tab-btn.active {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--cat-primary, #6366f1);
}

.compare-cfg-select-wrap {
    margin-top: 5px;
}

.compare-cfg-select {
    width: 100%;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.07);
    color: #6366f1;
    padding: 9px 0;
    font-weight: 600;
    cursor: pointer;
		font-size: 0.95rem;
}

.compare-cfg-select option {
    color: #111827;
}

.compare-tab-row {
    /* keep rows visually separated */
}

.compare-tab-row[style*="display: none"] {
    /* keep JS toggling safe */
}

/* ── Compare Page ────────────────────────────────── */
.compare-page-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}
.compare-page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.compare-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    display: flex;
    align-items: center;
    gap: 10px;
}
.compare-page-title i { color: var(--cat-primary, #6366f1); }
.compare-share-btn {
		display: inline-flex;
    align-items: center;
    gap: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--cat-primary, #6366f1);
    cursor: pointer;
    border: 1px solid rgba(99, 102, 241, 0.25);
    transition: all 0.2s;
    text-decoration: none;
    justify-content: center;
}
.compare-share-btn i {
    font-size: 1.05rem;
    line-height: 1;
}
.compare-share-btn:hover { background: var(--cat-primary,#6366f1); color: #fff; }

/* Compare table */
.compare-table-wrap {
    overflow-x: auto;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.09);
}
.compare-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.9rem;
}
.compare-table th,
.compare-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    text-align: left;
}
.compare-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    max-width: 250px;
    min-width: 140px;
}
/* Product header cells */
.compare-product-head {
    text-align: center;
    padding: 20px 18px;
    border-bottom: 2px solid #e2e8f0;
    background: #fff;
    min-width: 220px;

    /* чтобы кнопку "Убрать" можно было ставить сверху справа */
    position: relative;
}
.compare-product-img {
    width: 140px;
    object-fit: contain;
    border-radius: 12px;
    margin: 0 auto 12px;
    display: block;
    background: #f8fafc;
}
.compare-product-img-placeholder {
    width: 140px;
    /* height: 140px; */
    border-radius: 12px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #cbd5e1;
    margin: 0 auto 12px;
}
.compare-product-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
    line-height: 1.3;
		text-wrap: wrap;
}
.compare-product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cat-primary, #6366f1);
    margin: 6px 0;
}
.compare-product-price-req {
    font-size: 0.82rem;
    color: #94a3b8;
}
.compare-product-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--cat-primary, #6366f1);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.compare-product-link:hover { opacity: 0.85;color:#ffffff; }
.compare-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 999px;
    background: #fb5252;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.compare-remove-btn:hover {
    background: #dc2626;
		color: #ffffff;
    opacity: 0.95;
}

/* Row types */
.compare-row-label {
    font-weight: 600;
    color: #334155;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
    width: 250px;
}

.compare-row-value {
    color: #1e293b;
    max-width: 250px;
    width: 250px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}

/* Show hand cursor only when text is truncated */
.compare-row-label.compare-text-clickable,
.compare-row-value.compare-text-clickable {
    cursor: pointer;
}

/* Expand on click (show full text)
   - label: можно раскрывать шире
   - value: не снимаем ширину 250px, чтобы блок значений не разъезжался
*/
.compare-row-label.compare-text-expanded {
    max-width: none !important;
    width: auto !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.compare-row-value.compare-text-expanded {
    max-width: 250px !important;
    width: 250px !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}
.compare-row-value.compare-diff {
    background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(251,191,36,0.06));
    color: #92400e;
    font-weight: 600;
    position: relative;
}
.compare-row-value.compare-diff::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #f59e0b;
    border-radius: 2px;
}
.compare-row-value.compare-best {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(16,185,129,0.06));
    color: #065f46;
    font-weight: 700;
}
.compare-row-value.compare-best::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #10b981;
    border-radius: 2px;
}
.compare-row-value.compare-na {
    color: #cbd5e1;
    font-style: italic;
    font-size: 0.82rem;
}
/* Section header rows */
.compare-section-row th,
.compare-section-row td {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    font-weight: 700;
    color: var(--cat-primary, #6366f1);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 18px;
    border-bottom: 2px solid #e2e8f0;
}
/* Only show differences toggle */
.compare-filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.compare-filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    user-select: none;
}
.compare-filter-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--cat-primary, #6366f1);
    cursor: pointer;
}

/* Compare Only-Diff switch (compare.php) */
.compare-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
		margin-bottom: 0;
}

.compare-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.compare-switch-slider {
    width: 46px;
    height: 24px;
    border-radius: 999px;
    background: #94a3b8;
    position: relative;
    transition: background 0.15s ease;
    flex: 0 0 auto;
}

.compare-switch-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.compare-switch input:checked + .compare-switch-slider {
    background: var(--cat-primary, #6366f1);
}

.compare-switch input:checked + .compare-switch-slider::after {
    transform: translateX(22px);
}

.compare-switch-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-secondary, #64748b);
}

/* Optional hover */
.compare-switch:hover .compare-switch-slider {
    filter: brightness(1.02);
}

/* Legend (Отличие / Лучшее значение) */
.compare-legend {
    display: inline-flex;
    align-items: center;   /* вертикально по центру против switch */
    gap: 6px;
    line-height: 1;
    white-space: nowrap;
		align-items: flex-end;
}

/* prettier larger dots */
.compare-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border: 2px solid rgba(255,255,255,0.95);
    flex: 0 0 auto;
    transform: translateY(1px); /* подровнять оптический центр */
}

.compare-legend-dot-diff {
    background: #f59e0b; /* orange */
}

.compare-legend-dot-best {
    background: #10b981; /* green */
}

.compare-empty {
    text-align: center;
    padding: 80px 20px;
    color: #94a3b8;
}
.compare-empty i { font-size: 3rem; margin-bottom: 16px; }
.compare-empty h3 { font-size: 1.3rem; margin-bottom: 8px; color: #475569; }

/* Share toast */
.compare-share-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
    white-space: nowrap;
    pointer-events: none;
}
.compare-share-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Sticky Header Bar ──────────────────────────── */
.compare-sticky-bar {
    position: fixed;
    top: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    z-index: 900;
    overflow: hidden;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 2px solid var(--cat-primary, #6366f1);
}
.compare-sticky-bar.show {
    transform: translateY(0);
}
.compare-sticky-inner {
    display: flex;
    height: 100%;
}
.compare-sticky-col {
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #f1f5f9;
    flex-shrink: 0;
    box-sizing: border-box;
}
.compare-sticky-col-first {
    background: rgba(248, 250, 252, 0.95);
    border-right: 1px solid #e2e8f0;
    z-index: 2;
}
.compare-sticky-col-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    width: 100%;
}
.compare-sticky-col-content img {
    /* width: 40px; */
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #f1f5f9;
}
.compare-sticky-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.compare-sticky-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.compare-sticky-price {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--cat-primary, #6366f1);
    white-space: nowrap;
}

/* ── Compare Bar Modal (Global) ────────────────────── */
.compare-bar-badge {
    background: var(--cat-primary, #6366f1);
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 6px;
}
.compare-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 990;
    backdrop-filter: blur(2px);
}
.compare-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}
.compare-bar-mobile-toggle {
    display: inline-flex;
}

/* Modal States */
.compare-bar.modal-open .compare-modal-overlay {
    display: block;
    cursor: pointer;
}
.compare-bar-modal-wrapper {
    display: none;
}
.compare-bar.modal-open .compare-bar-modal-wrapper {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 80px; 
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 90%;
    max-width: 480px;
    background: #1e293b;
    border-radius: 12px;
    padding: 16px;
    z-index: 1001;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    animation: compareBarIn 0.3s ease;
}
.compare-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    margin-bottom: 12px;
    font-weight: 600;
    width: 100%;
}
.compare-modal-close {
    background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 1.2rem;
}
.compare-modal-close:hover { color: #6c757d;
    background-color: #0000000a;
 }

.compare-bar-items {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 60vh;
    width: 100%;
    display: none;
}
.compare-bar.modal-open .compare-bar-items {
    display: flex;
}
.compare-bar-item {
    max-width: none;
    margin-bottom: 8px;
}
.compare-bar-slot-empty {
    width: auto;
    height: 48px;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .compare-bar {
        padding: 10px 16px;
    }
    .compare-bar-label { display: none; }
    .compare-bar.modal-open .compare-bar-modal-wrapper {
        bottom: 74px; /* just above the bar */
        left: 16px; right: 16px;
        width: auto;
        transform: none;
    }
    .compare-bar-actions .compare-bar-btn .compare-btn-text {
        display: none;
    }
}
