/* THIAide Page Chat - Static Embedded Chat */
.thiaide-page-chat-wrapper {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.thiaide-page-chat-container {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    height: 500px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Header */
.thiaide-page-chat-header {
    background: linear-gradient(135deg, #007cba, #005a87);
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.thiaide-page-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thiaide-page-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thiaide-page-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thiaide-page-chat-info {
    display: flex;
    flex-direction: column;
}

.thiaide-page-chat-title {
    font-weight: 600;
    color: white;
    font-size: 16px;
    line-height: 1.2;
}

.thiaide-page-chat-status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

/* Messages Area */
.thiaide-page-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    min-height: 0;
}

.thiaide-page-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.thiaide-page-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.thiaide-page-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.thiaide-page-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Welcome Message */
.thiaide-page-welcome-message {
    text-align: center;
    padding: 30px 20px;
    color: #555;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.thiaide-page-welcome-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    border: 3px solid #e0e0e0;
}

.thiaide-page-welcome-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thiaide-page-welcome-message h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.thiaide-page-welcome-message p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    max-width: 500px;
    color: #666;
}

/* Chat Messages */
.thiaide-page-chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: thiaideMessageAppear 0.3s ease;
}

@keyframes thiaideMessageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.thiaide-page-chat-message-user {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 6px;
    align-self: flex-end;
}

.thiaide-page-chat-message-ai {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    margin-right: auto;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.thiaide-page-chat-message-error {
    background: #ffeaea;
    color: #d63638;
    margin: 10px auto;
    text-align: center;
    font-size: 14px;
    border-radius: 10px;
    padding: 12px 16px;
    max-width: 90%;
    border: 1px solid #ffcccc;
}

.thiaide-page-chat-message-content {
    font-size: 18px;
    line-height: 1.5;
}

.thiaide-page-chat-message-content p {
    margin: 0 0 8px 0;
}

.thiaide-page-chat-message-content p:last-child {
    margin-bottom: 0;
}

.thiaide-page-chat-message-content strong {
    font-weight: 600;
}

.thiaide-page-chat-message-content em {
    font-style: italic;
}

.thiaide-page-chat-message-content a {
    color: #007cba;
    text-decoration: none;
}

.thiaide-page-chat-message-content a:hover {
    text-decoration: underline;
}

.thiaide-page-chat-message-content ul,
.thiaide-page-chat-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.thiaide-page-chat-message-content li {
    margin: 4px 0;
}

.thiaide-page-chat-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 6px;
    text-align: right;
}

.thiaide-page-chat-message-ai .thiaide-page-chat-message-time {
    text-align: left;
    color: #888;
}

.thiaide-page-chat-message-user .thiaide-page-chat-message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Typing Indicator */
.thiaide-page-chat-typing {
    background: white;
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 13px;
    font-style: italic;
    flex-shrink: 0;
}

.thiaide-page-chat-typing-dots {
    display: flex;
    gap: 4px;
}

.thiaide-page-chat-typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: thiaideTypingBounce 1.4s infinite ease-in-out;
}

.thiaide-page-chat-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.thiaide-page-chat-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.thiaide-page-chat-typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes thiaideTypingBounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.thiaide-page-chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.thiaide-page-chat-input-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.thiaide-page-chat-input-wrapper {
    flex: 1;
    border: 1px solid #d0d0d0;
    border-radius: 24px;
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 0 16px;
    transition: border-color 0.2s;
}

.thiaide-page-chat-input-wrapper:focus-within {
    border-color: #007cba;
    background: white;
}

.thiaide-page-chat-message-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 15px;
    padding: 14px 0;
    font-family: inherit;
    line-height: 1.4;
    width: 100%;
    min-width: 0;
}

.thiaide-page-chat-message-input::placeholder {
    color: #999;
}

.thiaide-page-chat-send-button {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: transform 0.2s, opacity 0.2s;
}

.thiaide-page-chat-send-button:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.thiaide-page-chat-send-button:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
    .thiaide-page-chat-container {
        height: 450px;
        border-radius: 10px;
    }
    
    .thiaide-page-chat-header {
        padding: 14px 16px;
    }
    
    .thiaide-page-chat-messages {
        padding: 16px;
    }
    
    .thiaide-page-welcome-message {
        padding: 20px 16px;
    }
    
    .thiaide-page-welcome-icon {
        width: 70px;
        height: 70px;
    }
    
    .thiaide-page-welcome-message h3 {
        font-size: 18px;
    }
    
    .thiaide-page-welcome-message p {
        font-size: 14px;
    }
    
    .thiaide-page-chat-input-area {
        padding: 14px 16px;
    }
    
    .thiaide-page-chat-message {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .thiaide-page-chat-container {
        height: 400px;
    }
    
    .thiaide-page-chat-header {
        padding: 12px 14px;
    }
    
    .thiaide-page-chat-avatar {
        width: 36px;
        height: 36px;
    }
    
    .thiaide-page-chat-title {
        font-size: 15px;
    }
    
    .thiaide-page-chat-status {
        font-size: 12px;
    }
    
    .thiaide-page-chat-messages {
        padding: 14px;
    }
    
    .thiaide-page-chat-input-area {
        padding: 12px 14px;
    }
    
    .thiaide-page-chat-send-button {
        width: 44px;
        height: 44px;
    }
}