/* [СВО] 2026-07-19 — чат «Сибирь ИИ» / ИИ Агент ККОО «Сибирь» */

#view-siberia-ai {
    min-height: 100vh;
}

.hero--siberia-ai {
    padding-bottom: 0;
}

.hero--siberia-ai .hero__card {
    padding-bottom: 28px;
}

.ai-chat {
    padding: 0 20px 48px;
}

.ai-chat__inner {
    max-width: 960px;
    margin: 0 auto;
}

.ai-chat__panel {
    display: flex;
    flex-direction: column;
    height: min(74vh, 800px);
    max-height: min(80vh, 860px);
    border-radius: 24px;
    overflow: hidden;
    background:
        linear-gradient(165deg, rgba(255, 252, 247, 0.98) 0%, rgba(247, 243, 235, 0.96) 100%);
    border: 1px solid rgba(30, 58, 95, 0.1);
    box-shadow:
        0 4px 0 rgba(201, 168, 76, 0.18),
        0 22px 56px rgba(26, 43, 74, 0.12);
    position: relative;
}

.ai-chat__panel::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, #c9a84c, #e8d5a0 45%, #1a2b4a);
    z-index: 2;
    pointer-events: none;
}

.ai-chat__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px 16px 20px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(201, 168, 76, 0.22), transparent 55%),
        linear-gradient(135deg, #15233d 0%, #1a2b4a 42%, #243b61 100%);
    color: #fff;
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
}

.ai-chat__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 2px solid rgba(232, 213, 160, 0.85);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
    flex: 0 0 auto;
}

.ai-chat__head-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 auto;
}

.ai-chat__agent {
    margin: 0;
    font-family: 'Russo One', sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.25;
}

.ai-chat__status {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.78);
}

.ai-chat__status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #5dce8a;
    box-shadow: 0 0 0 3px rgba(93, 206, 138, 0.28);
    vertical-align: middle;
}

.ai-chat__clear {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.78);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background 0.15s, color 0.15s;
}

.ai-chat__clear:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.ai-chat__messages {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px 18px 14px;
    scroll-behavior: smooth;
    position: relative;
    z-index: 1;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201, 168, 76, 0.07), transparent 60%),
        linear-gradient(180deg, rgba(247, 243, 235, 0.5), rgba(255, 252, 247, 0.2)),
        #f4f0e8;
}

/* Пустой чат — подсказки по центру; с сообщениями — сверху вниз, без распорки */
.ai-chat__messages:has(#aiChatEmpty:not([hidden])) {
    justify-content: center;
}

.ai-chat__empty {
    padding: 20px 14px 8px;
    text-align: center;
    color: #6a6359;
}

.ai-chat__empty-title {
    margin: 0 0 8px;
    font-family: 'Russo One', sans-serif;
    font-size: 20px;
    color: #1a2b4a;
}

.ai-chat__empty-text {
    margin: 0 auto 16px;
    max-width: 420px;
    font-size: 14px;
    line-height: 1.55;
}

.ai-chat__suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 640px;
    margin: 0 auto;
}

.ai-chat__chip {
    border: 1px solid rgba(30, 58, 95, 0.12);
    background: #fff;
    color: #1e3a5f;
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(26, 43, 74, 0.05);
    transition: transform 0.12s ease, border-color 0.12s, background 0.12s;
}

.ai-chat__chip:hover {
    transform: translateY(-1px);
    border-color: rgba(201, 168, 76, 0.55);
    background: #fffdf8;
}

.ai-chat__msg {
    display: flex;
    flex-direction: column;
    max-width: min(88%, 680px);
    animation: ai-chat-in 0.28s ease;
    scroll-margin-top: 12px;
    scroll-margin-bottom: 12px;
}

.ai-chat__msg--user {
    align-self: flex-end;
}

.ai-chat__msg--assistant {
    align-self: flex-start;
}

.ai-chat__msg-meta {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #7a7268;
}

.ai-chat__msg--user .ai-chat__msg-meta {
    text-align: right;
}

.ai-chat__bubble {
    margin: 0;
    padding: 12px 15px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-chat__bubble strong {
    font-weight: 700;
    color: inherit;
}

.ai-chat__link {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.ai-chat__msg--assistant .ai-chat__link {
    color: #1e40af;
}

.ai-chat__link--tel {
    font-weight: 700;
    word-break: normal;
    white-space: nowrap;
}

.ai-chat__msg--user .ai-chat__bubble {
    background: linear-gradient(145deg, #1a2b4a, #2a4570);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 8px 20px rgba(26, 43, 74, 0.18);
}

.ai-chat__msg--assistant .ai-chat__bubble {
    background: #fff;
    color: #2c3340;
    border: 1px solid rgba(30, 58, 95, 0.08);
    border-bottom-left-radius: 6px;
    box-shadow: 0 8px 22px rgba(26, 43, 74, 0.06);
}

.ai-chat__msg--error .ai-chat__bubble {
    background: #fff4f2;
    border-color: rgba(180, 60, 50, 0.2);
    color: #8a2f28;
}

.ai-chat__files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ai-chat__file-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.ai-chat__msg--assistant .ai-chat__file-tag {
    background: rgba(26, 43, 74, 0.05);
    border-color: rgba(30, 58, 95, 0.1);
    color: #334155;
}

.ai-chat__typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    min-height: 1.2em;
}

.ai-chat__typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c9a84c;
    animation: ai-chat-dot 1.2s ease-in-out infinite;
}

.ai-chat__typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat__typing span:nth-child(3) { animation-delay: 0.3s; }

.ai-chat__attach-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 10px;
    background: #fffcf7;
    border-top: 1px solid rgba(30, 58, 95, 0.06);
    flex: 0 0 auto;
}

.ai-chat__attach-preview[hidden] {
    display: none !important;
}

.ai-chat__preview-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 6px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(30, 58, 95, 0.12);
    font-size: 12px;
    color: #334155;
    max-width: 100%;
}

.ai-chat__preview-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    background: #f1f5f9;
    flex: 0 0 auto;
}

.ai-chat__preview-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(201, 168, 76, 0.15);
    color: #8a6d2b;
    flex: 0 0 auto;
}

.ai-chat__preview-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.ai-chat__preview-remove {
    border: 0;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 14px;
}

.ai-chat__preview-remove:hover {
    color: #b91c1c;
}

.ai-chat__composer {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(30, 58, 95, 0.08);
    background: linear-gradient(180deg, #fffcf7, #faf6ef);
    flex: 0 0 auto;
    align-items: end;
}

.ai-chat__file-input {
    display: none;
}

.ai-chat__attach {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(30, 58, 95, 0.14);
    border-radius: 14px;
    background: #fff;
    color: #1e3a5f;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ai-chat__attach:hover,
.ai-chat__attach.is-active {
    border-color: rgba(201, 168, 76, 0.65);
    background: #fffdf8;
    color: #8a6d2b;
}

.ai-chat__attach:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat__input-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ai-chat__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8a8174;
}

.ai-chat__input {
    width: 100%;
    min-height: 48px;
    max-height: 140px;
    resize: none;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(30, 58, 95, 0.14);
    background: #fff;
    color: #1a2b4a;
    font: inherit;
    font-size: 15px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-chat__input:focus {
    border-color: rgba(201, 168, 76, 0.7);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18);
}

.ai-chat__send {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(145deg, #d4b45a, #c9a84c 45%, #a88735);
    color: #1a2b4a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.15s ease, filter 0.15s ease;
    box-shadow: 0 8px 18px rgba(168, 135, 53, 0.28);
}

.ai-chat__send:hover:not(:disabled) {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.ai-chat__send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.ai-chat__hint {
    margin: 12px 2px 0;
    font-size: 12px;
    color: #8a8174;
    text-align: center;
    line-height: 1.45;
}

@keyframes ai-chat-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ai-chat-dot {
    0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 768px) {
    .hero--siberia-ai .hero-center__logo-wrap {
        width: 140px;
        height: 140px;
        margin-bottom: 18px;
    }

    .hero--siberia-ai .hero-center__logo {
        width: 140px;
        height: 140px;
    }

    .ai-chat {
        padding: 0 12px calc(var(--page-bottom, 64px) + 24px);
    }

    .ai-chat__panel {
        height: min(70vh, 680px);
        max-height: min(70vh, 680px);
        border-radius: 18px;
    }

    .ai-chat__head {
        padding: 14px 12px 14px 14px;
        gap: 10px;
    }

    .ai-chat__agent {
        font-size: 15px;
    }

    .ai-chat__avatar {
        width: 44px;
        height: 44px;
    }

    .ai-chat__messages {
        padding: 14px 12px 10px;
    }

    .ai-chat__msg {
        max-width: 94%;
    }

    .ai-chat__composer {
        padding: 10px 10px 12px;
        gap: 8px;
    }

    .ai-chat__chip {
        font-size: 12px;
        padding: 7px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ai-chat__msg,
    .ai-chat__typing span,
    .ai-chat__chip {
        animation: none;
        transition: none;
    }

    .ai-chat__messages {
        scroll-behavior: auto;
    }
}
