/* =========================================
   ОСНОВНЫЕ ЦВЕТА
   ========================================= */

:root {
    --togu: #a51f45;
    --togu-dark: #851837;
    --togu-light: #f8eef1;

    --background: #f4f5f6;
    --surface: #ffffff;

    --text: #242424;
    --muted: #6c7277;

    --border: #dfe2e5;
    --soft-border: #eceeef;

    --success-background: #f5f7f6;
}


/* =========================================
   ОБЩИЕ НАСТРОЙКИ
   ========================================= */

* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    padding: 0;
}


body {
    font-family:
        Arial,
        Helvetica,
        sans-serif;

    color: var(--text);
    background: var(--background);
}


/* =========================================
   ПРИЛОЖЕНИЕ
   ========================================= */

.app {
    min-height: 100vh;
}


/* =========================================
   ШАПКА
   ========================================= */

.header {
    background: var(--togu);
    color: white;

    padding: 22px 24px;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.12);
}


.header-content {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
}


.header-title {
    font-size: 25px;
    font-weight: 700;
    line-height: 1.25;
}


.header-subtitle {
    margin-top: 6px;

    font-size: 14px;
    line-height: 1.4;

    opacity: 0.88;
}


/* =========================================
   ЧАТ
   ========================================= */

.chat {
    width: min(1100px, calc(100% - 32px));

    margin: 28px auto;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 12px;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.06);

    overflow: hidden;
}


/* =========================================
   ОБЛАСТЬ СООБЩЕНИЙ
   ========================================= */

.messages {
    min-height: 500px;
    max-height: calc(100vh - 260px);

    overflow-y: auto;

    padding: 28px;

    background: #ffffff;

    scroll-behavior: smooth;
}


/* =========================================
   СООБЩЕНИЕ ПОМОЩНИКА
   ========================================= */

.assistant-message {
    max-width: 900px;

    margin-bottom: 24px;

    padding: 18px 20px;

    background: #f7f7f7;

    border-left: 4px solid var(--togu);
    border-radius: 4px 10px 10px 4px;
}


.message-label {
    margin-bottom: 7px;

    color: var(--togu);

    font-size: 13px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.04em;
}


.message-text {
    font-size: 16px;
    line-height: 1.55;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* =========================================
   СООБЩЕНИЕ ПОЛЬЗОВАТЕЛЯ
   ========================================= */

.user-message {
    width: fit-content;
    max-width: 78%;

    margin: 0 0 24px auto;

    padding: 14px 18px;

    background: var(--togu-light);

    border: 1px solid #ead0d8;
    border-radius: 12px 12px 3px 12px;

    font-size: 16px;
    line-height: 1.5;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* =========================================
   СТАТУС ОБРАБОТКИ
   ========================================= */

.processing-message {
    max-width: 650px;

    margin-bottom: 24px;

    padding: 17px 20px;

    background: #f7f7f7;

    border-left: 4px solid var(--togu);
    border-radius: 4px 10px 10px 4px;
}


.processing-title {
    margin-bottom: 9px;

    color: var(--togu);

    font-size: 14px;
    font-weight: 700;
}


.processing-status {
    color: #444;

    font-size: 15px;
    line-height: 1.45;
}


.processing-bar {
    height: 4px;

    margin-top: 14px;

    background: #e4e4e4;
    border-radius: 4px;

    overflow: hidden;
}


.processing-bar-fill {
    width: 35%;
    height: 100%;

    background: var(--togu);

    border-radius: 4px;

    animation:
        processing 1.5s ease-in-out infinite;
}


@keyframes processing {

    0% {
        transform: translateX(-120%);
    }

    50% {
        transform: translateX(130%);
    }

    100% {
        transform: translateX(320%);
    }
}


/* =========================================
   ЗАГОЛОВОК РЕЗУЛЬТАТОВ
   ========================================= */

.results {
    max-width: 950px;
}


.results-title {
    margin: 8px 0 18px;

    color: #252525;

    font-size: 21px;
    font-weight: 700;
}


/* =========================================
   КАРТОЧКА ЖУРНАЛА
   ========================================= */

.journal-card {
    margin-bottom: 20px;

    background: white;

    border: 1px solid var(--border);
    border-top: 4px solid var(--togu);

    border-radius: 8px;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.045);

    overflow: hidden;
}


.journal-card:last-child {
    margin-bottom: 0;
}


/* =========================================
   НАЗВАНИЕ ЖУРНАЛА
   ========================================= */

.journal-title {
    padding: 18px 20px 14px;

    color: #222;

    font-size: 19px;
    font-weight: 700;
    line-height: 1.35;
}


.journal-number {
    color: var(--togu);
    margin-right: 5px;
}


/* =========================================
   ОСНОВНЫЕ ХАРАКТЕРИСТИКИ
   ========================================= */

.journal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    padding: 0 20px 16px;
}


.meta-item {
    padding: 6px 10px;

    background: #f3f4f5;

    border: 1px solid #e2e4e6;
    border-radius: 5px;

    font-size: 13px;
    line-height: 1.2;
}


.meta-label {
    color: var(--muted);
}


.meta-value {
    margin-left: 4px;

    color: #222;
    font-weight: 700;
}


/* =========================================
   ISSN
   ========================================= */

.journal-issn {
    padding: 0 20px 15px;

    color: #4f555a;

    font-size: 14px;
}


.journal-issn strong {
    color: #333;
}


/* =========================================
   СЕКЦИИ КАРТОЧКИ
   ========================================= */

.journal-section {
    padding: 15px 20px;

    border-top: 1px solid var(--soft-border);
}


.section-title {
    margin-bottom: 7px;

    color: #333;

    font-size: 14px;
    font-weight: 700;
}


.section-content {
    color: #444;

    font-size: 15px;
    line-height: 1.55;

    overflow-wrap: anywhere;
}


/* =========================================
   СПЕЦИАЛЬНОСТИ
   ========================================= */

.specialties {
    color: #555;

    font-size: 14px;
    line-height: 1.6;
}


/* =========================================
   ПРИЧИНА
   ========================================= */

.journal-reason {
    background: #fafafa;
}


/* =========================================
   ЭФФЕКТИВНОСТЬ
   ========================================= */

.journal-efficiency {
    background: var(--success-background);
}


.journal-efficiency .section-title {
    color: var(--togu-dark);
}


/* =========================================
   ПУСТОЙ РЕЗУЛЬТАТ / ОШИБКА
   ========================================= */

.empty-result,
.error-message {
    max-width: 800px;

    padding: 18px 20px;

    border-radius: 8px;

    font-size: 15px;
    line-height: 1.5;
}


.empty-result {
    background: #f7f7f7;

    border-left: 4px solid #8b9095;
}


.error-message {
    background: #fff4f4;

    border-left: 4px solid #b33a3a;
}


/* =========================================
   ПОЛЕ ВВОДА
   ========================================= */

.composer {
    display: flex;
    align-items: flex-end;
    gap: 12px;

    padding: 18px 20px 10px;

    background: #fafafa;

    border-top: 1px solid var(--border);
}


#message {
    display: block;

    flex: 1;

    min-height: 46px;
    max-height: 220px;

    padding: 12px 14px;

    border: 1px solid #cfd3d6;
    border-radius: 7px;

    outline: none;

    resize: none;

    overflow-y: auto;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    font-size: 16px;
    line-height: 1.4;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}


#message:focus {
    border-color: var(--togu);

    box-shadow:
        0 0 0 3px rgba(165, 31, 69, 0.10);
}


#message::placeholder {
    color: #8a8f93;
}


/* =========================================
   КНОПКА
   ========================================= */

#send-button {
    min-width: 120px;
    height: 46px;

    padding: 0 20px;

    border: 0;
    border-radius: 7px;

    background: var(--togu);
    color: white;

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.15s ease,
        opacity 0.15s ease;
}


#send-button:hover {
    background: var(--togu-dark);
}


#send-button:disabled {
    opacity: 0.55;
    cursor: default;
}


/* =========================================
   ПОДСКАЗКА ПОД ПОЛЕМ
   ========================================= */

.input-hint {
    padding: 0 20px 16px;

    background: #fafafa;

    color: #81868a;

    font-size: 12px;
    text-align: right;
}


/* =========================================
   ПОДСКАЗКА ДЛЯ КВАРТИЛЕЙ СО ЗВЕЗДОЧКОЙ
   ========================================= */

.quartile-note {
    margin: 0;
    padding: 0 20px 6px;

    color: #4f555a;

    font-size: 14px;
    line-height: 1.4;
}


/* =========================================
   АДАПТАЦИЯ
   ========================================= */

@media (max-width: 700px) {

    .header {
        padding: 18px 12px;
    }


    .header-content {
        width: 100%;
    }


    .header-title {
        font-size: 21px;
    }


    .chat {
        width: 100%;

        margin: 0;

        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }


    .messages {
        padding: 18px 12px;

        min-height: 450px;
    }


    .user-message {
        max-width: 90%;
    }


    .composer {
        padding-left: 12px;
        padding-right: 12px;
    }


    #send-button {
        min-width: auto;
        padding: 0 15px;
    }


    .input-hint {
        padding-right: 12px;
    }


    .journal-title,
    .journal-section {
        padding-left: 15px;
        padding-right: 15px;
    }


    .quartile-note {
        padding-left: 15px;
        padding-right: 15px;
    }


    .journal-meta,
    .journal-issn {
        padding-left: 15px;
        padding-right: 15px;
    }
}