/* css/ai_chat.css */

/* AI Chat Page */
.ai-chat-container {
    max-width: 800px; /* 稍微窄一点的聊天容器 */
    margin: 0 auto;
    padding: 2rem; /* 更多内边距 */
}
.chat-header {
    text-align: center;
    margin-bottom: 2rem;
}
.chat-header h3 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.chat-header-illustration {
    max-width: 150px; /* 稍微小一点的插图 */
    margin: 0 auto 1rem auto;
    border-radius: var(--border-radius);
    box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,0.1);
}
.chat-window {
    height: 600px; /* 增加聊天窗口高度 */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.2rem; /* 更多内边距 */
    overflow-y: auto;
    margin-bottom: 1.2rem;
    background-color: var(--light-bg);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.chat-message {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
}
.chat-message p {
    padding: 0.75rem 1.1rem;
    border-radius: 1.2rem;
    max-width: 80%; /* 稍微窄一点 */
    line-height: 1.6;
    overflow-wrap: break-word;
}
.ai-message {
    justify-content: flex-start;
}
.ai-message p {
    background-color: #e9f5ff; /* 更浅的蓝色 */
    color: var(--dark-text);
    border-bottom-left-radius: 0.3rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.user-message {
    justify-content: flex-end;
}
.user-message p {
    background-color: var(--primary-color);
    color: var(--light-text);
    border-bottom-right-radius: 0.3rem;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}
/* Play button for messages */
.play-message-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 1rem;
    margin-left: 0.5rem;
    padding: 0.2rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent shrinking */
}

.play-message-btn:hover {
    color: var(--primary-color);
}

.play-message-btn i {
    font-size: 1.1em;
}

.chat-input-area {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 1rem;
    margin-bottom: 1.2rem;
    align-items: center; /* Align items vertically in the center */
}
#chat-input {
    flex-grow: 1;
    padding: 0.8rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 1rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    min-width: 200px; /* Ensure input field has a minimum width */
    white-space: nowrap; /* Prevent text from wrapping */
    overflow-x: auto; /* Allow horizontal scrolling if content overflows */
}
#chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.chat-buttons {
    display: flex;
    gap: 0.8rem; /* Slightly less gap between buttons */
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Adjust button sizes for better fit in chat input area */
.chat-input-area .btn {
    padding: 0.8rem 1.5rem; /* Smaller padding for chat buttons */
    min-width: auto; /* Allow buttons to size based on content */
    font-size: 0.9rem; /* Smaller font size for chat buttons */
}

.chat-input-area .btn i {
    margin-right: 0.3rem; /* Smaller margin for icons in chat buttons */
    font-size: 0.9em;
}

/* Specific styling for the Finish button if needed */
#finish-chat-btn {
    /* You can add specific styles here if you want it to stand out differently */
    /* For example, a different color or a smaller size */
    /* background: var(--danger-color); */
}

/* Responsive adjustments for chat input area */
@media (max-width: 768px) {
    .chat-input-area {
        flex-direction: column; /* Stack input and buttons vertically */
        align-items: stretch; /* Stretch items to full width */
    }
    #chat-input {
        width: 100%;
        margin-bottom: 0.8rem; /* Add some space below input when stacked */
    }
    .chat-buttons {
        width: 100%;
        justify-content: space-between; /* Distribute buttons evenly */
    }
    .chat-input-area .btn {
        flex-grow: 1; /* Allow buttons to grow and fill space */
        padding: 0.9rem 1.5rem; /* Slightly larger padding for better touch targets */
        font-size: 1rem; /* Restore font size for better readability */
    }
}

@media (max-width: 480px) {
    .chat-buttons {
        flex-direction: column; /* Stack buttons vertically on very small screens */
    }
    .chat-input-area .btn {
        width: 100%; /* Full width buttons when stacked */
    }
}

/* Voice Input Button Recording State */
.btn.recording {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
