/* Общие стили */
body {
    font-family: 'Roboto', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
    min-height: 100vh;
}

.header {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    color: #333;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 2px solid #007bff;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.15);
    gap: 15px;
}

.header a {
    color: #333;
    text-decoration: none;
    margin-left: 20px;
    padding: 8px 16px;
    border-radius: 8px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    margin-left: 0;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-size: 14px;
}

.nav-links a:hover {
    background: linear-gradient(145deg, #007bff20, #007bff40);
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.2);
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }
    
    .nav-links {
        gap: 8px;
        justify-content: center;
    }
    
    .nav-links a {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .user-info {
        font-size: 14px;
    }
}

.user-info {
    display: flex;
    align-items: center;
}

.user-info .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}

.chat-container {
    width: 90%;
    max-width: 800px;
    margin: 30px auto;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 2px solid #007bff;
    animation: fadeIn 0.6s ease-out;
    backdrop-filter: blur(10px);
}

.chat-output {
    height: 400px;
    overflow-y: auto;
    margin-bottom: 25px;
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.chat-input {
    width: 100%;
    min-height: 60px;
    max-height: 200px;
    resize: none;
    padding: 15px;
    font-family: 'Roboto', sans-serif;
    border: 2px solid #e9ecef;
    color: #333;
    background: #ffffff;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.5;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.send-button {
    width: 100px;
    padding: 12px;
    border: none;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.chat-button {
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.send-button:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

.chat-button:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

.send-button.disabled-button:hover {
    background-color: grey; /* Задаем одинаковый цвет при наведении для заблокированной кнопки */
    cursor: not-allowed;
}

/* Стили для кнопок */
.button-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
    padding-bottom: 20px; /* Добавляем отступ снизу для контейнера */
}

.button-container button {
    padding: 10px 20px;
    margin: 10px;
    border: none;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.button-container .disabled-button {
    background-color: grey;
    color: white;
    padding: 10px;
    border-radius: 15px;
    margin-bottom: 10px;
    max-width: 100%;
    word-wrap: break-word;
}

.message {
    position: relative;
    padding: 15px 20px;
    border-radius: 18px;
    margin-bottom: 20px;
    max-width: 80%;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #e8f5e8, #d1e7dd);
    color: #0f5132;
    border: 1px solid #007bff;
    border-bottom-right-radius: 5px;
}

.message.assistant {
    align-self: flex-start;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 5px;
}

.message .content {
    display: block;
    margin-bottom: 10px;
    line-height: 1.6;
}

.message .buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    gap: 8px;
}

.message.system {
    align-self: center;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #007bff;
    max-width: 90%;
    margin: 20px auto;
    border: 1px solid #007bff;
    padding: 15px 25px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.1);
}

.message .edit-button,
.message .regenerate-button,
.message .delete-button,
.message .copy-button,
.message .find-in-context-button {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    cursor: pointer;
    color: #007bff;
    padding: 6px 12px;
    margin-left: 5px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 12px;
    font-weight: 600;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.message .find-in-context-button {
    background: linear-gradient(135deg, #28a745, #218838);
    border: 1px solid #218838;
    color: white;
}

.message .edit-button:hover,
.message .regenerate-button:hover,
.message .delete-button:hover,
.message .copy-button:hover {
    background: linear-gradient(135deg, #007bff20, #007bff40);
    border-color: #007bff;
    color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

.message .find-in-context-button:hover {
    background: linear-gradient(135deg, #218838, #28a745);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
    color: white;
}

/* Темная тема для кнопки найти в контексте */
body.dark-theme .message .find-in-context-button {
    background: linear-gradient(135deg, #28a745, #218838);
    border: 1px solid #218838;
    color: white;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

body.dark-theme .message .find-in-context-button:hover {
    background: linear-gradient(135deg, #218838, #28a745);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.timestamp {
    display: block;
    font-size: 0.75em;
    color: #6c757d;
    margin-top: 5px;
    text-align: right;
}

/* Стили для диалога редактирования */
#edit-message-dialog {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border: 1px solid #007BFF;
    background-color: #fffafa;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

#edit-message-dialog h2 {
    margin: 0;
}

#edit-message-dialog input {
    width: 100%;
    margin-bottom: 10px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

/* Стили для контейнера списка персонажей */
.characters-list-container {
    width: 90%;
    max-width: 600px;
    margin: 30px auto;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 2px solid #007bff;
    backdrop-filter: blur(10px);
}

/* Заголовок списка персонажей */
.characters-list-container h2 {
    text-align: center;
    color: #007bff;
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 25px;
    text-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

/* Стили для списка персонажей */
.characters-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/* Стили для элементов списка персонажей */
.character-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 1em;
    color: #333;
    flex-wrap: wrap;
    margin-bottom: 15px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.character-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.15);
    border-color: #007bff;
}

.character-item:last-child {
    border-bottom: none;
}

/* Стили для аватаров персонажей */
.character-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    transition: transform 0.3s ease;
}

.character-avatar:hover {
    transform: scale(1.1);
}

/* Стили для имени персонажа */
.character-name {
    flex-grow: 1;
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Стили для кнопок */
.character-buttons{
display: flex;
gap: 10px;
flex-wrap: wrap;
}

.italic-gray-text {
    color: #666666;
    font-style: italic;
}

.chat-selector {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.chat-dropdown {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    color: #333;
    font-size: 1em;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-dropdown:hover {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.chat-dropdown:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

/* Стили для переключателя темы */
.theme-switch-container {
    position: fixed;
    top: 80px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-switch-container label {
    color: #333;
    margin-right: 8px;
    font-weight: 600;
    font-size: 14px;
}

.theme-switch-container select {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.theme-switch-container select:hover {
    border-color: #007bff;
    background: #fff;
}

.theme-switch-container select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.theme-switch-container select option {
    background: #fff;
    color: #333;
    padding: 8px;
}

.voice-button {
    width: 100px;
    padding: 12px;
    border: none;
    background: linear-gradient(135deg, #00bbff, #0099cc);
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 187, 255, 0.3);
}

.voice-button:hover {
    background: linear-gradient(135deg, #00a3e0, #0077a3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 163, 224, 0.4);
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(0, 123, 255, 0.5); }
    100% { box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3); }
}

/* Стилизация скроллбара */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, #007bff, #0056b3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, #0056b3, #004085);
}

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
}

.scroll-to-top:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 123, 255, 0.5);
}

/* Стили для footer */
.site-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin-top: 50px;
    padding: 40px 0 20px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.footer-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: bold;
}

.footer-section p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.footer-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-features li {
    color: #666;
    margin-bottom: 8px;
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    color: #666;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .site-footer {
        padding: 30px 0 15px;
    }
}

/* Стили для блоков кода */
.code-block {
    background-color: #e2f0e9; /* Более светлый зеленый к сообщению пользователя */
    border-radius: 4px;
    padding: 1em;
    margin: 1em 0;
    overflow-x: auto;
    color: #0f5132;  /* Текст в цвет сообщения пользователя */
}

/* Стили для встроенного кода */
.inline-code {
    background-color: #e2f0e9; /* Сочетается с фоновым цветом блока кода */
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
    color: #0f5132;  /* Текст в цвет сообщения пользователя */
}

/* Стиль для курсивного текста */
em {
    color: #3d405b; /* Темный серый с легким оттенком синего для контраста */
}

/* Стили для таблиц */
.markdown-table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.markdown-table th,
.markdown-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.markdown-table th {
    background-color: #f5f5f5;
}

/* Стили для цитат */
.quote {
    border-left: 4px solid #ddd;
    margin: 1em 0;
    padding: 0.5em 1em;
    color: #666;
    background-color: #f9f9f9;
}

/* Стили для списков */
.ordered,
.unordered {
    margin-left: 20px;
}

/* Стили для блока поиска чатов */
.chat-search-form {
    margin-bottom: 15px;
}

.chat-search-form form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.chat-search-form input[type="text"] {
    flex: 1;
    padding: 10px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-search-form input[type="text"]:focus {
    border-color: #007BFF;
}

.chat-search-form button {
    margin-left: 10px;
    padding: 10px 20px;
    border: none;
    background-color: #007BFF;
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.chat-search-form button:hover {
    background-color: #0056b3;
}

/* Стили для модального окна переименования чата */
.modal {
    display: none;             /* Скрыто по умолчанию */
    position: fixed;           /* Фиксированное позиционирование */
    z-index: 1000;             /* Поверх остальных элементов */
    width: 100%;
    height: 100%;
    overflow: auto;            /* Скролл, если содержимое выходит за рамки */
    background-color: rgba(0, 0, 0, 0.5); /* Полупрозрачный черный фон */
}

.modal-content {
    background-color: #fff;    /* Белый фон, как у контейнеров */
    margin: 10% auto;          /* Центрирование по вертикали и горизонтали */
    padding: 20px;
    border: 1px solid #007BFF; /* Рамка в цвете темы */
    width: 300px;              /* Фиксированная ширина */
    border-radius: 10px;       /* Скругленные углы, как в других блоках */
    text-align: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Легкая тень */
}

.modal-content .close {
    color: #007BFF;            /* Цвет в тон теме */
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-content .close:hover {
    color: #0056b3;            /* Темный оттенок при наведении */
}

.character-link {
    text-decoration: none; /* Убирает подчеркивание */
    color: inherit;        /* Наследует цвет родительского элемента */
    cursor: pointer;       /* При этом остаётся курсор-ссылка */
}

/* Стили для кнопок действий с сообщениями */
.message-bubble button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 5px;
    margin: 0 2px;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.2s;
}

.message-bubble button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.edit-button, .delete-button, .copy-button {
    color: #666;
}

.regenerate-button {
    font-size: 14px;
}

/* Стили для контролов версий */
.version-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 5px 0;
    padding: 3px 0;
}

.version-btn {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    width: 24px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.version-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.2);
}

.version-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.version-info {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    min-width: 35px;
    text-align: center;
}

/* Кнопка бэкапа */
.backup-button {
    background-color: #28a745;
    transition: background-color 0.3s;
}
.backup-button:hover {
    background-color: #218838;
}

/* Стили для переключения версий сообщений */
.version-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 5px 0;
    font-size: 12px;
}

.version-btn {
    background: #007BFF;
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.version-btn:hover:not(:disabled) {
    background: #0056b3;
}

.version-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.version-info {
    font-size: 12px;
    color: #666;
    margin: 0 5px;
}

/* Стили для уведомления о копировании */
.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 1000;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease-in-out;
    max-width: 300px;
    word-wrap: break-word;
}

.copy-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.copy-notification .copy-icon {
    font-size: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.copy-notification:hover {
    background: linear-gradient(135deg, #45a049, #4CAF50);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Стили для кастомного диалога удаления */
.custom-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-delete-dialog {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    overflow: hidden;
}

.dialog-header {
    background: #007BFF;
    color: white;
    padding: 15px 20px;
    text-align: center;
}

.dialog-header h3 {
    margin: 0;
    font-size: 18px;
}

.dialog-content {
    padding: 20px;
    text-align: center;
}

.dialog-content p {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
}

.dialog-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
    text-align: center;
}

.dialog-btn small {
    display: block;
    font-size: 11px;
    font-weight: normal;
    margin-top: 2px;
    opacity: 0.8;
}

.btn-yes {
    background: #28a745;
    color: white;
}

.btn-yes:hover {
    background: #218838;
}

.btn-no {
    background: #dc3545;
    color: white;
}

.btn-no:hover {
    background: #c82333;
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background: #5a6268;
}

/* Медиазапросы для адаптивности */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header a {
        margin-left: 0;
        margin-top: 10px;
    }

    .chat-container {
        width: 95%;
        margin: 10px auto;
    }

    .characters-list-container {
        width: 95%;
        margin: 10px auto;
    }

    .button-container {
        flex-direction: column;
        align-items: center;
    }

    .chat-input {
        width: calc(100% - 100px);
    }
    
    .theme-switch-container {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px 0;
        padding: 8px 12px;
        justify-content: center;
    }
    
    .theme-switch-container label {
        font-size: 12px;
    }
    
    .theme-switch-container select {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .chat-input {
        width: 100%;
        margin-bottom: 10px;
    }

    .chat-button,
    .send-button,
    .voice-button,
    .regenerate-button,
    .button-container button {
        width: 100%;
        margin: 5px 0;
    }

    .character-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .character-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .theme-switch-container {
        padding: 6px 10px;
    }
    
    .theme-switch-container label,
    .theme-switch-container select {
        font-size: 11px;
    }
    
    /* Исправление для модальных окон на маленьких экранах */
    .modal-content {
        padding: 15px;
        width: calc(100% - 20px);
        margin: 20px;
    }
}

.chat-container {
    border: 1px solid #ddd;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
}

.chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}

.language-selector label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.language-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.language-select:hover {
    border-color: #007bff;
}

.language-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}