/* style.css - современный дизайн 2025-2026 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9eefa 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.app-container {
    display: flex;
    width: 100%;
    max-width: 1600px;
    height: 90vh;
    gap: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

/* Левая панель личности */
.personalities-panel {
    width: 260px;
    background: #f8fafc;
    border-radius: 1.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
}

.panel-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.personalities-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.personality-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: white;
    padding: 0.6rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.personality-avatar {
    font-size: 1.8rem;
    width: 2.5rem;
    text-align: center;
}

.personality-info {
    flex: 1;
}

.personality-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.personality-status {
    font-size: 0.7rem;
    color: #64748b;
}

/* Основная область чата */
.chat-main {
    flex: 1;
    background: white;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.title-section {
    flex: 1;
}

.title-section h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 1px;
}

.online-list {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.settings-btn {
    background: #f1f5f9;
    border: none;
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.settings-btn:hover {
    background: #e2e8f0;
    transform: scale(0.98);
}
.settings-btn:active {
    transform: scale(0.96);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #fefefe;
}

.message {
    display: flex;
    gap: 0.8rem;
    animation: fadeInUp 0.2s ease;
}

.message.user {
    justify-content: flex-end;
}

.message.user .message-bubble {
    background: #0066ff;
    color: white;
    border-bottom-right-radius: 0.2rem;
}

.message.person1 .message-bubble {
    background: #f1f5f9;
    border-left: 3px solid #e83e8c;
    color: #1e293b;
}

.message.person2 .message-bubble {
    background: #f1f5f9;
    border-left: 3px solid #20c997;
    color: #1e293b;
}

.message-avatar {
    font-size: 1.6rem;
    width: 2rem;
    text-align: center;
}

.message-bubble {
    max-width: 70%;
    padding: 0.6rem 1rem;
    border-radius: 1.2rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: #f1f5f9;
    border-radius: 2rem;
    width: fit-content;
    color: #475569;
    font-size: 0.8rem;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.chat-input-form {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    border-radius: 3rem;
    padding: 0.2rem;
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.7rem 1rem;
    color: #0f172a;
    font-size: 0.9rem;
    outline: none;
}

.chat-input::placeholder {
    color: #94a3b8;
}

.send-btn {
    background: #0066ff;
    border: none;
    border-radius: 2rem;
    padding: 0 1.2rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.send-btn:hover {
    background: #0052cc;
}

/* Правая панель чатов */
.chats-panel {
    width: 280px;
    background: #f8fafc;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.chats-header {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.new-chat-btn, .delete-all-btn {
    display: block;
    background: #e2e8f0;
    text-align: center;
    padding: 0.5rem;
    border-radius: 2rem;
    text-decoration: none;
    color: #1e293b;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    transition: 0.2s;
}

.new-chat-btn:hover {
    background: #cbd5e1;
}

.delete-all-btn {
    background: #fee2e2;
    color: #dc2626;
}

.delete-all-btn:hover {
    background: #fecaca;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    list-style: none;
}

.chat-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-list-item.active {
    background: #dbeafe;
    border-left: 3px solid #0066ff;
}

.chat-link {
    flex: 1;
    text-decoration: none;
    color: #1e293b;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-chat, .rename-chat {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 0.3rem;
    color: #64748b;
}

.delete-chat:hover {
    color: #dc2626;
}

/* Панель настроек (выезжающая справа) */
.settings-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 360px;
    height: 100%;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    border-left: 1px solid #e2e8f0;
    transition: right 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: 'Inter', sans-serif;
}
.settings-panel.open {
    right: 0;
}
.settings-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.settings-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
}
.close-settings {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}
.close-settings:hover {
    color: #0f172a;
}
.settings-content {
    flex: 1;
    padding: 1.5rem;
    color: #475569;
    text-align: center;
}
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}
.settings-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Анимации */
@keyframes fadeInUp {
    from { opacity:0; transform:translateY(8px); }
    to { opacity:1; transform:translateY(0); }
}
@keyframes typing {
    0%,60%,100% { transform:translateY(0); opacity:0.4; }
    30% { transform:translateY(-3px); opacity:1; }
}

/* Скролл */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 10px; }

/* Адаптивность */
@media (max-width: 900px) {
    .app-container { flex-direction: column; height: auto; }
    .personalities-panel, .chats-panel { width: 100%; flex-direction: row; overflow-x: auto; }
    .personalities-list { display: flex; flex-direction: row; gap: 0.5rem; }
    .personality-item { min-width: 150px; }
    .chats-list { display: flex; gap: 0.5rem; flex-wrap: wrap; }
    .chat-list-item { min-width: 120px; }
    .settings-panel { width: 100%; right: -100%; }
}
/* Стили для формы настроек */
.settings-section {
    padding: 0.5rem 0;
}
.settings-section h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #0f172a;
}
.settings-field {
    margin-bottom: 1rem;
}
.settings-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.3rem;
}
.settings-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    background: #f8fafc;
    transition: 0.2s;
}
.settings-input:focus {
    outline: none;
    border-color: #0066ff;
    box-shadow: 0 0 0 2px rgba(0,102,255,0.1);
}
textarea.settings-input {
    resize: vertical;
    min-height: 80px;
}
.settings-save-btn {
    background: #0066ff;
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 2rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
    transition: 0.2s;
}
.settings-save-btn:hover {
    background: #0052cc;
}
.settings-note {
    font-size: 0.7rem;
    color: #64748b;
    text-align: center;
    margin-top: 1rem;
}