/* GSC AI Chat Styles */

/* Layout */
.chat-app {
    display: flex;
    height: calc(100vh - 120px);
    overflow: hidden;
    background: #f8f9fa;
}

/* Sidebar */
.chat-sidebar {
    width: 280px;
    background: #1a1a2e;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.btn-new-chat {
    width: 100%;
    padding: 10px 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-new-chat:hover {
    background: rgba(255,255,255,0.15);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #c0c0c0;
    transition: background 0.15s;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversation-item:hover {
    background: rgba(255,255,255,0.08);
}

.conversation-item.active {
    background: rgba(102, 126, 234, 0.25);
    color: #fff;
}

.conversation-item .conv-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item .conv-delete {
    opacity: 0;
    padding: 2px 6px;
    border: none;
    background: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.conversation-item:hover .conv-delete {
    opacity: 1;
}

.conversation-item .conv-delete:hover {
    color: #ff6b6b;
    background: rgba(255,107,107,0.1);
}

/* Main chat area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.btn-sidebar-toggle {
    display: none;
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    padding: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* Welcome message */
.welcome-message {
    text-align: center;
    margin: auto;
    max-width: 600px;
    padding: 40px 20px;
}

.welcome-message h2 {
    color: #333;
    margin-bottom: 12px;
    font-size: 1.8rem;
}

.welcome-message p {
    color: #666;
    margin-bottom: 24px;
    font-size: 1rem;
}

.welcome-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.welcome-chip {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.welcome-chip:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

/* Message bubbles */
.message {
    max-width: 800px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.message.user {
    align-self: flex-end;
    margin-left: auto;
}

.message.assistant {
    align-self: flex-start;
    margin-right: auto;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Markdown rendering in assistant messages */
.message.assistant .message-content h1,
.message.assistant .message-content h2,
.message.assistant .message-content h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.message.assistant .message-content h1 { font-size: 1.3rem; }
.message.assistant .message-content h2 { font-size: 1.15rem; }
.message.assistant .message-content h3 { font-size: 1.05rem; }

.message.assistant .message-content p {
    margin-bottom: 8px;
}

.message.assistant .message-content ul,
.message.assistant .message-content ol {
    padding-left: 20px;
    margin-bottom: 8px;
}

.message.assistant .message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}

.message.assistant .message-content th,
.message.assistant .message-content td {
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.message.assistant .message-content th {
    background: #f5f5f5;
    font-weight: 600;
}

.message.assistant .message-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.message.assistant .message-content pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message.assistant .message-content pre code {
    padding: 0;
    background: none;
}

.message.assistant .message-content strong {
    font-weight: 600;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 800px;
    margin: 0 auto;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.chat-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    padding: 8px 0;
    font-family: inherit;
}

.btn-send {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.btn-send:hover {
    opacity: 0.9;
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-input-info {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 6px;
}

/* Error message style */
.message.error .message-content {
    background: #fff5f5;
    border-color: #feb2b2;
    color: #c53030;
}

/* Tool calls badge */
.tool-calls-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #888;
    margin-top: 6px;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 10px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1100;
        transition: left 0.3s ease;
    }

    .chat-sidebar.open {
        left: 0;
    }

    .btn-sidebar-toggle {
        display: block;
    }

    .chat-messages {
        padding: 16px;
        padding-top: 50px;
    }

    .chat-input-area {
        padding: 12px 16px;
    }

    .message-content {
        font-size: 13px;
    }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.conversation-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}
