/* LAUNCH BAR — унифицированный нижний блок запуска генерации.
   Используется в: view-custom-style, view-create-video, generation-launcher-view.
   Структура: .launch-bar > [.launch-popover] + .launch-chips + .launch-cta */

/* ── BAR ── */
.launch-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0));
    background: #0b0b12;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}
.app-view.hidden .launch-bar,
.generation-launcher-view.hidden .launch-bar {
    display: none;
}

/* ── CHIPS ROW ── */
.launch-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    justify-content: flex-start;
}

/* ── CHIP ── */
.launch-chip {
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 8px 6px 11px;
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid #2a2a3e;
    border-radius: 12px;
    color: #fff;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    font: inherit;
    transition: border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
/* Видео-ряд (несколько chip'ов) — растягиваем равномерно. */
.launch-chips:has(.launch-chip + .launch-chip) .launch-chip {
    flex: 1 1 0;
}
.launch-chip[aria-expanded="true"] {
    border-color: rgba(150, 80, 255, 0.55);
}

/* Shimmer-пульс при изменении выбора моделей.
   Класс .is-pulse навешивается JS на 700ms после toggle модели
   (см. refreshCustomModelChip / refreshChip в launcher). Эффект:
   диагональная белая полоса бежит слева-направо через chip. */
.launch-chip.is-pulse {
    animation: chipShimmer 0.7s ease-out;
    position: relative;
    overflow: hidden;
}
.launch-chip.is-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 30%,
        rgba(255, 255, 255, 0.18) 50%,
        transparent 70%
    );
    transform: translateX(-100%);
    animation: chipShimmerSweep 0.7s ease-out;
    pointer-events: none;
}
@keyframes chipShimmer {
    0%   { box-shadow: 0 0 0 0 rgba(150, 80, 255, 0.45); }
    40%  { box-shadow: 0 0 18px 2px rgba(150, 80, 255, 0.45); }
    100% { box-shadow: 0 0 0 0 rgba(150, 80, 255, 0); }
}
@keyframes chipShimmerSweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.launch-chip-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    overflow: hidden;
}
.launch-chip-label {
    font-size: 9px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.1;
}
.launch-chip-value {
    width: 100%;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}
.launch-chip-price {
    flex-shrink: 0;
    padding: 2px 6px;
    background: #fff;
    color: #1a1a1a;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.launch-chip-price::after {
    content: '✦';
    font-size: 13px;
    line-height: 1;
}
.launch-chip-caret {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
}
.launch-chip-caret svg {
    width: 18px;
    height: 18px;
    transition: transform 0.25s ease;
}
.launch-chip[aria-expanded="true"] .launch-chip-caret svg {
    transform: rotate(180deg);
}

/* ── TOAST («Запустим N» — всплывает над баром / popover'ом) ──
   Liquid-glass: gradient + blur + glow shadow. Slide-up из-под низа
   (ease-in) и укатывает дальше вверх (ease-out). Когда popover
   раскрыт — toast переезжает ВЫШЕ popover'а через `:has()` (см.
   `.launch-bar:has(...)` правило ниже). */
.launch-toast {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 0) scale(0.6);
    transform-origin: center bottom;
    z-index: 6;
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid rgba(180, 130, 255, 0.35);
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow:
        0 0 18px -2px rgba(180, 100, 255, 0.55),
        0 8px 24px -6px rgba(124, 58, 237, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    /* Zoom-in / zoom-out: scale + opacity. cubic-bezier с overshoot
       0.34, 1.56, 0.64, 1 даёт лёгкий «поп» эффект (как у iOS-нотифов).
       Лёгкий — только transform+opacity, GPU-композитинг, без layout. */
    transition:
        opacity 0.18s ease-out,
        transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.launch-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

/* Вертикальную позицию toast'а при открытом popover'е считает JS
   (showMultiModelAlert): меряет popover.offsetHeight и ставит
   inline style.bottom прямо НАД списком нейросетей с gap 10px.
   Закрытый popover → дефолт `bottom: calc(100% + 10px)` (над chip'ом). */

/* ── POPOVER (всплывает НАД chip'ами) ── */
.launch-popover {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 12px;
    right: 12px;
    z-index: 5;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    /* Прозрачный фон — карточки нейросетей «парят» над launch-bar
       без подложки, выглядят легче. Фон самого launch-bar (#0b0b12)
       обеспечивает контраст снизу. */
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transition: max-height 0.25s ease, opacity 0.2s ease, transform 0.25s ease;
}
.launch-popover.is-open {
    max-height: 320px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.launch-popover-title {
    padding: 12px 16px 4px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
}
.launch-popover-list {
    overflow-y: auto;
    max-height: 280px;
    padding: 4px 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.launch-popover-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #fff;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.launch-popover-row.is-selected {
    border-color: rgba(150, 80, 255, 0.65);
    background: rgba(106, 44, 255, 0.12);
}
.launch-popover-row-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.launch-popover-row-name {
    font-size: 14px;
    font-weight: 600;
}
.launch-popover-row-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}
.launch-popover-row-price {
    flex-shrink: 0;
    padding: 4px 8px;
    background: #fff;
    color: #1a1a1a;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}
.launch-popover-row-price::after {
    content: '✦';
    font-size: 10px;
    margin-left: 2px;
}

.launch-popover .models-slider {
    /* padding-top увеличен — даёт клиренс для бейджа «Для этого стиля»
       (top:-12px у .model-card), иначе срезается overflow:hidden popover'а. */
    padding: 22px 12px 14px;
    overflow-x: auto;
    overflow-y: hidden;
}

/* ── CTA BUTTON («Создать») ── */
.launch-cta {
    align-self: center;
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: auto;
    max-width: 100%;
    min-width: 200px;
    min-height: 50px;
    padding: 6px 28px 8px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    cursor: pointer;
    box-sizing: border-box;
    font: inherit;
    /* Лёгкая violet-glow тень + один inset highlight. */
    box-shadow:
        0 0 18px rgba(149, 88, 255, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: transform 0.15s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}
.launch-cta:active { transform: scale(0.98); }
.launch-cta:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Shimmer — белый glare пробегает раз в 5s с длинной паузой. */
.launch-cta::after {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 55%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(255, 255, 255, 0.55) 50%,
        transparent 100%
    );
    transform: skewX(-18deg);
    pointer-events: none;
    will-change: transform;
    animation: launch-cta-shimmer 5s ease-in-out infinite;
}
.launch-cta:disabled::after { animation: none; }
@keyframes launch-cta-shimmer {
    0%, 60% { transform: skewX(-18deg) translateX(0); }
    100% { transform: skewX(-18deg) translateX(560%); }
}

.launch-cta-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.1;
    color: #0e0e14;
    position: relative;
    z-index: 1;
}
.launch-cta-label svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #7c3aed;
}
.launch-cta-text {
    display: inline-block;
}
.launch-cta-sub {
    display: block;
    min-height: 12px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.55);
    line-height: 1;
    position: relative;
    z-index: 1;
}
