/* ==============================================
   ВЫБОР ДИЗАЙНА ВЫНОСА РАДИАТОРА (карточка v2)
   Компактная карточка + модальное окно
   ============================================== */

.radiator-selector {
    background: var(--bg-card, rgba(24, 24, 24, 0.92));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 22px;
    padding: 22px;
    margin: 22px 0;
}

.rs-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.rs-title { font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: 700; color: #fff; margin: 0; }
.rs-req {
    font-size: 11px; font-weight: 700; color: var(--accent, #ff5a1f);
    background: rgba(255, 90, 31, 0.12); padding: 3px 10px; border-radius: 99px;
    text-transform: uppercase; letter-spacing: 0.04em;
}

/* ---------- Компактная карточка выбранного ---------- */
.rs-current { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }

.rs-current-preview {
    background: radial-gradient(circle at 50% 40%, #f4f4f4, #d9d9d9);
    border-radius: 16px; padding: 12px; aspect-ratio: 1 / 0.86;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.rs-current-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Пустое состояние — дизайн ещё не выбран */
.rs-preview-empty { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-tertiary, #8a8a8a); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.radiator-selector[data-chosen="0"] #rsPreviewImg { display: none; }
.radiator-selector[data-chosen="0"] .rs-preview-empty { display: flex; }
.radiator-selector[data-chosen="0"] .rs-current-preview {
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.16);
    box-shadow: none;
}
.radiator-selector[data-chosen="0"] .rs-current-code { color: var(--text-tertiary, #8a8a8a); }

/* Подсветка блока, если жмут «в корзину» без выбранного дизайна */
.radiator-selector.rs-nudge { animation: rsNudge 0.5s ease; }
@keyframes rsNudge {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.radiator-selector.rs-nudge .rs-req { animation: rsReqPulse 0.6s ease; }
@keyframes rsReqPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); background: rgba(255, 90, 31, 0.28); }
}

.rs-current-code { font-family: 'Montserrat', sans-serif; font-size: 17px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.rs-current-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.rs-badge { font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 99px; }
.rs-badge-color { background: rgba(229, 57, 53, 0.15); color: #ff6b6b; border: 1px solid rgba(229, 57, 53, 0.35); }

.rs-open-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255, 90, 31, 0.1); border: 1px solid rgba(255, 90, 31, 0.35);
    color: var(--accent, #ff5a1f); font-size: 14px; font-weight: 600;
    padding: 10px 18px; border-radius: 12px; cursor: pointer;
    transition: background 0.18s, border-color 0.18s; font-family: inherit;
}
.rs-open-btn:hover { background: rgba(255, 90, 31, 0.18); border-color: var(--accent, #ff5a1f); }

/* ---------- Поле "Ваша надпись" ---------- */
.rs-textfield { display: none; margin-top: 14px; }
.rs-textfield.on { display: block; }
.rs-textfield label { display: block; font-size: 13px; color: var(--text-secondary, #b2b2b2); margin-bottom: 8px; }
.rs-textfield input {
    width: 100%; background: #0d0d0d; border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 12px; padding: 12px 14px; color: #fff; font-size: 15px; outline: none; transition: border-color 0.2s;
}
.rs-textfield input:focus { border-color: var(--accent, #ff5a1f); }
.rs-textfield-hint { display: block; font-size: 11px; color: var(--text-tertiary, #8a8a8a); margin-top: 6px; }

.rs-price-note { font-size: 12px; color: var(--text-tertiary, #8a8a8a); line-height: 1.5; margin-top: 16px; }

/* Кнопка «В корзину» в заблокированном виде (дизайн не выбран) */
.add-to-cart.rs-add-locked { opacity: 0.7; filter: saturate(0.7); }

/* ---------- Модальное окно ---------- */
.rs-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.rs-modal[hidden] { display: none; }
.rs-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(3px); }

.rs-modal-box {
    position: relative; width: 100%; max-width: 860px; max-height: 88vh;
    display: flex; flex-direction: column;
    background: var(--bg-secondary, #101010); border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); overflow: hidden;
    animation: rsModalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes rsModalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

.rs-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08)); flex-shrink: 0;
}
.rs-modal-title { font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: 700; color: #fff; margin: 0; }
.rs-modal-close {
    width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    color: var(--text-secondary, #b2b2b2); cursor: pointer; transition: all 0.18s;
}
.rs-modal-close:hover { background: rgba(255, 90, 31, 0.12); color: var(--accent, #ff5a1f); border-color: rgba(255, 90, 31, 0.3); }

/* Фильтры */
.rs-filters { display: flex; gap: 8px; padding: 16px 22px; flex-wrap: wrap; flex-shrink: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.rs-filter {
    font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 99px; cursor: pointer;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    color: var(--text-secondary, #b2b2b2); transition: all 0.18s; font-family: inherit; white-space: nowrap;
}
.rs-filter:hover { color: #fff; border-color: rgba(255, 90, 31, 0.3); }
.rs-filter.active { background: var(--accent, #ff5a1f); border-color: var(--accent, #ff5a1f); color: #fff; }

/* Сетка внутри модалки */
.rs-modal-grid {
    padding: 18px 22px; overflow-y: auto; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px;
}
.rs-modal-grid::-webkit-scrollbar { width: 8px; }
.rs-modal-grid::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 99px; }

/* Плитка */
.rs-tile { position: relative; background: transparent; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.rs-tile.hidden { display: none; }
.rs-tile-plate {
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 40%, #f2f2f2, #d7d7d7);
    border: 2px solid transparent; border-radius: 14px; padding: 10px;
    aspect-ratio: 1 / 0.86; transition: border-color 0.18s, transform 0.18s;
}
.rs-tile-plate img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rs-tile:hover .rs-tile-plate { border-color: rgba(255, 90, 31, 0.4); transform: translateY(-2px); }
.rs-tile.sel .rs-tile-plate { border-color: var(--accent, #ff5a1f); box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.22), 0 8px 20px rgba(255, 90, 31, 0.15); }
.rs-tile:focus-visible { outline: none; }
.rs-tile:focus-visible .rs-tile-plate { border-color: var(--accent, #ff5a1f); box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.3); }

.rs-tile-code { display: block; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-secondary, #b2b2b2); margin-top: 7px; }
.rs-tile.sel .rs-tile-code { color: var(--accent, #ff5a1f); }

.rs-tile-badges { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 4px; z-index: 2; align-items: flex-end; }
.rs-badge-mini { font-size: 9px; font-weight: 700; padding: 3px 7px; border-radius: 99px; line-height: 1; white-space: nowrap; }
.rs-badge-mini.rs-badge-color { background: #e53935; color: #fff; border: none; }
.rs-badge-mini.rs-badge-text { background: #1e1e1e; color: var(--accent, #ff5a1f); border: 1px solid rgba(255, 90, 31, 0.4); }

.rs-tile-check {
    position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; background: var(--accent, #ff5a1f);
    border-radius: 50%; display: none; align-items: center; justify-content: center; z-index: 2; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.rs-tile.sel .rs-tile-check { display: flex; }

.rs-filter-empty { grid-column: 1 / -1; text-align: center; color: var(--text-tertiary, #8a8a8a); padding: 30px; font-size: 14px; }

@media (max-width: 640px) {
    .radiator-selector { padding: 18px 16px; border-radius: 18px; }

    .rs-head { margin-bottom: 18px; }

    /* Вертикальный стек: превью сверху по центру, инфо и кнопка ниже */
    .rs-current {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: center;
    }
    .rs-current-preview {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    .rs-current-info { display: flex; flex-direction: column; align-items: center; }
    .rs-current-code { font-size: 18px; margin-bottom: 10px; }
    .rs-current-badges { justify-content: center; margin-bottom: 14px; }

    /* Полноширинная кнопка — крупный тач-таргет */
    .rs-open-btn {
        width: 100%;
        justify-content: center;
        min-height: 50px;
        font-size: 15px;
        padding: 0 18px;
    }

    /* Поле надписи — на всю ширину, подписи слева для читаемости */
    .rs-textfield { width: 100%; text-align: left; margin-top: 16px; }

    .rs-price-note { text-align: center; margin-top: 16px; }

    /* Модалка — на весь экран, безопасные зоны */
    .rs-modal { padding: 0; }
    .rs-modal-box {
        max-width: none; max-height: 100dvh; height: 100dvh; border-radius: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .rs-modal-head { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
    .rs-filters { padding: 14px 16px; gap: 8px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .rs-filter { flex-shrink: 0; }
    .rs-modal-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); padding: 16px; gap: 12px; }
    .rs-tile-code { font-size: 13px; }
}
