/* Full-screen quick filter wizard (Buy rigs) — tier/model promos use PanelCarousel (Splide autoplay, no drag). */

/* Host: no display/visibility/clip that would hide the stacking layer — blocking UI is determined in scroll-lock.js (see data-panel-host-shell). */
#panel-modals-host {
    position: fixed;
    inset: 0;
    z-index: 10050;
    pointer-events: none;
}

#panel-modals-host > * {
    pointer-events: auto;
}

.panel-rigs-buy-heading-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 0.25rem;
}

.panel-rigs-buy-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.panel-rigs-buy-quick-open {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.panel-rigs-buy-quick-open:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
}

.panel-rigs-buy-empty {
    margin: 0.75rem 0 0.5rem;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.45);
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.82);
}

.panel-rigs-buy-empty-text {
    display: block;
}

.panel-rigs-buy-quick-filter {
    --panel-qf-card-border: 2px solid rgba(255, 255, 255, 0.12);
    --panel-qf-card-bg: rgba(0, 0, 0, 0.35);
    --panel-qf-card-radius: 12px;
    --panel-qf-card-shadow: 0 8px 24px rgba(6, 4, 12, 0.75);
    /* Одинаково strip/caption/tier/карточки: телефон и ПК без отдельных media */
    --panel-qf-active-border: rgba(139, 92, 246, 0.55);
    --panel-qf-active-bg: rgba(0, 0, 0, 0.48);
    --panel-qf-active-shadow: 0 0 0 2px rgba(139, 92, 246, 0.18);
    --panel-qf-unified-max-w: 420px;
    position: fixed;
    inset: 0;
    z-index: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) 12px env(safe-area-inset-bottom, 0);
    box-sizing: border-box;
}

.panel-rigs-buy-quick-filter.is-open {
    display: flex;
}

.panel-rigs-buy-quick-filter-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.panel-rigs-buy-quick-filter-card {
    position: relative;
    z-index: 1;
    flex: 0 1 auto;
    width: 100%;
    max-width: 920px;
    max-height: min(92vh, 900px);
    min-height: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(6, 4, 12, 0.96);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(139, 92, 246, 0.06);
    overflow: hidden;
}

.panel-rigs-buy-qf-step {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 18px 16px 20px;
    overflow: hidden;
    min-height: 0;
    flex: 1;
}

.panel-rigs-buy-qf-step.is-active {
    display: flex;
}

.panel-rigs-buy-qf-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    flex-shrink: 0;
}

/* Базовые стили скролла; жёсткий max-height не задаём — высоту ограничивает карточка (.panel-rigs-buy-quick-filter-card) */
.panel-rigs-buy-qf-dc-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

/* Unified scroll: заполняет шаг между заголовком и кнопками, прокрутка одна (не двойная со step) */
.panel-rigs-buy-qf-dc-scroll--unified {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
}

.panel-rigs-buy-qf-dc-unified-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

/* All banner as tier card style - matches regular card size */
.panel-rigs-buy-qf-dc-all-banner {
    margin: 0;
    width: 100%;
    max-width: min(100%, var(--panel-qf-unified-max-w));
    align-self: center;
    box-sizing: border-box;
}

/* Active state for All banner matches tier card selected state */
.panel-rigs-buy-qf-dc-all-banner.is-active {
    border-color: var(--panel-qf-active-border);
    background: var(--panel-qf-active-bg);
    box-shadow: var(--panel-qf-active-shadow);
}

/* Media height unified to 62px */
.panel-rigs-buy-qf-dc-card-media {
    height: 62px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.06);
}

/* Carousel host uses padding-bottom for aspect ratio, but --all modifier forces 62px */
.panel-rigs-buy-qf-dc-card-media--all {
    height: 62px;
    min-height: 62px;
    padding-bottom: 0;
}

/* Strip slides for All banner carousel */
.panel-rigs-buy-qf-dc-strip-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: qfDcSlide 3s ease-in-out infinite;
}

/* First slide visible immediately, others fade in */
.panel-rigs-buy-qf-dc-strip-slide:nth-child(1) {
    animation-delay: 0s;
    opacity: 1;
}

.panel-rigs-buy-qf-dc-strip-slide:nth-child(2) {
    animation-delay: 1s;
}

.panel-rigs-buy-qf-dc-strip-slide:nth-child(3) {
    animation-delay: 2s;
}

@keyframes qfDcSlide {
    0%,
    100% {
        opacity: 0;
        transform: scale(1.02);
    }
    33% {
        opacity: 1;
        transform: scale(1);
    }
}

/* First slide should stay visible when animation not running yet */
.panel-rigs-buy-qf-dc-strip-slide:nth-child(1):not(:nth-child(2)):not(:nth-child(3)) {
    opacity: 1;
}

/* Разделитель перед сеткой DC / моделей: белая полоса, по центру круг + стрелка вниз */
.panel-rigs-buy-qf-grid-divider {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 6px;
}

.panel-rigs-buy-qf-grid-divider-line {
    flex: 1 1 auto;
    min-width: 8px;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
}

.panel-rigs-buy-qf-grid-divider-icon {
    flex: 0 0 auto;
    display: block;
    margin: 0 10px;
}

.panel-rigs-buy-qf-dc-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 10px;
}

.panel-rigs-buy-qf-dc-grid > .panel-rigs-buy-qf-dc-card {
    box-sizing: border-box;
    flex: 0 1 calc((100% - 10px) / 2);
    max-width: calc((100% - 10px) / 2);
    min-width: 0;
}

@media (min-width: 640px) {
    .panel-rigs-buy-qf-dc-grid > .panel-rigs-buy-qf-dc-card {
        flex: 0 1 calc((100% - 30px) / 4);
        max-width: calc((100% - 30px) / 4);
    }
}

.panel-rigs-buy-qf-dc-card {
    position: relative;
    border-radius: var(--panel-qf-card-radius);
    border: var(--panel-qf-card-border);
    background: var(--panel-qf-card-bg);
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    padding: 0;
    min-height: 112px;
    max-width: 100%;
    min-width: 0;
    color: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.panel-rigs-buy-qf-dc-card:hover:not(:disabled) {
    border-color: rgba(139, 92, 246, 0.35);
}

.panel-rigs-buy-qf-dc-card.is-selected {
    border-color: var(--panel-qf-active-border);
    background: var(--panel-qf-active-bg);
    box-shadow: var(--panel-qf-active-shadow);
}

.panel-rigs-buy-qf-dc-card:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Splide inside <button> — не перехватывать клик; событие доходит до карточки */
.panel-rigs-buy-qf-dc-card > .panel-rigs-buy-qf-dc-card-media--qf-carousel,
.panel-rigs-buy-qf-dc-card > .panel-rigs-buy-qf-dc-card-media--qf-carousel * {
    pointer-events: none;
}

/* Tier + model grids: карусель не перехватывает клик (как у DC-карточек) */
.panel-rigs-buy-qf-tier-card .panel-rigs-buy-qf-dc-card-media--qf-carousel,
.panel-rigs-buy-qf-tier-card .panel-rigs-buy-qf-dc-card-media--qf-carousel * {
    pointer-events: none;
}

[data-qf-models] .panel-rigs-buy-qf-dc-card-media--qf-carousel,
[data-qf-models] .panel-rigs-buy-qf-dc-card-media--qf-carousel * {
    pointer-events: none;
}

/* Чипы моделей: без отдельной обводки по ценовому bucket — только обычное / .is-selected */

.panel-rigs-buy-qf-dc-card-media {
    height: 62px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.06);
}

/* Carousel host (tier + model cards): 16:9 box like panel rigs promos; Splide/img fill padding box */
.panel-rigs-buy-qf-dc-card-media--qf-carousel {
    position: relative;
    height: 0;
    padding-bottom: 56.25%;
    min-height: 0;
    background-color: rgba(255, 255, 255, 0.06);
    background-image: none !important;
    overflow: hidden;
}

/* "All datacenters" strip: keep fixed 62px; base --qf-carousel would override with 16:9 padding box */
.panel-rigs-buy-qf-dc-card-media--qf-carousel.panel-rigs-buy-qf-dc-card-media--all {
    height: 62px;
    min-height: 62px;
    padding-bottom: 0;
}

/* Tier / model carousels: center promo block (Splide root = this node, child is .splide__track only) */
.panel-rigs-buy-qf-dc-card-media--qf-carousel:not(.panel-rigs-buy-qf-dc-card-media--all) {
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.panel-rigs-buy-qf-dc-card-media--qf-carousel > .panel-carousel,
.panel-rigs-buy-qf-dc-card-media--qf-carousel > .splide,
.panel-rigs-buy-qf-dc-card-media--qf-carousel > .splide__track,
.panel-rigs-buy-qf-dc-card-media--qf-carousel > img {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

.panel-rigs-buy-qf-dc-card-media--qf-carousel > .panel-carousel img,
.panel-rigs-buy-qf-dc-card-media--qf-carousel > .splide img,
.panel-rigs-buy-qf-dc-card-media--qf-carousel > img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    max-width: 100%;
    height: 100% !important;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* First slide visible immediately before Splide initializes */
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__slide:first-child,
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__slide.is-active {
    opacity: 1;
}

/* Ensure first slide image is visible immediately */
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__slide:first-child img,
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__slide.is-active img {
    opacity: 1;
}

/* Splide: как panel-rigs-card-media — flex-shrink:0 + intrinsic img иначе вылезают за медиа-блок */
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide,
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__track,
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__track--fade,
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__track--ltr,
.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__list {
    width: 100%;
    height: 100%;
    max-width: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__list {
    align-items: stretch;
}

.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__slide {
    position: relative;
    overflow: hidden;
    height: 100% !important;
    max-height: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
}

.panel-rigs-buy-qf-dc-card-media--qf-carousel .splide__slide img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    max-width: 100%;
    height: 100% !important;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.panel-rigs-buy-qf-tier-wrap .panel-rigs-buy-qf-dc-card-media--qf-carousel {
    flex-shrink: 0;
}

.panel-rigs-buy-qf-tier-card.panel-rigs-buy-qf-dc-card {
    display: flex;
    flex-direction: column;
    text-align: center;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    border-radius: var(--panel-qf-card-radius);
    overflow: hidden;
}

.panel-rigs-buy-qf-tier-card .panel-rigs-buy-qf-dc-card-name {
    text-align: center;
}

.panel-rigs-buy-qf-dc-card-body {
    padding: 8px 10px 10px;
}

.panel-rigs-buy-qf-dc-card-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
}

.panel-rigs-buy-qf-dc-card-tag {
    margin-top: 4px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.55);
}

/* Unified grid layout: DC and Rigs steps use identical grid settings */
.panel-rigs-buy-qf-tier-shell {
    width: 100%;
    max-width: var(--panel-qf-unified-max-w);
    margin: 0 auto;
}

@media (min-width: 640px) {
    .panel-rigs-buy-qf-tier-shell {
        max-width: min(100%, calc(var(--panel-qf-unified-max-w) * 1.25));
    }

    /* Карточки сегментов цены на ПК ~+25% за счёт более широкой колонки и высоты */
    .panel-rigs-buy-qf-tier-wrap .panel-rigs-buy-qf-tier-card.panel-rigs-buy-qf-dc-card {
        min-height: 140px;
    }

    .panel-rigs-buy-qf-tier-wrap .panel-rigs-buy-qf-dc-card-name {
        font-size: 15px;
    }
}

/* Tier wrap uses same grid as dc-grid for visual consistency */
.panel-rigs-buy-qf-tier-wrap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

@media (min-width: 640px) {
    .panel-rigs-buy-qf-tier-wrap {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* [data-qf-models] — те же flex-правила, что у .panel-rigs-buy-qf-dc-grid (см. выше) */

.panel-rigs-buy-qf-tier-card.is-active {
    border-color: var(--panel-qf-active-border);
    background: var(--panel-qf-active-bg);
    box-shadow: var(--panel-qf-active-shadow);
}

.panel-rigs-buy-qf-actions {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.panel-rigs-buy-qf-actions--split {
    justify-content: space-between;
    gap: 12px;
}

/* Use unified button style for all QF actions */
.panel-rigs-buy-qf-next,
.panel-rigs-buy-qf-done,
.panel-rigs-buy-qf-back,
.panel-rigs-buy-qf-skip {
    min-width: 120px;
}

/* Override Skip button to use ghost style */
.panel-rigs-buy-qf-skip.panel-btn {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.9);
    color: #fff;
}

.panel-rigs-buy-qf-skip.panel-btn:hover:not(:disabled),
.panel-rigs-buy-qf-skip.panel-btn:focus-visible:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
}

.panel-rigs-buy-qf-skip.panel-btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
}

.panel-rigs-buy-quick-filter .panel-rigs-buy-qf-back.panel-btn {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.panel-rigs-buy-quick-filter .panel-rigs-buy-qf-back.panel-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
    color: #fff;
}

.panel-rigs-buy-quick-filter .panel-rigs-buy-qf-back.panel-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
    color: #fff;
}

.panel-rigs-buy-quick-filter .panel-rigs-buy-qf-back.panel-btn:active {
    background: rgba(255, 255, 255, 0.18);
    border-color: #fff;
    color: #fff;
}

body.panel-rigs-buy-qf-open {
    overflow: hidden;
}

/* Sidebar icon strip (rig management) */
.panel-sidebar-icon-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 8px 10px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-sidebar-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.panel-sidebar-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

a.panel-sidebar-icon-btn {
    text-decoration: none;
}
