/* OpenAI Chat System - Custom Styles */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
}

.container-fluid {
    height: 100vh;
}

.row {
    height: 100%;
}

/* 側邊欄 */
.sidebar {
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #dee2e6;
}

.character-item {
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.character-item:hover {
    background-color: #f8f9fa;
    border-color: #0d6efd;
}

.character-item.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

.character-item.active .character-meta {
    color: rgba(255, 255, 255, 0.8);
}

.character-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.character-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

/* 對話容器 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 標題列 */
.chat-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

/* 訊息區 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #ffffff;
}

.message {
    margin-bottom: 20px;
    display: flex;
    animation: fadeIn 0.3s;
}

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

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.user .message-content {
    background-color: #0d6efd;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background-color: #f8f9fa;
    color: #212529;
    border-bottom-left-radius: 4px;
    border: 1px solid #dee2e6;
}

.message-role {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 4px;
    font-weight: 600;
}

.message.user .message-role {
    text-align: right;
}

.message-text {
    line-height: 1.5;
    white-space: pre-wrap;
}

/* 載入中動畫 */
.loading-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    max-width: 70%;
}

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

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: #6c757d;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 輸入區 */
.chat-input {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.chat-input .input-group {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-input input {
    border: 1px solid #dee2e6;
    padding: 12px;
}

.chat-input button {
    padding: 12px 24px;
}

/* 工具調用標記 */
.tool-call-badge {
    display: inline-block;
    padding: 4px 8px;
    background-color: #ffc107;
    color: #000;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-bottom: 8px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .sidebar {
        height: auto;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .message-content {
        max-width: 85%;
    }
}

/* 滾動條樣式 */
.chat-messages::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}
