/* static/css/style.css */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

/* Сайдбар */
.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.5em;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-chat-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-item {
    padding: 12px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-item:hover {
    background: var(--bg-tertiary);
}

.chat-item.active {
    background: var(--primary-dark);
}

.chat-item-icon {
    font-size: 1.2em;
}

.chat-item-info {
    flex: 1;
    overflow: hidden;
}

.chat-item-title {
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 0.8em;
    color: var(--text-secondary);
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
}

.user-name {
    font-weight: 600;
}

.user-status {
    font-size: 0.8em;
    color: var(--success);
}

/* Основной чат */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-header {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5em;
    cursor: pointer;
    display: none;
}

.chat-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-title h1 {
    font-size: 1.2em;
}

.model-badge {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8em;
}

.stats-mini {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
}

.token-count, .budget-indicator {
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
}

/* Сообщения */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.welcome-content {
    max-width: 600px;
}

.logo-animation {
    font-size: 4em;
    animation: pulse 2s infinite;
    margin-bottom: 20px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.welcome-content h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

.welcome-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.suggestions {
    margin-top: 30px;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.suggestion-chip {
    padding: 10px 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.suggestion-chip:hover {
    background: var(--primary-dark);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: var(--primary);
}

.agent-message .message-avatar {
    background: var(--secondary);
}

.message-content {
    flex: 1;
    background: var(--bg-secondary);
    padding: 12px 15px;
    border-radius: 12px;
    line-height: 1.6;
}

.user-message .message-content {
    background: var(--primary-dark);
}

.message-content pre {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-actions {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.message:hover .message-actions {
    opacity: 1;
}

.action-icon-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s;
}

.action-icon-btn:hover {
    background: var(--primary);
    color: white;
}

/* Индикатор печати */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    margin: 10px 0;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Панель ввода */
.input-container {
    padding: 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 8px;
    border: 1px solid var(--border);
    transition: border-color 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1em;
    padding: 8px;
    resize: none;
    max-height: 150px;
    outline: none;
}

.input-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
}

.action-btn:hover {
    color: var(--text-primary);
}

.send-btn {
    background: var(--primary);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

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

.input-footer {
    margin-top: 8px;
    text-align: center;
}

.input-hint {
    font-size: 0.8em;
    color: var(--text-secondary);
}

/* Панель настроек */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: var(--bg-secondary);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideRight 0.3s ease;
}

@keyframes slideRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.settings-content {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5em;
    cursor: pointer;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.setting-group input[type="range"] {
    width: 100%;
}

.setting-group textarea,
.setting-group input[type="number"] {
    width: 100%;
    padding: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
}

.save-settings-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 20px;
    transition: background 0.3s;
}

.save-settings-btn:hover {
    background: var(--primary-dark);
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
}

.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2em;
    cursor: pointer;
}

/* Адаптивный дизайн */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: block;
    }
    
    .settings-panel {
        width: 100%;
    }
    
    .stats-mini {
        display: none;
    }
}

/* Кастомный скроллбар */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}
