/**
 * Стили для страницы сравнения устройств
 */

/* Основной контейнер */
.device-comparison-page {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.comparison-header {
    text-align: center;
    margin-bottom: 40px;
}

.comparison-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

/* Заголовки устройств */
.comparison-devices-header {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    position: sticky;
    top: 32px; /* Учитывая админ-бар WordPress */
    background: #fff;
    z-index: 100;
    padding: 20px 0;
    border-bottom: 2px solid #e0e0e0;
}

.device-header-item {
    flex: 1;
    text-align: center;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}

.device-header-item img {
    max-width: 200px;
    height: auto;
    margin-bottom: 15px;
}

.device-header-item h2 {
    font-size: 20px;
    margin: 0 0 10px 0;
}

.device-price {
    font-size: 24px;
    font-weight: 700;
    color: #2271b1;
    margin: 10px 0;
}

.device-remove-btn {
    margin-top: 10px;
    color: #999;
    cursor: pointer;
    font-size: 14px;
}

.device-remove-btn:hover {
    color: #d63638;
}

/* Таблица сравнения */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 40px;
}

.comparison-section-header {
    background: #f7f7f7;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 700;
    text-align: left;
    border-top: 3px solid #2271b1;
}

.comparison-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    min-height: 60px;
}

.comparison-row:hover {
    background: #f9f9f9;
}

.spec-label {
    flex: 0 0 250px;
    padding: 15px 20px;
    font-weight: 600;
    color: #333;
}

.spec-values {
    display: flex;
    flex: 1;
    gap: 20px;
}

.spec-value {
    flex: 1;
    padding: 15px;
    text-align: center;
    position: relative;
}

/* Индикатор победителя */
.spec-value.winner {
    background: #e7f5e7;
    border-left: 3px solid #28a745;
    font-weight: 700;
}

.spec-value.winner::before {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: #28a745;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Трёхполосная схема разницы: close = 5–15% (жёлтый), tie = ±5% (нейтр.), lose = >15% */
.spec-value.close {
    background: #fff6e0;
    border-left: 3px solid #c77f00; /* контраст текста сохраняется, тёмно-янтарный */
    font-weight: 600;
}

.spec-value.tie {
    background: #f4f4f5;
    border-left: 3px solid #9aa0a6;
}

.spec-value.lose {
    background: transparent;
}

/* Прогресс-бары */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #81c784);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar.winner {
    background: linear-gradient(90deg, #28a745, #5cb85c);
}

.progress-bar.medium {
    background: linear-gradient(90deg, #2196f3, #64b5f6);
}

.progress-bar.low {
    background: linear-gradient(90deg, #9e9e9e, #bdbdbd);
}

/* Иконки для булевых значений */
.spec-value .icon-yes {
    color: #28a745;
    font-size: 20px;
}

.spec-value .icon-no {
    color: #999;
    font-size: 20px;
}

/* Навигация по разделам */
.comparison-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.comparison-nav a {
    padding: 10px 20px;
    background: #f0f0f0;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.comparison-nav a:hover,
.comparison-nav a.active {
    background: #2271b1;
    color: #fff;
}

/* Блок "Где купить" */
.device-buy-block {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
}

.device-buy-block h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
}

.buy-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.buy-link-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.3s;
}

.buy-link-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.store-name {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
}

.store-price {
    font-size: 20px;
    font-weight: 700;
    color: #2271b1;
}

.buy-button {
    padding: 10px 25px;
    background: #2271b1;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s;
}

.buy-button:hover {
    background: #135e96;
    color: #fff;
}

/* Кнопка "Показать различия" */
.comparison-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.comparison-controls button {
    padding: 10px 20px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.comparison-controls button:hover {
    background: #e0e0e0;
}

.comparison-controls button.active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

/* Вердикт */
.comparison-verdict {
    background: #fff;
    border: 2px solid #2271b1;
    border-radius: 8px;
    padding: 30px;
    margin: 40px 0;
}

.comparison-verdict h2 {
    text-align: center;
    margin: 0 0 30px 0;
    font-size: 28px;
    color: #2271b1;
}

.verdict-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.verdict-device {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
}

.verdict-device h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
}

.verdict-device ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.verdict-device li {
    padding: 8px 0;
    padding-left: 30px;
    position: relative;
}

.verdict-device li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 8px;
    width: 20px;
    height: 20px;
    background: #28a745;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Похожие сравнения */
.similar-comparisons {
    margin: 40px 0;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
}

.similar-comparisons h3 {
    margin: 0 0 20px 0;
    font-size: 22px;
}

.similar-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.similar-links a {
    padding: 12px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.similar-links a:hover {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

/* Темная тема */
body.dark-mode .comparison-table,
body.dark-mode .device-header-item,
body.dark-mode .buy-link-item {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: #333;
}

body.dark-mode .comparison-row:hover {
    background: #2a2a2a;
}

body.dark-mode .comparison-section-header {
    background: #2a2a2a;
    color: #e0e0e0;
}

/* ==========================================================================
   Страница выбора устройств (/compare/)
   ========================================================================== */

.dc-picker-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.dc-picker-header {
    text-align: center;
    margin-bottom: 36px;
}

.dc-picker-header h1 {
    margin: 0 0 12px;
    font-size: clamp(26px, 4vw, 40px);
    line-height: 1.15;
}

.dc-picker-lead {
    margin: 0 auto;
    max-width: 620px;
    color: #555;
    font-size: 16px;
    line-height: 1.6;
}

.dc-picker-empty {
    text-align: center;
    color: #555;
    padding: 32px 0;
}

/* Подборщик */
.dc-picker {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 20px;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 2px 14px rgba(20, 24, 32, .05);
}

.dc-picker-slot {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.dc-picker-thumb {
    aspect-ratio: 1 / 1;
    max-height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f7f9;
    border-radius: 12px;
    overflow: hidden;
}

.dc-picker-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.dc-picker-label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dc-picker-select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #cbd2d9;
    border-radius: 8px;
    background: #fff;
    color: #1f2933;
    cursor: pointer;
}

.dc-picker-select:focus-visible,
.dc-picker-submit:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.dc-picker-vs {
    align-self: center;
    font-weight: 700;
    font-size: 15px;
    color: #6b7280;
    background: #f0f2f5;
    border-radius: 999px;
    padding: 10px 14px;
}

.dc-picker-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.dc-picker-submit {
    min-height: 48px;
    padding: 12px 42px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #2563eb;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s ease;
}

.dc-picker-submit:hover {
    background: #1d4ed8;
}

.dc-picker-error {
    margin: 0;
    color: #b42318;
    font-size: 14px;
}

/* Последние добавленные */
.dc-latest {
    margin-top: 56px;
}

.dc-latest-title {
    margin: 0 0 20px;
    font-size: clamp(20px, 2.6vw, 28px);
}

.dc-latest-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.dc-latest-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
    padding: 14px;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.dc-latest-link:hover {
    border-color: #cbd2d9;
    box-shadow: 0 4px 16px rgba(20, 24, 32, .08);
}

.dc-latest-link:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.dc-latest-thumb {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f7f9;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 4px;
}

.dc-latest-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.dc-latest-brand {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dc-latest-name {
    font-weight: 600;
    line-height: 1.35;
}

.dc-latest-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
    font-size: 13px;
    color: #6b7280;
}

@media (max-width: 700px) {
    .dc-picker {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .dc-picker-vs {
        justify-self: center;
    }
}

/* ==========================================================================
   Заглушка изображения устройства (пока нет фото)
   ========================================================================== */

.dc-ph {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 100%;
    min-height: 120px;
    padding: 14px;
    box-sizing: border-box;
    text-align: center;
    background:
        linear-gradient(160deg,
            color-mix(in srgb, var(--dc-ph-color, #6b7280) 12%, #fff) 0%,
            color-mix(in srgb, var(--dc-ph-color, #6b7280) 4%, #fff) 100%);
    border-radius: 10px;
}

/* Силуэт телефона */
.dc-ph__phone {
    flex: none;
    width: 34px;
    height: 56px;
    border: 2px solid var(--dc-ph-color, #6b7280);
    border-radius: 7px;
    opacity: .5;
    position: relative;
}

.dc-ph__phone::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 2px;
    border-radius: 2px;
    background: var(--dc-ph-color, #6b7280);
}

.dc-ph__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.25;
    min-width: 0;
}

.dc-ph__brand {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dc-ph-color, #6b7280);
}

.dc-ph__model {
    font-size: 13px;
    font-weight: 600;
    color: #3f4854;
    overflow-wrap: anywhere;
}

/* Компактный вариант — в карточках «Последние добавленные» */
.dc-ph--sm .dc-ph__phone {
    width: 26px;
    height: 42px;
}

.dc-ph--sm .dc-ph__model {
    font-size: 12px;
}

.dc-ph--sm .dc-ph__brand {
    font-size: 10px;
}

/* Фолбэк для браузеров без color-mix */
@supports not (background: color-mix(in srgb, red 10%, white)) {
    .dc-ph {
        background: #f4f6f8;
    }
}

/* Пустой слот подборщика */
.dc-picker-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.dc-picker-thumb-empty .dc-ph__phone {
    width: 44px;
    height: 72px;
    border: 2px solid #c3c9d2;
    border-radius: 9px;
    opacity: .7;
    position: relative;
}

.dc-picker-thumb-empty .dc-ph__phone::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: #c3c9d2;
}
