/* =============================================================================
   SportProb AI — новый слой стилей (AI-First)
   Подключается после chat.css; заменяет визуал hero / ввода / чипов.
   Стили экспресса (билет + кнопки) перенесены с chat-express.css.
   ============================================================================= */

/* Ширина под строку из 4 чипов подсказок на одном ряду */
.ai-chat-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: min(1180px, 100%);
    margin: 0 auto;
    padding: 60px 20px 40px;
    box-sizing: border-box;
    min-height: 100vh;
}

/* Внутри flex-цепочки fullscreen не даём min-height:100vh ломать скролл родителя */
body.sp-ai-fs .sp-ai-landing .ai-chat-page {
    min-height: 0;
}

.ai-chat-welcome {
    text-align: center;
    margin-top: 48px;
    margin-bottom: 32px;
}

.ai-chat-welcome h1 {
    font-size: clamp(1.35rem, 4vw, 2rem);
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.2;
    background: linear-gradient(90deg, #a5b4fc, #67e8f9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ai-chat-welcome p {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.58);
    margin: 0;
    line-height: 1.45;
}

/* Панель потока (fullscreen) */
.ai-chat-results-panel {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-results-panel .ai-chat-thread {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 4px 16px;
}

/* Inline-ответ (до fullscreen) */
#aiChatResponse.ai-chat-response {
    width: 100%;
    margin-top: 20px;
    margin-bottom: 8px;
    padding: 0;
    background: transparent;
    border: none;
}

#aiChatResponse.ai-chat-response:not([hidden]) {
    display: block !important;
}

#aiChatResponse .ai-chat-response-header {
    margin-bottom: 8px;
}

#aiChatResponse .ai-chat-response-text {
    padding: 20px 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 1.55;
}

.ai-chat-input-area {
    width: 100%;
    max-width: min(1180px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    flex: 0 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Панель ответов не растягивается на всю высоту — ввод сразу под тредом/ответом */
#spAiLanding #mainContent.ai-chat-results-panel {
    flex: 0 1 auto;
    flex-grow: 0;
    min-height: 0;
}

/* Лендинг: шире 720px из chat.css — чтобы чипы и поле ввода помещались в один ряд */
.sp-ai-landing.sp-ai-chat-main {
    justify-content: flex-start;
    align-items: stretch;
    max-width: min(1180px, 100%);
    width: 100%;
}

body.sp-ai-fs #mainContent {
    flex: 0 1 auto !important;
    flex-grow: 0 !important;
    max-height: calc(100dvh - 13.5rem - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
}

body.sp-ai-fs .sp-ai-landing .ai-chat-input-area {
    margin-top: 24px;
}

.ai-chat-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.ai-chat-input-row .ai-robot-column {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 110px;
}

.ai-robot-status-caption {
    font-size: 9px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.52);
    text-align: center;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
    pointer-events: none;
}

.ai-robot-column:has(.premium-robot--busy) .ai-robot-status-caption {
    color: rgba(56, 189, 248, 0.92);
}

.ai-chat-input-row .ai-chat-input {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    color: #fff;
    font-size: 16px;
}

.ai-chat-input-row .ai-chat-input::placeholder {
    color: rgba(255, 255, 255, 0.38);
}

.ai-chat-input-row .ai-chat-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.85);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
}

.ai-chat-input-row .ai-chat-send-btn {
    flex-shrink: 0;
    padding: 14px 22px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: filter 0.2s, transform 0.15s;
}

.ai-chat-input-row .ai-chat-send-btn:hover:not(:disabled) {
    filter: brightness(1.08);
}

.ai-chat-input-row .ai-chat-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ai-chat-quick-commands {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 14px;
    width: 100%;
}

@media (min-width: 1024px) {
    .ai-chat-quick-commands {
        flex-wrap: nowrap;
    }
}

.ai-chat-quick-commands .sp-ai-tile,
.ai-chat-quick-chip {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}

.ai-chat-quick-commands .sp-ai-tile:hover,
.ai-chat-quick-chip:hover {
    background: rgba(102, 126, 234, 0.18);
    border-color: rgba(102, 126, 234, 0.45);
}

/* Поток сообщений (fullscreen) */
body.sp-ai-fs .ai-chat-page .ai-thread-msg {
    margin-bottom: 14px;
}

body.sp-ai-fs .ai-chat-page .ai-thread-bubble {
    border-radius: 16px 16px 4px 16px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.45;
}

body.sp-ai-fs .ai-chat-page .ai-thread-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(148, 163, 184, 0.95);
    margin-bottom: 6px;
}

body.sp-ai-fs .ai-chat-page .ai-thread-body {
    padding: 16px 18px;
    border-radius: 14px 18px 18px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.sp-ai-fs .ai-chat-page .ai-thread-msg--express .ai-thread-body {
    background: transparent;
    border: none;
    padding: 0;
}

body.sp-ai-fs .ai-chat-page .ai-express-summary {
    margin: 0 0 10px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
}

/* ----- Fullscreen: колонка внутри stack ----- */
body.sp-ai-fs .sp-ai-landing .ai-chat-page {
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 12px;
    padding-bottom: 8px;
    max-width: min(1180px, 100%);
}

body.sp-ai-fs .sp-ai-body-stack > .sp-ai-landing {
    min-height: 0;
}

body.sp-ai-fs #aiWelcome {
    display: none !important;
}

/* Отступ тред → ввод: 24px (см. .ai-chat-input-area и body.sp-ai-fs … .ai-chat-input-area) */

body.sp-ai-fs .ai-chat-results-panel {
    padding-top: max(12px, 4vh);
}

/* ----- Экспресс: билет (из chat-express.css) ----- */
.ai-express-ticket {
    width: min(760px, calc(100% - 16px));
    max-width: 760px;
    margin: 8px auto;
    background: #0f172a;
    border: 2px solid #22d3ee;
    border-radius: 14px;
    padding: 11px;
    color: #fff;
    box-shadow: 0 10px 24px rgba(34, 211, 238, 0.16);
}

.ai-express-ticket__head {
    text-align: center;
    margin-bottom: 6px;
}

.ai-express-ticket__head strong {
    font-size: 15px;
    color: #22d3ee;
    letter-spacing: 0.02em;
}

.ai-express-ticket__legs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.ai-express-ticket__leg {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 9px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ai-express-ticket__teams {
    font-size: 13px;
    opacity: 0.95;
    margin-bottom: 5px;
    line-height: 1.2;
    min-height: 28px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-express-ticket__link {
    color: inherit;
    text-decoration: none;
}

.ai-express-ticket__link:hover {
    color: #67e8f9;
}

.ai-express-ticket__pick {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    gap: 8px;
    min-height: 20px;
}

.ai-express-ticket__pick span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.ai-express-ticket__odd {
    color: #67e8f9;
    font-size: 15px;
}

.ai-express-ticket__meta {
    margin-top: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.62);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-express-ticket__more {
    margin-top: 4px;
    text-align: right;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.62);
}

.ai-express-ticket__summary {
    margin-top: 9px;
    text-align: center;
    background: #1e2937;
    padding: 9px;
    border-radius: 10px;
    font-size: 13px;
}

.ai-express-ticket__summary strong {
    color: #4ade80;
    font-size: 16px;
}

.ai-express-ticket__prob {
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
}

.ai-express-ticket__actions {
    margin-top: 7px;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ai-express-ticket__error {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
}

@media (max-width: 980px) {
    .ai-express-ticket__legs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .ai-express-ticket {
        width: calc(100% - 12px);
        padding: 9px;
    }
}

.btn-icon {
    background: rgba(160, 180, 220, 0.12);
    border: 1px solid rgba(166, 188, 243, 0.28);
    color: #eaf2ff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    transition: transform 0.14s ease, background-color 0.14s ease, border-color 0.14s ease;
}

.btn-icon:hover {
    transform: translateY(-1px);
    background: rgba(176, 198, 255, 0.2);
    border-color: rgba(176, 198, 255, 0.38);
}

.btn-icon.primary {
    background: linear-gradient(135deg, rgba(103, 126, 234, 0.88), rgba(118, 75, 162, 0.9));
    border: none;
}

.btn-reroll {
    white-space: nowrap;
}

.btn-share {
    min-width: 34px;
}

@media (max-width: 560px) {
    .ai-chat-input-row {
        flex-wrap: wrap;
    }

    .ai-chat-input-row .ai-chat-send-btn {
        width: 100%;
        justify-content: center;
    }
}
