/**
 * QP Configurator v2.0 — Стили конфигуратора ПК
 */

/* === Основной контейнер === */
#qp-configurator {
    max-width: 1200px;
    margin: 24px auto;
    padding: 24px;
    padding-bottom: 0;
    font-family: inherit;
    background: #6969691F;
    border-radius: 16px;
    color: #fff;
}

/* Wrapper для Elementor — заливаем всю ширину тёмным фоном */
.qp-configurator-wrapper {
    background: #0d0d1a;
}

/* === Двухколоночный layout (десктоп) === */
.qp-cfg-columns {
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .qp-cfg-columns {
        flex-direction: row;
        gap: 28px;
        align-items: flex-start;
    }

    .qp-cfg-col-left {
        flex: 1 1 58%;
        min-width: 0;
    }

    .qp-cfg-col-right {
        flex: 0 0 40%;
        position: sticky;
        top: 24px;
        align-self: flex-start;
    }
}

/* === Ошибка === */
.qp-cfg-error {
    background: #ff4444;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    animation: qp-fade-in 0.3s ease;
}

/* === Секция компонента === */
.qp-cfg-section {
    margin-bottom: 16px;
}

.qp-cfg-section__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 6px;
}

.qp-cfg-section__icon {
    font-size: 20px;
}

.qp-cfg-section__title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.8);
}

/* === Опция (radio-карточка) === */
.qp-cfg-section__options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qp-cfg-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.qp-cfg-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 21, 21, 0.4);
}

.qp-cfg-option--selected {
    background: rgba(148, 21, 21, 0.12);
    border-color: #941515;
    box-shadow: 0 0 0 1px rgba(148, 21, 21, 0.3);
}

.qp-cfg-option--disabled {
    display: none !important;
}

/* Radio скрыт */
.qp-cfg-option__radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Кастомный чек */
.qp-cfg-option__check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
}

.qp-cfg-option--selected .qp-cfg-option__check {
    border-color: #941515;
    background: #941515;
}

.qp-cfg-option--selected .qp-cfg-option__check::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Название */
.qp-cfg-option__name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Бейдж DDR4/DDR5 */
.qp-cfg-option__badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.qp-cfg-option__badge--ddr4 {
    background: rgba(255, 152, 0, 0.2);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.qp-cfg-option__badge--ddr5 {
    background: rgba(0, 200, 83, 0.2);
    color: #69f0ae;
    border: 1px solid rgba(0, 200, 83, 0.3);
}

/* === Карточки корпусов (платформ) === */
.qp-cfg-platforms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.qp-cfg-platform-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.qp-cfg-platform-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 21, 21, 0.4);
}

.qp-cfg-platform-card--selected {
    border-color: #941515;
    background: rgba(148, 21, 21, 0.12);
    box-shadow: 0 0 0 1px rgba(148, 21, 21, 0.3);
}

.qp-cfg-platform-card--disabled {
    display: none !important;
}

.qp-cfg-platform-card__radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.qp-cfg-platform-card__img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: rgba(255, 255, 255, 0.02);
}

.qp-cfg-platform-card__img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: rgba(255, 255, 255, 0.02);
}

.qp-cfg-platform-card__info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.qp-cfg-platform-card__name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

/* Правая колонка — только секции выбора */
.qp-cfg-col-right {
    display: flex;
    flex-direction: column;
}

/* === Кнопки (общие стили, используются в sticky bar) === */
.qp-cfg-total__btn {
    display: block;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.qp-cfg-total__btn--consult {
    background: transparent !important;
    color: #FFFFFF !important;
    border: 1px solid #BBBBBB !important;
}

.qp-cfg-total__btn--consult:hover {
    background: #941515 !important;
    border-color: #941515 !important;
    color: #FFFFFF !important;
    transform: translateY(-1px);
}

.qp-cfg-total__btn--order {
    background: #941515 !important;
    color: #FFFFFF !important;
    border: 1px solid #BBBBBB !important;
}

.qp-cfg-total__btn--order:hover {
    background: #FFFFFF !important;
    color: #000000 !important;
    border-color: #BBBBBB !important;
    transform: translateY(-1px);
}

.qp-cfg-total__btn:active {
    transform: translateY(0);
}

.qp-cfg-total__btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

/* === Sidebar (десктоп) — правая панель конфигурации === */
.qp-cfg-sidebar {
    display: none;
}

@media (min-width: 1025px) {
    .qp-cfg-sidebar {
        display: none;
        flex: 0 0 40%;
        position: relative;
        z-index: 50;
    }

    .qp-cfg-sidebar--open {
        display: block;
    }

    /* Правая колонка скрыта когда sidebar открыт */
    .qp-cfg-col-right--hidden {
        display: none;
    }

    /* Левая колонка занимает оставшееся место */
    .qp-cfg--sidebar-open .qp-cfg-col-left {
        flex: 1 1 58%;
    }

    /* Убираем align-items: flex-start чтобы sidebar растянулся на всю высоту */
    .qp-cfg--sidebar-open .qp-cfg-columns {
        align-items: stretch;
    }
}

.qp-cfg-sidebar__inner {
    padding: 20px;
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

.qp-cfg-sidebar__close {
    position: absolute;
    top: 12px;
    right: 16px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s;
    z-index: 2;
}

.qp-cfg-sidebar__close:hover {
    color: #fff;
}

.qp-cfg-sidebar__title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.qp-cfg-sidebar__components {
    margin-bottom: 16px;
}

/* Каждый компонент — категория сверху, значение снизу */
.qp-cfg-sidebar__item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.qp-cfg-sidebar__item:last-child {
    border-bottom: none;
}

.qp-cfg-sidebar__item-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.qp-cfg-sidebar__item-value {
    font-size: 14px;
    font-weight: 400;
    color: #fff;
}

.qp-cfg-sidebar__price {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.qp-cfg-sidebar__price-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
}

.qp-cfg-sidebar__price-value {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
}

.qp-cfg-sidebar__buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qp-cfg-sidebar__buttons .qp-cfg-total__btn {
    width: 100%;
    text-align: center;
}

/* === Sticky bar === */
.qp-cfg-sticky-bar {
    z-index: 100;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6);
    margin: 24px -24px 0;
    border-radius: 0 0 16px 16px;
}

/* Скрыть бар когда sidebar открыт */
.qp-cfg-sticky-bar--hidden {
    display: none !important;
}

/* Кнопка раскрытия sidebar */
.qp-cfg-sticky-bar__expand {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    transition: background 0.2s;
}

.qp-cfg-sticky-bar__expand:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Скрыть expand на мобайле */
@media (max-width: 1024px) {
    .qp-cfg-sticky-bar__expand {
        display: none;
    }
}

/* Когда бар зафиксирован внизу экрана */
.qp-cfg-sticky-bar--fixed {
    position: fixed;
    bottom: 0;
    border-radius: 0;
    margin: 0;
}

/* Плейсхолдер чтобы контент не прыгал когда бар становится fixed */
.qp-cfg-sticky-bar__placeholder {
    display: none;
}

.qp-cfg-sticky-bar__placeholder--active {
    display: block;
}

.qp-cfg-sticky-bar__inner {
    padding: 16px 24px;
}

.qp-cfg-sticky-bar__toggle-arrow {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
}

/* Таблица компонентов в sticky bar */
.qp-cfg-sticky-bar__table {
    width: 100%;
    border-collapse: collapse;
}

.qp-cfg-sticky-bar__table tr + tr {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.qp-cfg-sticky-bar__table td {
    padding: 4px 0;
}

.qp-cfg-sticky-bar__table-label {
    color: #fff;
    font-weight: 400;
    font-size: 13px;
    white-space: nowrap;
    padding-right: 12px;
    width: 1%;
}

.qp-cfg-sticky-bar__table-value {
    color: #fff;
    font-weight: 400;
    font-size: 14px;
    text-align: right;
}

/* Нижняя часть: цена + кнопки */
.qp-cfg-sticky-bar__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.qp-cfg-sticky-bar__price {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-shrink: 0;
}

.qp-cfg-sticky-bar__label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
}

.qp-cfg-sticky-bar__value {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
}

.qp-cfg-sticky-bar__buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* === Мобильная адаптация sticky bar === */
@media (max-width: 768px) {
    .qp-cfg-sticky-bar {
        margin: 16px -16px -16px;
    }

    .qp-cfg-sticky-bar__inner {
        padding: 12px 16px;
    }

    .qp-cfg-sticky-bar__bottom {
        flex-direction: column;
        gap: 10px;
    }

    .qp-cfg-sticky-bar__price {
        width: 100%;
        justify-content: space-between;
    }

    .qp-cfg-sticky-bar__value {
        font-size: 22px;
    }

    .qp-cfg-sticky-bar__buttons {
        width: 100%;
    }

    .qp-cfg-sticky-bar__btn {
        flex: 1;
        padding: 10px 12px !important;
        font-size: 12px !important;
        text-align: center;
    }

    .qp-cfg-sticky-bar__components {
        font-size: 12px;
    }
}

/* === Анимация === */
@keyframes qp-fade-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Адаптив === */
@media (max-width: 480px) {
    #qp-configurator {
        padding: 16px;
    }

    .qp-cfg-option {
        padding: 10px 12px;
        gap: 8px;
    }

    .qp-cfg-option__name {
        font-size: 13px;
    }

    .qp-cfg-total__price {
        font-size: 24px;
    }

    .qp-cfg-platforms {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .qp-cfg-platform-card__name {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .qp-cfg-platforms {
        grid-template-columns: 1fr;
    }
}
