/*
  问·古今页面专属样式 (making.css) - 红色文化主题版
*/

/* --- 主布局 --- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .main-grid {
    grid-template-columns: 2fr 1fr;
  }
}
.chat-panel-wrapper, .history-panel-wrapper {
  display: flex; flex-direction: column;
  height: 600px;
  padding: 0; /* 内部重新布局，清除 card 的默认 padding */
  overflow: hidden; /* 防止圆角溢出 */
}


/* 聊天布局 */
.chat-layout {
    flex-grow: 1; display: flex; flex-direction: column; overflow: hidden;
    background-color: #fff;
}
/* 左侧聊天面板 */
.chat-panel {
  background-color: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 0; /* 内边距由子元素控制 */
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-height: 800px;
}


/* 聊天消息容器 */
.chat-messages-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: #fff;
}

/* 聊天气泡 */
.chat-bubble {
  display: flex;
  max-width: 85%;
}
.chat-bubble-content {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  line-height: 1.6;
}
/* AI 气泡 - 红色主题 */
.chat-bubble.ai { align-self: flex-start; }
.chat-bubble.ai .chat-bubble-content {
    background-color: var(--theme-red);
    color: white;
    border-radius: 0.5rem 0.5rem 0.5rem 0;
}
/* 用户气泡 */
.chat-bubble.user { align-self: flex-end; }
.chat-bubble.user .chat-bubble-content {
    background-color: #f3f4f6;
    color: #1f2937;
    border-radius: 0.5rem 0.5rem 0 0.5rem;
}

.thinking-animation {
    opacity: 0.7;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* 快捷提示 */
.quick-prompts-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--theme-border);
    background-color: #FAFAFA;
}
.quick-prompts-title {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}
.quick-prompts-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.prompt-button {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fce8e8;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}
.prompt-button:hover {
    background-color: #fee2e2;
    border-color: #fecaca;
}

/* 输入区域 */
.chat-input-area {
    display: flex;
    padding: 1.5rem;
    border-top: 1px solid var(--theme-border);
    gap: 0.75rem;
    background-color: #fff;
    border-radius: 0 0 0.5rem 0.5rem;
}
.chat-input {
    flex-grow: 1;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}
.chat-input:focus {
    outline: none;
    border-color: var(--theme-red);
    box-shadow: 0 0 0 3px rgba(193, 44, 31, 0.2);
}
.send-button {
    flex-shrink: 0;
    width: 3rem; height: 3rem;
    border-radius: 0.375rem;
    background-color: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}
.send-button:disabled { opacity: 0.6; cursor: not-allowed; }
.send-button.is-active {
    background-color: var(--theme-red);
    color: white;
}
.send-icon { width: 1.25rem; height: 1.25rem; }

/* 右侧历史记录面板 */
.history-panel {
    background-color: var(--theme-card-bg);
    border: 1px solid var(--theme-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    height: calc(100vh - 120px);
    max-height: 800px;
    display: flex;
    flex-direction: column;
}
.history-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background-color: var(--theme-red);
    border-radius: 0.5rem 0.5rem 0 0;
    border-bottom: 3px solid var(--theme-gold);
}
.history-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin: 0; padding: 0; border: none;
}
.clear-history-button {
    background: none; border: none;
    color: #fee2e2; font-size: 0.875rem; cursor: pointer;
}
.clear-history-button:hover { color: white; text-decoration: underline; }

.history-list-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}
.history-item { padding: 1rem; border-bottom: 1px solid #f0f0f0; }
.history-item-question { font-weight: 600; color: #333; }
.history-item-answer { color: #555; margin-top: 0.5rem; word-break: break-word; }
.history-item-timestamp { font-size: 0.75rem; color: #aaa; margin-top: 0.5rem; text-align: right; }
.history-empty-placeholder { text-align: center; color: #9ca3af; padding: 2rem; }

/* 确认删除弹窗 */
.modal-overlay {
    position: fixed; inset: 0; background-color: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-content {
    background: white; border-radius: 0.5rem; padding: 2rem;
    max-width: 400px; width: 90%;
}
.modal-title { font-size: 1.25rem; font-weight: 600; color: #333; margin-bottom: 0.5rem; }
.modal-text { color: #555; margin-bottom: 1.5rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }
.modal-button-cancel {
    padding: 0.5rem 1rem; border: 1px solid #d1d5db; border-radius: 0.375rem; background: white; cursor: pointer;
}
.modal-button-confirm {
    padding: 0.5rem 1rem; border: none; border-radius: 0.375rem; background-color: #dc2626; color: white; cursor: pointer;
}