* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #212121;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Боковая панель */
.sidebar {
    width: 260px;
    background-color: #171717;
    border-right: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #2d2d2d;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background-color: transparent;
    border: 1px solid #4d4d4d;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background-color: #2d2d2d;
    border-color: #6d6d6d;
}

.chat-history {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    position: relative;
    group: hover;
}

.chat-item:hover {
    background-color: #2d2d2d;
}

.chat-item.active {
    background-color: #343541;
}

.chat-item span {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-chat {
    opacity: 0;
    background: none;
    border: none;
    color: #6d6d6d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chat-item:hover .delete-chat {
    opacity: 1;
}

.delete-chat:hover {
    background-color: #4d4d4d;
    color: #ff6b6b;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #2d2d2d;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-profile:hover {
    background-color: #2d2d2d;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: #4d4d4d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.user-role {
    font-size: 12px;
    color: #6d6d6d;
}

.model-info-small {
    font-size: 10px;
    color: #4d4d4d;
    background-color: #2d2d2d;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 2px;
    display: inline-block;
}

.settings-btn {
    background: none;
    border: none;
    color: #6d6d6d;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background-color: #4d4d4d;
    color: #ffffff;
}

/* Основная область */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #212121;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #2d2d2d;
    background-color: #171717;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-title h1 {
    font-size: 18px;
    font-weight: 600;
}

.model-info {
    background-color: #4d4d4d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #ffffff;
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    color: #6d6d6d;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background-color: #4d4d4d;
    color: #ffffff;
}

/* Контейнер чата */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.welcome-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
}

.welcome-content h2 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content p {
    font-size: 18px;
    color: #6d6d6d;
    margin-bottom: 32px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

.suggestion-card {
    background-color: #2d2d2d;
    border: 1px solid #4d4d4d;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.suggestion-card:hover {
    background-color: #343541;
    border-color: #6d6d6d;
    transform: translateY(-2px);
}

.suggestion-card i {
    font-size: 20px;
    color: #667eea;
}

.suggestion-card span {
    font-size: 14px;
    color: #ffffff;
}

/* Сообщения чата */
.message {
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background-color: #667eea;
    color: #ffffff;
}

.message.assistant .message-avatar {
    background-color: #4d4d4d;
    color: #ffffff;
}

.message-content {
    flex: 1;
    background-color: #2d2d2d;
    border-radius: 12px;
    padding: 16px;
    max-width: 70%;
}

.message.user .message-content {
    background-color: #343541;
}

.message-text {
    line-height: 1.6;
    font-size: 14px;
}

.message-time {
    font-size: 12px;
    color: #6d6d6d;
    margin-top: 8px;
}

/* Поле ввода */
.chat-input-container {
    padding: 24px;
    border-top: 1px solid #2d2d2d;
    background-color: #171717;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    background-color: #2d2d2d;
    border: 1px solid #4d4d4d;
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 120px;
}

#messageInput::placeholder {
    color: #6d6d6d;
}

.send-btn {
    background-color: #667eea;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    padding: 8px 12px;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.send-btn:hover:not(:disabled) {
    background-color: #5a6fd8;
}

.send-btn:disabled {
    background-color: #4d4d4d;
    cursor: not-allowed;
    opacity: 0.5;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: #6d6d6d;
}

.char-count {
    color: #6d6d6d;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #2d2d2d;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #4d4d4d;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: #6d6d6d;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background-color: #4d4d4d;
    color: #ffffff;
}

.modal-body {
    padding: 20px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.setting-group select,
.setting-group input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    background-color: #343541;
    border: 1px solid #4d4d4d;
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
}

.setting-group input[type="range"] {
    width: 100%;
    margin-bottom: 8px;
}

#temperatureValue {
    font-size: 12px;
    color: #6d6d6d;
}

.api-status-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.api-status {
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
}

.api-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.api-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.test-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.test-btn:hover:not(:disabled) {
    background: #0056b3;
}

.test-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.api-key-container input {
    flex: 1;
}

.save-btn {
    background-color: #667eea;
    border: none;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.save-btn:hover {
    background-color: #5a6fd8;
}

.api-key-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6d6d6d;
}

.api-key-help a {
    color: #667eea;
    text-decoration: none;
}

.api-key-help a:hover {
    text-decoration: underline;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.message {
    animation: fadeIn 0.3s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        z-index: 100;
        height: 100vh;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        width: 100%;
    }
    
    .suggestions {
        grid-template-columns: 1fr;
    }
    
    .message-content {
        max-width: 85%;
    }
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #2d2d2d;
}

::-webkit-scrollbar-thumb {
    background: #4d4d4d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6d6d6d;
}
