/* public/styles.css - /public/styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: #2c3e50;
    color: white;
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.2rem;
}

.controls {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #ddd;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.model-selection {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.model-selection select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 0;
}

.prompt-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.prompt-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.prompt-controls select {
    flex: 1;
    min-width: 120px;
    padding: 0.25rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.system-prompt textarea,
.file-upload input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.system-prompt textarea {
    resize: vertical;
    min-height: 80px;
}

.file-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    display: none;
    word-break: break-word;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    min-width: 0;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    -webkit-overflow-scrolling: touch;
}

.message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: #007bff;
    color: white;
}

.message.ai {
    align-self: flex-start;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Заголовок и бейдж модели в ответах AI */
.ai-message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.model-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    font-size: 11px;
    font-weight: 600;
    color: #0d6efd;
    background: #e7f1ff;
    border: 1px solid #cfe2ff;
    border-radius: 6px;
}

.ai-message-content {
    white-space: normal;
}

.ai-message-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.message.ai.streaming {
    border-left: 3px solid #007bff;
}

.input-area {
    padding: 1rem;
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    flex-shrink: 0;
}

.input-area textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    min-height: 44px;
    max-height: 220px;
}

/* Новая компоновка панели ввода */
.message-input-container {
    position: relative;
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem;
    gap: 0.5rem;
    width: 100%;
}

.message-input-container textarea {
    flex: 1;
    border: none;
    resize: none;
    font-family: inherit;
    min-height: 20px;
    max-height: 160px;
    padding: 0.5rem;
    outline: none;
    background: transparent;
    width: 100%;
}

.input-top-controls {
    display: none; /* скрыто, так как теперь выбор через иконки */
}

.input-top-controls .control-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.input-top-controls select.compact {
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-width: 140px;
    font-size: 13px;
}

.prompts-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    min-height: 44px;
    touch-action: manipulation;
    user-select: none;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 12px;
    min-height: 32px;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background-color: white;
    margin: 2rem auto;
    padding: 1.5rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.modal-content.code-modal {
    max-width: 95%;
    max-height: calc(100vh - 2rem);
    margin: 1rem auto;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f8f9fa;
}

.close:hover {
    color: #000;
    background: #e9ecef;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px; /* Предотвращает зум на iOS */
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Промпты */
.prompts-section,
.defaults-section {
    margin-bottom: 2rem;
}

.prompts-section h3,
.defaults-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.1rem;
}

.prompts-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Список выбора промпта (в модалке быстрого выбора) */
.prompt-selection-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}

.prompt-selection-item:last-child {
    border-bottom: none;
}

.prompt-selection-item input[type="radio"] {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.prompt-selection-item .prompt-name {
    font-weight: 600;
    color: #2c3e50;
    word-break: break-word;
}

.prompt-item {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.prompt-item:last-child {
    border-bottom: none;
}

.prompt-item:hover {
    background-color: #f8f9fa;
}

.prompt-info {
    flex: 1;
}

.prompt-name {
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.prompt-preview {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    word-break: break-word;
}

.prompt-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.current-default {
    font-style: italic;
    color: #666;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    word-break: break-word;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.history-item {
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    word-break: break-word;
}

.history-item:hover {
    background-color: #f8f9fa;
}

.code-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.code-header input {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.code-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1rem;
    max-height: 60vh;
    overflow: auto;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    -webkit-overflow-scrolling: touch;
}

/* Код в сообщениях */
.code-block {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    position: relative;
    overflow: hidden;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.code-block-title {
    font-weight: bold;
    color: #495057;
    font-size: 14px;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.code-block-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.code-block-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 11px;
    min-height: 28px;
}

.code-block-footer {
    margin-top: 0.35rem;
    justify-content: flex-end;
}

.code-modal-footer {
    justify-content: flex-end;
}

/* Иконки действий в сообщении AI */
.ai-message-actions button {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ai-message-actions-footer {
    margin-top: 0.35rem;
    justify-content: flex-end;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.inline-code {
    background: #f1f3f4;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    word-break: break-word;
}

/* Мобильная адаптивность */
@media (max-width: 768px) {
    .header {
        padding: 0.5rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header h1 {
        font-size: 1.1rem;
        flex: 1;
        min-width: 200px;
    }

    .controls {
        gap: 0.25rem;
    }

    .controls .btn {
        padding: 0.4rem 0.6rem;
        font-size: 12px;
        min-height: 36px;
    }

    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding: 0.75rem;
        gap: 0.75rem;
        order: 2;
        background: #fafafa;
    }

    .chat-area {
        order: 1;
        flex: 1;
        min-height: 60vh;
    }

    .chat-messages {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .message {
        max-width: 90%;
        padding: 0.6rem 0.8rem;
        font-size: 14px;
    }

    .input-area {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .input-area textarea {
        padding: 0.6rem;
        font-size: 16px;
    }

    .model-selection {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .prompt-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .prompt-controls select {
        min-width: auto;
        flex: none;
    }

    .modal-content {
        margin: 1rem auto;
        padding: 1rem;
        width: 95%;
        max-height: calc(100vh - 2rem);
    }

    .modal-content.code-modal {
        margin: 0.5rem auto;
        width: 98%;
        max-height: calc(100vh - 1rem);
    }

    .code-header {
        flex-direction: column;
        align-items: stretch;
    }

    .code-content {
        font-size: 12px;
        max-height: 50vh;
    }

    .code-block {
        padding: 0.5rem;
    }

    .code-block-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .code-block-actions {
        align-self: stretch;
        justify-content: space-around;
    }

    .code-block-actions button {
        flex: 1;
        max-width: 100px;
    }

    .code-block pre {
        font-size: 11px;
    }

    .prompt-item {
        padding: 0.75rem;
    }

    .prompt-actions {
        justify-content: space-around;
    }

    .prompt-actions button {
        flex: 1;
        max-width: 120px;
    }

    .modal-actions {
        justify-content: space-around;
    }

    .modal-actions button {
        flex: 1;
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1rem;
        min-width: 150px;
    }

    .controls .btn {
        padding: 0.3rem 0.4rem;
        font-size: 11px;
        min-height: 32px;
    }

    .sidebar {
        padding: 0.5rem;
    }

    .chat-messages {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .message {
        padding: 0.5rem 0.7rem;
        font-size: 13px;
        max-width: 95%;
    }

    .input-area {
        padding: 0.5rem;
    }

    .code-block {
        padding: 0.4rem;
    }

    .code-block pre {
        font-size: 10px;
    }

    .code-content {
        font-size: 11px;
        padding: 0.75rem;
    }

    .modal-content {
        padding: 0.75rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.6rem;
    }
}

/* Улучшения для сенсорных устройств */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        background: inherit;
    }

    .btn-primary:active {
        background: #0056b3;
    }

    .btn-secondary:active {
        background: #545b62;
    }

    .prompt-item:hover {
        background-color: inherit;
    }

    .prompt-item:active {
        background-color: #f8f9fa;
    }

    .history-item:hover {
        background-color: inherit;
    }

    .history-item:active {
        background-color: #f8f9fa;
    }

    .close:hover {
        color: inherit;
        background: inherit;
    }

    .close:active {
        color: #000;
        background: #e9ecef;
    }
}

/* Скрытие полос прокрутки на мобильных устройствах */
@media (max-width: 768px) {
    .chat-messages::-webkit-scrollbar,
    .prompts-list::-webkit-scrollbar,
    .history-list::-webkit-scrollbar,
    .code-content::-webkit-scrollbar,
    .modal-content::-webkit-scrollbar {
        display: none;
    }

    .chat-messages,
    .prompts-list,
    .history-list,
    .code-content,
    .modal-content {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        max-height: 40vh;
        overflow-y: auto;
    }

    .chat-area {
        min-height: 60vh;
    }

    .modal-content {
        max-height: calc(100vh - 1rem);
    }

    .code-content {
        max-height: 40vh;
    }
}

/* Глобальные стили списка моделей (всегда активны) */
.models-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.model-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    width: 100%;
}

.model-item:last-child {
    border-bottom: none;
}

.model-name {
    font-weight: 600;
    color: #2c3e50;
    word-break: break-word;
}

.models-list input[type="radio"] {
    width: 16px;
    height: 16px;
}

/* Темная тема для устройств с поддержкой */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .sidebar {
        background: #2d2d2d;
        border-color: #404040;
    }

    .chat-area {
        background: #2d2d2d;
    }

    .message.ai {
        background: #3d3d3d;
        border-color: #505050;
    }

    .code-block {
        background: #3d3d3d;
        border-color: #505050;
    }

    .code-content {
        background: #3d3d3d;
        border-color: #505050;
        color: #e0e0e0;
    }

    .modal-content {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    .form-group input,
    .form-group textarea,
    .system-prompt textarea,
    .model-selection select,
    .prompt-controls select {
        background: #3d3d3d;
        border-color: #505050;
        color: #e0e0e0;
    }

    .file-info,
    .current-default {
        background: #3d3d3d;
        color: #b0b0b0;
    }

    .close {
        background: #3d3d3d;
        color: #b0b0b0;
    }

    .close:hover,
    .close:active {
        background: #505050;
        color: #e0e0e0;
    }

    /* public/styles.css - дополнения к существующему CSS */

    /* Добавляем новые стили к существующему CSS */

    /* Контейнер для ввода сообщения */
    .message-input-container {
        position: relative;
        display: flex;
        align-items: flex-end;
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .message-input-container textarea {
        flex: 1;
        border: none;
        resize: none;
        font-family: inherit;
        min-height: 20px;
        max-height: 120px;
        padding: 0.5rem;
        outline: none;
        background: transparent;
    }

    .input-controls {
        display: flex;
        gap: 0.25rem;
        align-items: center;
        flex-shrink: 0;
    }

    /* Список моделей в модалке */
    .models-list {
        border: 1px solid #ddd;
        border-radius: 6px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .model-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #eee;
        cursor: pointer;
        width: 100%;
    }

    .model-item:last-child {
        border-bottom: none;
    }

    .model-name {
        font-weight: 600;
        color: #2c3e50;
        word-break: break-word;
    }

    .models-list input[type="radio"] {
        width: 16px;
        height: 16px;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        transition: all 0.2s;
        background: #f8f9fa;
        color: #495057;
        user-select: none;
        touch-action: manipulation;
    }

    .btn-icon:hover {
        background: #e9ecef;
        transform: scale(1.05);
    }

    .btn-icon:active {
        transform: scale(0.95);
    }

    .btn-icon.btn-send {
        background: #007bff;
        color: white;
    }

    .btn-icon.btn-send:hover {
        background: #0056b3;
    }

    .btn-icon.btn-send:disabled {
        background: #6c757d;
        cursor: not-allowed;
        transform: none;
    }

    .btn-icon.active {
        background: #007bff;
        color: white;
    }

    /* Информация о чате */
    .chat-info {
        margin-bottom: 1rem;
    }

    .current-chat-info label {
        display: block;
        font-weight: bold;
        margin-bottom: 0.5rem;
        color: #2c3e50;
    }

    .chat-name-container {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    #currentChatName {
    flex: 1;
    font-weight: bold;
    color: #495057;
    word-break: break-word;
    }

    .chat-stats {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 12px;
        color: #666;
    }

    .auto-save-status {
        font-size: 16px;
        margin-left: 0.5rem;
    }

    .auto-save-status.saved {
        color: #28a745;
    }

    .auto-save-status.saving {
        color: #ffc107;
        animation: pulse 1s infinite;
    }

    .auto-save-status.error {
        color: #dc3545;
    }

    @keyframes pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.5; }
    }

    /* Переключатель рассуждений */
    .reasoning-toggle {
        margin-bottom: 1rem;
    }

    .reasoning-toggle label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 14px;
        cursor: pointer;
        user-select: none;
    }

    .reasoning-toggle input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    /* Список чатов */
    .chats-section {
        margin-bottom: 2rem;
    }

    .chats-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }

    .chats-header h3 {
        margin: 0;
        color: #2c3e50;
        font-size: 1.1rem;
    }

    .chats-list {
        max-height: 400px;
        overflow-y: auto;
        border: 1px solid #ddd;
        border-radius: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .chat-item {
        padding: 1rem;
        border-bottom: 1px solid #eee;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        transition: background-color 0.2s;
    }

    .chat-item:last-child {
        border-bottom: none;
    }

    .chat-item:hover {
        background-color: #f8f9fa;
    }

    .chat-item.current {
        background-color: #e3f2fd;
        border-left: 3px solid #007bff;
    }

    .chat-item-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chat-item-name {
        font-weight: bold;
        color: #2c3e50;
        flex: 1;
        word-break: break-word;
    }

    .chat-item-actions {
        display: flex;
        gap: 0.25rem;
        flex-shrink: 0;
    }

    .chat-item-info {
        font-size: 12px;
        color: #666;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .chat-item-preview {
        font-size: 13px;
        color: #666;
        line-height: 1.4;
        max-height: 2.8em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        word-break: break-word;
    }

    /* Мобильная адаптивность для новых элементов */
    @media (max-width: 768px) {
        .controls {
            order: 2;
            width: 100%;
            justify-content: space-around;
            margin-top: 0.5rem;
        }

        .controls .btn {
            flex: 1;
            max-width: none;
            font-size: 11px;
            padding: 0.4rem 0.2rem;
        }

        .message-input-container {
            padding: 0.4rem;
        }

        .btn-icon {
            width: 32px;
            height: 32px;
            font-size: 14px;
        }

        .input-controls {
            gap: 0.2rem;
        }

        .chat-name-container {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.3rem;
        }

        .chat-stats {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.2rem;
        }

        .chat-item-header {
            flex-direction: column;
            align-items: flex-start;
        }

        .chat-item-actions {
            align-self: stretch;
            justify-content: space-around;
        }

        .chat-item-actions button {
            flex: 1;
            max-width: 80px;
        }

        .chats-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.5rem;
        }

        .reasoning-toggle {
            margin-bottom: 0.5rem;
        }

        .reasoning-toggle label {
            font-size: 13px;
        }
    }

    @media (max-width: 480px) {
        .controls .btn {
            font-size: 10px;
            padding: 0.3rem 0.1rem;
        }

        .btn-icon {
            width: 28px;
            height: 28px;
            font-size: 12px;
        }

        .message-input-container {
            padding: 0.3rem;
        }

        .chat-item {
            padding: 0.75rem;
        }

        .chat-item-name {
            font-size: 14px;
        }

        .chat-item-preview {
            font-size: 12px;
        }
    }

    /* Темная тема для новых элементов */
    @media (prefers-color-scheme: dark) {
        .message-input-container {
            background: #3d3d3d;
            border-color: #505050;
        }

        .message-input-container textarea {
            color: #e0e0e0;
        }

        .btn-icon {
            background: #4d4d4d;
            color: #e0e0e0;
        }

        .btn-icon:hover {
            background: #5d5d5d;
        }

        .btn-icon.btn-send {
            background: #007bff;
            color: white;
        }

        .btn-icon.active {
            background: #007bff;
            color: white;
        }

        .chat-item {
            background: #2d2d2d;
            border-color: #404040;
        }

        .chat-item:hover {
            background: #3d3d3d;
        }

        .chat-item.current {
            background: #1a3a5c;
            border-color: #007bff;
        }

        .chat-item-name {
            color: #e0e0e0;
        }

        .chats-list {
            background: #2d2d2d;
            border-color: #505050;
        }
    }
}
