/* chat.css (v27 - 修复按钮布局和内容区域重叠问题) */

:root {
    --bg-dark: #020617;
    --bg-medium: #1e293b;
    --bg-light: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent-primary: #4f46e5;
    --accent-secondary: #6366f1;
    --accent-light: #a5b4fc;
    --border-color: #475569;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

.background-glow, #starry-sky {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
}

#header, #footer {
    flex-shrink: 0;
}

#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding-top: 72px; /* Header高度 */
}

#chat-container {
    flex-grow: 1;
    overflow-y: auto;
    /* 关键改动: 初始 padding-bottom 交给JS动态计算 */
}

.container-mx {
    max-width: 48rem; 
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

#header {
    background-color: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(8px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 20;
    border-bottom: 1px solid rgba(45, 55, 72, 0.5);
}

.header-content {
    display: flex;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    height: 2rem;
    width: 2rem;
    margin-right: 0.75rem;
    border-radius: 50%;
}

#welcome-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.5s ease-in-out;
    padding-top: 72px;
}

.gradient-text {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(to right, #a5b4fc, #818cf8, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
}

#chat-container::-webkit-scrollbar { width: 8px; }
#chat-container::-webkit-scrollbar-track { background: transparent; }
#chat-container::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 4px; }

#message-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.message-bubble {
    animation: fadeIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

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

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

.message-content {
    padding: 1rem;
    border-radius: 0.75rem;
    max-width: 100%;
    word-wrap: break-word;
}

.user-message {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

#footer {
    width: 100%;
    padding: 0;
    position: fixed;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    z-index: 10;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    background-color: #1e293b;
    border-radius: 1rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    transition: border-color 0.3s;
    position: relative;
}

.input-wrapper:focus-within {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

#input-top-area {
    display: flex;
    flex-direction: column;
    width: 100%;
}

#chat-input {
    flex: 1;
    background: transparent;
    color: white;
    resize: none;
    padding: 0;
    border: none;
    outline: none;
    font-size: 1rem;
    line-height: 1.5rem;
    min-height: 1.5rem;
    word-wrap: break-word;
}

#chat-input::placeholder {
    color: var(--text-secondary);
}

/* --- 关键改动: 恢复按钮区域的水平布局 --- */
.input-bottom-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 0.5rem;
}

.input-buttons-left {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
/* --- 布局修复结束 --- */


.footer-button {
    padding: 0.5rem;
    border-radius: 9999px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    background: none;
    border: none;
    outline: none;
}

.footer-button:hover:not(.disabled) { background-color: var(--bg-light); }
.footer-button svg { width: 24px; height: 24px; fill: currentColor; color: #a1a1aa; transition: color 0.3s; }
.footer-button:hover:not(.disabled) svg { color: #818cf8; }

.hidden { display: none; }
.disabled { opacity: 0.5; pointer-events: none; cursor: not-allowed; }

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 125%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#search-toggle.active svg, #deep-think-toggle.active svg { color: #FFD700; }

#file-preview-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    color: var(--text-primary);
}

#file-preview-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background-color: var(--bg-dark);
    border-radius: 8px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

#file-preview-container button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
}

#file-preview-container button:hover { color: white; }

.prose { line-height: 1.75; color: var(--text-primary); }
.prose p, .prose ul, .prose ol { margin-top: 1em; margin-bottom: 1em; }
.prose h1, .prose h2, .prose h3 { color: #f1f5f9; font-weight: 700; margin-top: 1.5em; margin-bottom: 0.8em; }
.prose strong { color: #c7d2fe; }
.prose ul > li::marker { color: #818cf8; }
.prose a { color: #a5b4fc; text-decoration: underline; }
.prose pre { background-color: #0f172a; padding: 1em; border-radius: 0.5rem; overflow-x: auto;}
.prose code { color: #f87171; background-color: rgba(0,0,0,0.2); padding: 0.1em 0.3em; border-radius: 0.2em;}
.prose pre code { color: inherit; background-color: transparent; padding: 0;}

.ai-avatar-container {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px; 
}

.ai-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
    box-shadow: 0 0 0 0 rgba(138, 180, 248, 0.7);
}

.breathing-glow {
    animation: breathing-glow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes breathing-glow {
    0%, 100% { box-shadow: 0 0 10px 4px rgba(138, 180, 248, 0.8), 0 0 20px 8px rgba(138, 180, 248, 0.6); }
    50% { box-shadow: 0 0 0 0 rgba(138, 180, 248, 0.7); }
}

.cta-button.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    background-image: linear-gradient(100deg, #3a7bff 0%, #8ab4f8 50%, #74f9ff 100%);
    background-size: 200% 200%;
    transition: transform 0.2s ease, box-shadow 0.3s ease, background-position 0.5s ease;
    border: none;
}

.cta-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 180, 248, 0.3);
    background-position: 100% 50%;
}

#send-icon, #stop-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    color: white;
}

/* --- 新增：AI回复下方的操作按钮样式 --- */
.ai-message-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-left: 50px; /* 与AI头像+间距的宽度对齐 */
}

.action-icon-button {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.action-icon-button:hover {
    background-color: var(--bg-light);
}

.action-icon-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    color: var(--text-secondary);
}
