/* Основные стили для страницы чата */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Гость: сдвиг раздела чата и поля ввода вправо для лучшей видимости */
body.chat-page[data-is-guest="true"] .content {
    padding-left: 2.5rem;
}
body.chat-page[data-is-guest="true"] .chat-section {
    margin-left: 0.5rem;
}
@media (min-width: 900px) {
    body.chat-page[data-is-guest="true"] .content {
        padding-left: 4rem;
    }
    body.chat-page[data-is-guest="true"] .chat-section {
        margin-left: 1rem;
    }
}
@media (max-width: 768px) {
    body.chat-page[data-is-guest="true"] .content {
        padding-left: max(0px, env(safe-area-inset-left, 0px));
        padding-right: max(0px, env(safe-area-inset-right, 0px));
    }
    body.chat-page[data-is-guest="true"] .chat-section {
        margin-left: 0;
    }
}

body {
    font-family: var(--font-body, 'DM Sans', 'Montserrat', 'Segoe UI', sans-serif);
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, #f4f2ff 0%, #ede9fe 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #333;
    min-height: 100vh;
}

/* Основной контент */
.content {
    flex: 1;
}

.chat-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    /* Важно для автокомплита: dropdown городов/профилей не должен обрезаться контейнером */
    overflow: visible;
    padding-top: 0;
}

/* Секция с данными */
.data-section {
    padding: 2rem;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #f8f9ff, #f0f2ff);
    max-width: 100%;
}

.module-title {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    text-align: center;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
}

/* Заголовок метода + кнопка «База расчёта» */
.chat-module-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.data-section .chat-module-header-row .module-title {
    text-align: left;
    margin-bottom: 0;
    flex: 1;
    min-width: min(100%, 200px);
    line-height: 1.25;
}

.chat-module-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge legacy */
}

.chat-module-actions::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.chat-page .calculation-base-btn--chat {
    position: relative;
    z-index: 0;
    isolation: isolate;
    flex-shrink: 0;
    margin: 0;
    padding: 10px 18px;
    font-size: 13px;
    letter-spacing: 0.02em;
    border: none;
    border-radius: 999px;
    color: #fff;
    background: transparent;
    box-shadow: none;
    filter: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.chat-page .calculation-base-btn--chat::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 55%, #5b21b6 100%);
}

.chat-page .calculation-base-btn--chat > * {
    position: relative;
    z-index: 1;
}

.chat-page .calculation-base-btn--chat-secondary::before {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.chat-page .calculation-base-btn--chat-example {
    color: #111827;
    text-shadow: none;
}

.chat-page .calculation-base-btn--chat-example::before {
    background: linear-gradient(135deg, #ffe259 0%, #ffa751 45%, #ff5f6d 100%);
}

.chat-page .calculation-base-btn--chat:not(.calculation-base-btn--chat-secondary):not(.calculation-base-btn--chat-example):hover::before {
    background: linear-gradient(135deg, #7c8ef0 0%, #8b5cb6 50%, #6d28d9 100%);
}

.chat-page .calculation-base-btn--chat-example:hover {
    color: #111827;
}

.chat-page .calculation-base-btn--chat-example:hover::before {
    background: linear-gradient(135deg, #ffef7a 0%, #ffb069 45%, #ff6d79 100%);
}

.chat-page .calculation-base-btn--chat-secondary:hover::before {
    background: linear-gradient(135deg, #34d399 0%, #16a34a 100%);
}

.chat-page #otherMethodologiesBtn,
.chat-page #otherMethodologiesBtn:hover,
.chat-page #otherMethodologiesBtn:focus,
.chat-page #otherMethodologiesBtn:active,
.chat-page #otherMethodologiesBtn:visited {
    text-decoration: none;
}

.chat-page #chatExampleBtn,
.chat-page #chatExampleBtn:hover,
.chat-page #chatExampleBtn:focus,
.chat-page #chatExampleBtn:active,
.chat-page #chatExampleBtn:visited {
    text-decoration: none;
}

.chat-page .calculation-base-btn--chat i {
    font-size: 0.95em;
    opacity: 0.95;
}

.chat-page .calculation-base-btn--chat:hover {
    color: #fff;
    border-color: transparent;
}

.chat-page .calculation-base-btn--chat:active::before {
    filter: brightness(0.96);
}

.chat-page .calculation-base-btn--chat:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 3px;
}

.chat-page .calculation-base-btn--chat.display-none,
.chat-page button.calculation-base-btn--chat[hidden] {
    display: none !important;
}

@media (max-width: 520px) {
    /* Мобильные: заголовок сверху, кнопки под заголовком */
    .chat-module-header-row {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        flex-wrap: wrap;
    }

    .chat-module-actions {
        width: 100%;
        gap: 10px;
    }

    /* Мобильные: убираем иконки в кнопках, чтобы влезали в строку */
    .chat-page .calculation-base-btn--chat i {
        display: none;
    }

    .data-section .chat-module-header-row .module-title {
        text-align: left;
        flex: 0 0 100%;
        width: 100%;
        margin-bottom: 2px;
    }

    .chat-page .calculation-base-btn--chat {
        flex: 1 1 0;
        justify-content: center;
        padding: 8px 12px;
        font-size: 12px;
        min-width: 0;
        text-align: center;
        line-height: 1.15;
    }

    .chat-page .calculation-base-btn--chat span {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        text-wrap: balance;
    }
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

/* #horaryMomentBlock — display:contents в styles.css (если используется) */
#horaryMomentBlock {
    display: contents;
}

/* Нижнее выравнивание полей ввода при подсказке под временем */
@media (min-width: 1024px) {
    .chat-page #dataForm .form-row {
        align-items: flex-end;
    }
}

/* Глобальный input:valid в styles.css даёт зелёную обводку только части полей — унифицируем */
.chat-page .data-section .form-group input:valid:not(:focus),
.chat-page .data-section .form-group select:valid:not(:focus) {
    border-color: #d1d5db;
}

.chat-page .data-section .form-group select {
    min-height: 2.75rem;
}

/* Поле ФИО должно быть шире в grid layout */
.form-group:has(.fio-input) {
    grid-column: span 2;
    min-width: 300px;
}

/* Альтернативный способ для браузеров без поддержки :has() - применяем к первому элементу */
.form-row > .form-group:first-of-type:has(input.fio-input) {
    grid-column: span 2;
    min-width: 300px;
}

/* Убеждаемся, что само поле ФИО имеет правильную ширину */
.form-group input.fio-input {
    min-width: 300px !important;
    width: 100%;
}

/* В мобильной версии уменьшаем gap */
@media (max-width: 768px) {
    .form-row {
        gap: 8px;
    }
}

/* Если экран узкий, поле ФИО занимает всю ширину */
@media (max-width: 768px) {
    .form-group:has(.fio-input),
    .form-group:first-child {
        grid-column: span 1;
        min-width: 100% !important;
        width: 100%;
    }
    
    /* Убираем лишние отступы у поля ФИО с автозаполнением */
    .form-group:has(.fio-input),
    .form-group:has(#nameDropdown) {
        margin-bottom: 5px;
    }
    
    /* Убираем лишние отступы у dropdown автозаполнения */
    .autocomplete-dropdown {
        margin-bottom: 0;
    }
    
    /* Делаем одну колонку в grid для мобильных */
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    /* Поле ФИО должно занимать всю ширину на мобильных */
    .form-group input.fio-input,
    .form-group #name.fio-input,
    #name.fio-input {
        min-width: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Убеждаемся, что form-group с ФИО занимает всю ширину */
    .form-group:has(input.fio-input),
    .form-group:has(#name) {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
}

.form-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Когда открыт autocomplete — показываем список "в потоке",
   чтобы он сдвигал следующий блок вниз без пустого пространства */
.form-group.autocomplete-open .autocomplete-dropdown {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    border-top: 1px solid #d1d5db;
    border-radius: 10px;
    margin-top: 6px;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: 'DM Sans', 'Montserrat', sans-serif;
    color: #374151;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    background: #fafafa;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-group input:hover {
    border-color: #9ca3af;
    background: #fff;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-group select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: 'DM Sans', 'Montserrat', sans-serif;
    color: #374151;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    background: #fafafa;
    min-width: 0;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-group select:hover {
    border-color: #9ca3af;
    background: #fff;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.method-selectors {
    margin-bottom: 1rem;
}

.form-row.method-selectors-row {
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}
.method-selectors-row {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    align-items: start;
}

.method-selectors-row .form-group {
    min-width: 0;
}

.method-selectors-row .form-group label {
    white-space: nowrap;
    flex-shrink: 0;
}

.method-selectors-row .form-group select {
    width: 100%;
    min-height: 2.75rem;
}

.forecast-category-section {
    margin-bottom: 1rem;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 10000 !important;
    max-height: 220px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
    font-family: 'DM Sans', 'Montserrat', sans-serif;
    color: #374151;
}

.autocomplete-item:hover {
    background-color: #f3f4f6;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* Секция чата */
.chat-section {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.chat-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
}

.chat-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    z-index: 1;
    font-family: 'Playfair Display', serif;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.status-text {
    font-size: 0.9rem;
    opacity: 0.9;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.message {
    padding: 1rem 0.1rem;
    display: flex;
    max-width: 100%;
}

.bot-message {
    align-self: flex-start;
    max-width: 100%; /* ← ДОБАВИТЬ */
    width: 100%; /* ← ДОБАВИТЬ */
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
     max-width: 80%; /* Сохранить для пользовательских сообщений */
}

.message-content {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.bot-message .message-content {
    border-top-left-radius: 4px;
    background: linear-gradient(135deg, #f8f9ff, #f0f2ff);
}

.user-message .message-content {
    border-top-right-radius: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.message-text {
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    text-align: right;
}

/* Красивый стиль для контейнера ввода чата */
.chat-input-container {
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #e0e0e0;
    position: relative;
}

/* Градиентная рамка сверху */
.chat-input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #4ade80);
    background-size: 200% 100%;
    animation: gradientFlow 3s ease infinite;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Контейнер для управления чатом */
/* Контейнер для управления чатом */
.chat-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.1);
    flex-wrap: nowrap;
    /* Важно: запрещаем перенос на новую строку */
    overflow: hidden;
    /* Скрываем переполнение */
    min-height: 10px;
    /* Минимальная высота */
    max-height:70px;
}

/* Стили для информации об использовании */
.usage-info {
    flex: 1;
    font-size: 0.85rem;
    color: #555;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    white-space: wrap;
    /* Запрещаем перенос текста */
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    /* Может сжиматься если нужно */
    min-width: 0;
    /* Позволяет сжиматься */
}

.usage-info strong {
    color: #667eea;
}

/* Счетчик сообщений */
.message-counter {
    flex: 1;
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    white-space: wrap;
    /* Запрещаем перенос текста */
    text-align: center;
    transition: all 0.3s ease;
    min-width: 0;
}

.message-counter.critical {
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
    background: rgba(220, 53, 69, 0.05);
}

.message-counter.warning {
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.3);
    background: rgba(255, 193, 7, 0.05);
}

.btn-clear-chat {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-clear-chat:hover {
    background: #ff5252;
}

.btn-clear-chat:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* Стиль для wrapper ввода */
.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    background: white;
    padding: 0.75rem;
    border-radius: 20px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

/* Текстовое поле ввода */
#messageInput {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    resize: none;
    font-family: inherit;
    transition: all 0.3s ease;
    max-height: 120px;
    background: transparent;
    line-height: 1.5;
    min-height: 50px;
}

#messageInput:focus {
    outline: none;
    box-shadow: none;
}

#messageInput::placeholder {
    color: #999;
}

/* Красивая кнопка отправки */
#sendButton {
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    font-weight: 600;
}

#sendButton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.7s ease;
}

#sendButton:hover::before {
    left: 100%;
}

#sendButton:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

#sendButton:active {
    transform: translateY(-1px) scale(0.98);
}

#sendButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2) !important;
}

/* Стили для подсказок */
.chat-suggestions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.suggestion-btn {
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.suggestion-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s ease;
}

.suggestion-btn:hover::before {
    left: 100%;
}

.suggestion-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.suggestion-btn:active {
    transform: translateY(0);
}

/* Адаптивность */
@media (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .chat-header {
        flex-direction: column;
        gap: 0.2rem;
        text-align: center;
    }

    .chat-suggestions {
        justify-content: center;
    }

    /* Мобильные устройства - уменьшение текста */
    .message-text {
        font-size: 1.0rem;
        line-height: 1.4;
    }

    .message-time {
        font-size: 0.7rem;
    }

    .module-title {
        font-size: 1.4rem;
    }

    .chat-header h2 {
        font-size: 1.0rem;
    }

    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .submit-btn {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }

    .suggestion-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .autocomplete-item {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .status-text {
        font-size: 0.8rem;
    }

    /* Мобильная версия для контейнера ввода и контролов */
    .chat-input-container {
        padding: 1rem;
    }

    .chat-controls {
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem;
        margin-top: 0.75rem;
    }

    .chat-input-wrapper {
        padding: 0.5rem;
        border-radius: 15px;
        gap: 0.5rem;
    }

    #messageInput {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    #sendButton {
        width: 45px;
        height: 45px;
        font-size: 0.9rem;
    }

    .usage-info,
    .message-counter,
    .clear-chat-btn {
        width: 100%;
        text-align: center;
        padding: 0.5rem;
    }

    .message-counter {
        min-width: auto;
    }

    .clear-chat-btn {
        justify-content: center;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .message-text {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .module-title {
        font-size: 1.2rem;
    }

    .chat-header h2 {
        font-size: 1.1rem;
    }

    .form-group input {
        font-size: 0.85rem;
    }

    .message-content {
        padding: 0.75rem 1rem;
    }

    .chat-input-container {
        padding: 0.75rem;
    }

    .chat-input-wrapper {
        border-radius: 12px;
    }

    #messageInput {
        font-size: 0.85rem;
        padding: 0.5rem;
        min-height: 40px;
    }

    #sendButton {
        width: 40px;
        height: 40px;
        font-size: 0.8rem;
    }

    /* Уменьшаем анимацию градиента на мобильных */
    .chat-input-container::before {
        height: 2px;
        animation: gradientFlow 5s ease infinite;
    }

    .suggestion-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .chat-controls {
        padding: 0.5rem;
        border-radius: 10px;
    }
}

/* Добавьте в конец вашего chat.css */
.message.bot-message.streaming {
    opacity: 0.9;
    background-color: #f8f9fa;
}

.message.bot-message.streaming .message-text {
    min-height: 20px;
}

.streaming-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Анимация для потока текста */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot-message.streaming .streaming-text {
    animation: fadeIn 0.3s ease;
}

/* Индикатор печати */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: #666;
    font-size: 0.9em;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 20px;
    margin: 0 1.5rem;
    align-self: flex-start;
    max-width: fit-content;
}

.typing-text {
    font-size: 0.8rem;
    color: #666;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #4dabf7;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }
}

/* Темная тема поддержка (опционально) */
@media (prefers-color-scheme: dark) {
    .chat-input-container {
        background: #1a1a2e;
        border-top-color: #2d3748;
    }

    .chat-controls {
        background: linear-gradient(135deg, #2d3748, #4a5568);
    }

    .usage-info {
        background: rgba(102, 126, 234, 0.2);
        color: #cbd5e0;
        border-color: rgba(102, 126, 234, 0.3);
    }

    .message-counter {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .chat-input-wrapper {
        background: #2d3748;
        border-color: #4a5568;
    }

    #messageInput {
        background: transparent;
        color: #e2e8f0;
    }

    #messageInput::placeholder {
        color: #a0aec0;
    }

    .suggestion-btn {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
        color: #a3bffa;
        border-color: rgba(102, 126, 234, 0.3);
    }
}

/* Стили для аккордеона данных */
.data-accordion {
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f8f9ff, #f0f2ff);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    /* Dropdown автокомплита (города/профили) должен быть поверх шапки чата */
    position: relative;
    z-index: 10;
}

.accordion-toggle {
    width: 100%;
    padding: 1rem 1.5rem;
    min-height: 3.25rem;
    line-height: 1.4;
    box-sizing: border-box;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    text-align: left;
    margin: 0;
}

.accordion-toggle:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a4399);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.accordion-toggle:active {
    transform: translateY(0);
}

.accordion-title {
    font-size: 1rem;
    font-weight: 600;
}

.accordion-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    display: inline-block;
    margin-left: 10px;
}

/* Иконка стрелки */
.accordion-icon::before {
    content: '▼';
    display: inline-block;
}

.data-accordion.collapsed .accordion-icon {
    transform: rotate(-90deg);
}

/* Убираем скругление при развернутом состоянии */
.data-accordion:not(.collapsed) .accordion-toggle {
    border-radius: 12px 12px 0 0;
}

.accordion-content {
    max-height: 0;
    padding: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

/* Когда аккордеон развернут */
.data-accordion:not(.collapsed) .accordion-content {
    padding: 0;
    overflow: visible;
}

/* Стили для секции данных внутри аккордеона */
.data-section {
    padding: 2rem;
    border-radius: 0 0 12px 12px;
    background: white;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

/* На мобильных показываем аккордеон */
@media (max-width: 768px) {
    html:has(body.chat-page),
    html,
    body.chat-page {
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0;
        height: 100%;
        overflow: hidden;
        background: #f9f3ff !important;
    }

    body.chat-page {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    body.chat-page > .container,
    body.chat-page .container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
        display: flex;
        flex-direction: column;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box;
        align-items: stretch;
        overflow: hidden;
        background: #f9f3ff !important;
        z-index: 1;
    }

    body.chat-page .sidebar,
    body.chat-page .method-sidebar {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-start;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 4px 0 !important;
        margin: 0 !important;
        gap: 4px;
        box-sizing: border-box;
        position: relative;
        top: 0;
        z-index: 50;
        background: #f9f3ff;
        border-bottom: 1px solid rgba(30, 58, 138, 0.12);
        flex-shrink: 0;
        align-self: flex-start;
    }

    body.chat-page .sidebar-logo,
    body.chat-page .sidebar-logo .logo-image,
    body.chat-page .sidebar-logo img {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        border: 0 !important;
        line-height: 0 !important;
    }

    body.chat-page .sidebar > .menu-group {
        flex: 1 1 0;
        min-width: 0;
        margin: 0 !important;
        position: relative;
    }

    body.chat-page .sidebar .menu-group-header {
        padding: 6px 2px 8px;
        margin: 0;
        border-left: none;
        border-bottom: 3px solid transparent;
        border-radius: 10px 10px 0 0;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3px;
        min-height: 48px;
        text-align: center;
        font-size: inherit;
        white-space: nowrap;
    }

    body.chat-page .menu-tab-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.05rem;
        color: #1e3a8a;
        line-height: 1;
    }

    body.chat-page .menu-tab-label-full,
    body.chat-page .menu-group-header .arrow {
        display: none !important;
    }

    body.chat-page .menu-tab-label-short {
        display: block;
        font-family: 'Montserrat', sans-serif;
        font-size: 10px;
        font-weight: 700;
        line-height: 1.15;
        color: #1e3a8a;
        letter-spacing: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.chat-page .menu-tab-text {
        display: block;
        min-width: 0;
        max-width: 100%;
    }

    body.chat-page .menu-group-header.active {
        border-bottom-color: #667eea;
        background: rgba(102, 126, 234, 0.14);
    }

    body.chat-page .sidebar .submenu {
        position: absolute;
        top: 100%;
        left: 0;
        right: auto;
        min-width: 200px;
        width: max-content;
        max-width: min(280px, 92vw);
        z-index: 120;
        margin: 0;
        padding: 4px 0;
        background: #ffffff;
        border: 1px solid rgba(30, 58, 138, 0.14);
        border-radius: 0 0 12px 12px;
        box-shadow: 0 10px 28px rgba(30, 58, 138, 0.16);
        max-height: 0;
        overflow: hidden;
    }

    body.chat-page .menu-group--numerology .submenu,
    body.chat-page .menu-group--palmistry .submenu {
        left: auto;
        right: 0;
    }

    body.chat-page .menu-group-header.active + .submenu {
        max-height: min(55vh, 380px);
        overflow-y: auto;
    }

    body.chat-page .sidebar .submenu-item {
        padding: 10px 14px;
        border-left: none;
        white-space: nowrap;
    }

    body.chat-page .content {
        flex: 1;
        min-height: 0;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
    }

    body.chat-page .chat-container {
        flex: 0 0 auto;
    }

    body.chat-page .chat-section {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    body.chat-page .chat-messages {
        flex: 1 1 auto;
        min-height: 80px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.chat-page .chat-seo-block {
        display: none;
    }

    body.chat-page[data-is-guest="true"] .content {
        padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
    }

    body.chat-page .chat-container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    body.chat-page .chat-section,
    body.chat-page .chat-messages,
    body.chat-page .chat-input-container,
    body.chat-page .chat-seo-block {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    body.chat-page .chat-seo-block {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
    }

    body.chat-page .chat-guest-notice,
    body.chat-page .chat-status-notice,
    body.chat-page .chat-tariff-hint,
    body.chat-page .balance-panel {
        margin-left: max(0px, env(safe-area-inset-left, 0px));
        margin-right: max(0px, env(safe-area-inset-right, 0px));
    }

    .data-accordion {
        position: relative;
        z-index: 2;
        margin-bottom: 0;
    }

    .data-accordion .accordion-toggle {
        position: sticky;
        top: 0;
        z-index: 5;
    }

    .chat-container {
        border-radius: 0;
    }

    .accordion-toggle {
        padding: 1rem max(12px, env(safe-area-inset-right, 0px)) 1rem max(12px, env(safe-area-inset-left, 0px));
    }

    .data-section {
        padding: 1rem max(20px, env(safe-area-inset-right, 0px)) 1.25rem max(20px, env(safe-area-inset-left, 0px));
    }

    .data-section .chat-module-header-row,
    .data-section #dataForm {
        padding-left: 2px;
        padding-right: 2px;
        box-sizing: border-box;
    }

    .chat-page .data-section .calculation-base-btn--chat {
        border-radius: 14px;
        min-height: 48px;
        padding: 12px 16px;
    }

    .module-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .form-row {
        gap: 10px;
    }

    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 0.3rem;
    }

    .data-section .form-group input,
    .data-section .form-group select {
        padding: 13px 16px;
        font-size: 15px;
        min-height: 50px;
        border-radius: 14px;
        border: 1px solid rgba(102, 126, 234, 0.28);
        background: #fff;
        box-shadow: 0 2px 12px rgba(102, 126, 234, 0.1);
    }

    .data-section .form-group input:focus,
    .data-section .form-group select:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), 0 4px 14px rgba(102, 126, 234, 0.12);
    }

    .data-section .form-hint {
        font-size: 0.75rem;
        color: rgba(55, 65, 81, 0.78);
        margin-bottom: 8px;
        line-height: 1.4;
    }

    .data-section .submit-btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        margin-top: 0.75rem;
        border-radius: 14px;
        min-height: 50px;
        box-shadow: 0 4px 14px rgba(102, 126, 234, 0.25);
    }

    /* Уменьшаем отступы в дополнительных полях */
    .additional-section h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .accordion-toggle {
        padding: 0.875rem max(10px, env(safe-area-inset-right, 0px)) 0.875rem max(10px, env(safe-area-inset-left, 0px));
        font-size: 0.95rem;
    }

    .data-section {
        padding: 0.875rem max(18px, env(safe-area-inset-right, 0px)) 1rem max(18px, env(safe-area-inset-left, 0px));
    }

    .module-title {
        font-size: 1.1rem;
    }

    .data-section .form-group input,
    .data-section .form-group select {
        padding: 11px 13px;
        font-size: 14px;
        min-height: 46px;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .submit-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Уведомления в секции чата (гость и авторизованный пользователь) */
.chat-status-notice,
.chat-guest-notice {
    margin: 0.75rem 1rem 0.5rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.chat-guest-notice {
    background: linear-gradient(135deg, #fff8e6, #fff3d6);
    border: 1px solid rgba(230, 170, 50, 0.35);
    color: #8b6914;
    box-shadow: 0 2px 10px rgba(230, 170, 50, 0.1);
}

.chat-status-notice--tariff {
    background: linear-gradient(135deg, #eef4ff, #e8f0fe);
    border: 1px solid rgba(59, 92, 200, 0.22);
    color: #1e3a8a;
}

.chat-status-notice--active {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid rgba(34, 197, 94, 0.28);
    color: #166534;
}

.chat-status-notice__link {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff !important;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-status-notice__link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

body.chat-page[data-is-guest="true"][data-free-trial-used="true"] #chatBalance {
    display: none;
}

body.chat-page[data-is-guest="true"][data-free-trial-used="true"] .balance-panel,
body.chat-page[data-auth-notice="tariff"] .balance-panel,
body.chat-page[data-auth-notice="subscription"] .balance-panel {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

body.chat-page[data-auth-notice="tariff"] #chatBalance,
body.chat-page[data-auth-notice="subscription"] #chatBalance,
body.chat-page[data-auth-notice="subscription"] #remainingMessages {
    display: none;
}

body.chat-page[data-is-guest="true"][data-free-trial-used="true"] .balance-panel > div:last-child {
    margin-bottom: 0;
}

/* Маркер "конец ознакомительного фрагмента" в сообщении бота */
.trial-end-marker {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(102, 126, 234, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(55, 65, 81, 0.85);
    font-size: 0.9rem;
    user-select: none;
}

.trial-end-marker i {
    color: rgba(102, 126, 234, 0.9);
    font-size: 0.95em;
}

/* Стили для панели баланса */
.balance-panel {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f8f9ff, #f0f2ff);
    border-radius: 12px;
    margin: 0.75rem 1rem 1rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.08);
}

.balance-panel .session-stats {
    width: 100%;
    margin: 0;
    padding-top: 0;
    border-top: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

body.chat-page[data-auth-notice="subscription"] .balance-panel .session-stats,
body.chat-page[data-auth-notice="tariff"] .balance-panel .session-stats {
    flex-direction: row;
    flex-wrap: wrap;
}

body.chat-page[data-auth-notice="subscription"] #sessionInfo:empty,
body.chat-page[data-auth-notice="tariff"] #sessionInfo:empty {
    display: none;
}

.balance-panel > div {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.balance-panel > div:last-child {
    margin-bottom: 0;
}

.balance-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
    padding: 0.5rem 0;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.messages-count {
    font-size: 0.95rem;
    color: #555;
    font-weight: 500;
    padding: 0.4rem 0;
}

/* Индикаторы для разных состояний баланса */
.balance-value.low-balance {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.balance-value.healthy-balance {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.messages-count.critical {
    color: #ff6b6b;
    font-weight: bold;
    animation: pulseWarning 2s infinite;
}

.messages-count.warning {
    color: #ffc107;
    font-weight: 600;
}

@keyframes pulseWarning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Статистика сессии */
.session-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.85rem;
    color: #666;
}

.session-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Адаптивность */
@media (max-width: 768px) {
    .balance-panel {
        margin: 1rem;
        padding: 1rem;
    }
    
    .balance-panel > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .session-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .balance-panel {
        margin: 0.75rem;
        padding: 0.75rem;
    }
    
    .balance-value {
        font-size: 1rem;
    }
    
    .messages-count {
        font-size: 0.9rem;
    }
}

/* Стили для кнопки новой сессии */
.btn-new-session-small {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Эффект свечения */
.btn-new-session-small::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent
    );
    transition: left 0.7s ease;
}

.btn-new-session-small:hover::before {
    left: 100%;
}

.btn-new-session-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.btn-new-session-small:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.3);
}

.btn-new-session-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    background: linear-gradient(135deg, #cccccc, #999999);
    box-shadow: none;
}

/* Иконка для кнопки */
.btn-new-session-small::after {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.btn-new-session-small:hover::after {
    transform: rotate(180deg);
}

/* Варианты кнопки */
.btn-new-session-small.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-new-session-small.warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-new-session-small.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-new-session-small.danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Контейнер для кнопки в панели баланса */
.balance-panel .action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

/* Адаптивность */
@media (max-width: 768px) {
    .btn-new-session-small {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
    
    .balance-panel .action-buttons {
        flex-direction: column;
    }
    
    .btn-new-session-small {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .btn-new-session-small {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* Стили для модальных окон */
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideUp 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #ffffff, #f8f9ff);
}

.modal-content h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-content p {
    color: #555;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: rotate(90deg);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

.btn-deposit {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-deposit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-new-session {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.btn-new-session:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
}

.btn-cancel {
    padding: 0.75rem 1.5rem;
    background: #f0f0f0;
    color: #666;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность для модальных окон */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions button {
        width: 100%;
    }
}

/* Предотвращаем скроллинг страницы при открытой модалке */
body.modal-open {
    overflow: hidden;
}

/* ============= СТИЛИ ДЛЯ ДИАЛОГА ПОДТВЕРЖДЕНИЯ ОЧИСТКИ ЧАТА ============= */

/* Overlay для диалога */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

/* Основное окно диалога */
.confirm-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
    overflow: hidden;
}

/* Заголовок диалога */
.confirm-dialog-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.confirm-dialog-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Тело диалога */
.confirm-dialog-body {
    padding: 1.5rem;
    color: #333;
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
}

.confirm-dialog-body p {
    margin: 0.5rem 0;
}

.confirm-dialog-body p:first-child {
    margin-top: 0;
}

.confirm-dialog-body strong {
    color: #667eea;
    font-weight: 600;
}

/* Нижняя часть с кнопками */
.confirm-dialog-footer {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* Кнопки диалога */
.confirm-dialog-footer button {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Кнопка "Отмена" */
.btn-confirm-no {
    background: #e0e0e0;
    color: #333;
}

.btn-confirm-no:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-confirm-no:active {
    transform: translateY(0);
}

/* Кнопка "Да, очистить" */
.btn-confirm-yes {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-confirm-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* Уведомления */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification {
    padding: 12px 20px;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    max-width: 300px;
    pointer-events: auto;
}

.notification.success {
    background: #4CAF50;
}

.notification.error {
    background: #f44336;
}

.notification.warning {
    background: #ff9800;
}

.notification.info {
    background: #2196F3;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.notification.slide-out {
    animation: slideOut 0.3s ease forwards;
}

/* Глобальные сообщения (showMessage) */
.global-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 300px;
}

.global-message.success {
    background-color: #4CAF50;
}

.global-message.error {
    background-color: #f44336;
}

.global-message.warning {
    background-color: #ff9800;
}

.global-message.info {
    background-color: #2196F3;
}

.global-message.display-none {
    display: none;
}

/* Стили для баланса */
.balance-ok {
    color: #10b981;
}

.balance-low {
    color: #ef4444;
}

/* Ошибка валидации поля */
.field-error {
    border: 2px solid #dc3545 !important;
}

.btn-confirm-yes:active {
    transform: translateY(0);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 600px) {
    .confirm-dialog {
        width: 95%;
    }

    .confirm-dialog-header h3 {
        font-size: 1rem;
    }

    .confirm-dialog-body {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .confirm-dialog-footer {
        padding: 1rem;
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .confirm-dialog-footer button {
        width: 100%;
        padding: 0.65rem 1rem;
    }
}