/**
 * WebChat 应用样式 - 现代时尚版
 */

/* 全局样式 */
:root {
  --primary-color: #FF9B11;
  --primary-light: #FFA726;
  --primary-dark: #F57C00;
  --secondary-color: #4cc9f0;
  --accent-color: #FF9B11;
  --text-color: #2F3542;
  --text-light: #747D8C;
  --bg-color: #FFF9E6;
  --bg-light: rgba(255, 254, 254, 0.7);
  --bg-dark: rgba(255, 249, 230, 0.5);
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --danger-color: #f44336;
  --border-radius: 12px;
  --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s ease;
}

html, body {
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #FFF9E6, #FFFEFE);
  color: var(--text-color);
  line-height: 1.6;
  transition: var(--transition);
  min-height: 100vh;
}

/* 基础重置 */
* {
  margin: 0;
  /* padding: 0; */
  box-sizing: border-box;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.3);
}

/* 文字选择 */
::selection {
  background: var(--accent-color);
  color: white;
}

/* 通用工具类 */
.text-primary {
  color: var(--primary-color) !important;
}

.text-accent {
  color: var(--accent-color) !important;
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

.bg-accent {
  background-color: var(--accent-color) !important;
}

/* 阴影工具类 */
.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
  box-shadow: var(--shadow-md) !important;
}

/* 圆角工具类 */
.rounded-sm {
  border-radius: var(--radius-sm) !important;
}

.rounded-md {
  border-radius: var(--radius-md) !important;
}

.rounded-lg {
  border-radius: var(--radius-lg) !important;
}

/* 过渡效果 */
.transition {
  transition: all 0.3s ease !important;
}

/* 图标间距 */
.icon-text {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* 响应式容器 */
.container-fluid {
  height: 100vh;
  width: 100vw;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

/* 加载动画 */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pulse {
  animation: pulse 2s infinite;
}

/* 导航栏 */
.navbar {
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);

}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
}

.navbar-brand img {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: var(--transition);
}

.navbar-brand:hover img {
  transform: scale(1.1);
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  transition: var(--transition);
}

.navbar-dark .navbar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* 按钮样式 */
.btn {
  border-radius: 8px;
  font-weight: 500;
  padding: 8px 20px;
  transition: var(--transition);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn:active,
.btn:focus {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  outline: none !important;
}

/* 覆盖 Bootstrap 的默认样式 */
.btn-outline-primary,
.btn-outline-primary:hover,
.btn-outline-primary:active,
.btn-outline-primary:focus {
  color: var(--accent-color) !important;
  border-color: var(--accent-color) !important;
  background-color: transparent !important;
}

.btn-outline-primary:hover {
  background-color: var(--accent-color) !important;
  color: white !important;
}

.btn-outline-primary:active,
.btn-outline-primary:focus {
  background-color: var(--accent-color) !important;
  color: white !important;
  box-shadow: none !important;
}

.btn-outline-secondary,
.btn-outline-secondary:hover,
.btn-outline-secondary:active,
.btn-outline-secondary:focus {
  color: var(--text-light) !important;
  border-color: var(--text-light) !important;
  background-color: transparent !important;
}

.btn-outline-secondary:hover {
  background-color: var(--text-light) !important;
  color: white !important;
}

.btn-outline-secondary:active,
.btn-outline-secondary:focus {
  background-color: var(--text-light) !important;
  color: white !important;
  box-shadow: none !important;
}

/* 聊天容器 */
#chat-container {
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  display: flex;
  overflow-x: hidden;
}

/* 侧边栏 */
.sidebar {
  width: 280px;
  height: 100vh;
  /*background-color: var(--bg-light);*/
  
  padding: 1.5rem;
  border-right: 1px solid rgba(0, 0, 0, 0.03);
  overflow-y: auto;
  box-shadow: inset -5px 0 15px -5px rgba(0, 0, 0, 0.03);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.sidebar.hidden {
  margin-left: -280px;
}

.conversations-list {
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding-right: 5px;
}

.conversation-item {
  border-radius: 8px;
  margin-bottom: 8px;
  transition: var(--transition);
  border: none;
  padding: 12px 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.conversation-item:first-child {
  border-radius: 12px;
}

.conversation-item:last-child {
  border-radius: 12px;
  margin-bottom: 0;
}

.conversation-item:hover {
  background-color: var(--bg-dark);
  transform: translateX(3px);
}

.conversation-item.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  box-shadow: 0 4px 12px rgba(255, 155, 17, 0.3);
}

.conversation-item.active small {
  color: rgba(255, 255, 255, 0.9);
}

/* 聊天主区域 */
.chat-main {
  
  overflow: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  
}

.chat-main.expanded {
  margin-left: 0;
}


.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: linear-gradient(135deg, #FFEFA8,#FFFEFC);
  position: relative;
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
}

.messages-list::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 236, 163, 0.3), rgba(255, 194, 97, 0.3));
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
}

.messages-list::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.3;
  pointer-events: none;
}

/* 确保消息内容在背景图案之上 */
.message {
  position: relative;
  z-index: 2;
  margin-bottom: 20px;
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

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

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

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

.message-content {
  max-width: 85%;
  padding: 16px 20px;
  border-radius: 18px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  line-height: 1.6;
  font-size: 15px;
}

.user-message .message-content {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #2c3e50;
  border-bottom-right-radius: 5px;
}

.assistant-message .message-content {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #2c3e50;
  border-bottom-left-radius: 5px;
}

.message-text {
  word-wrap: break-word;
  /*white-space: pre-wrap;*/
}

.message-text p {
  margin-bottom: 1em;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text ul, .message-text ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.message-text li {
  margin: 0.5em 0;
}

.message-text blockquote {
  border-left: 4px solid #e0e0e0;
  margin: 1em 0;
  padding: 0.5em 1em;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}

.message-text table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.message-text th, .message-text td {
  border: 1px solid #e0e0e0;
  padding: 8px 12px;
  text-align: left;
}

.message-text th {
  background: rgba(0, 0, 0, 0.03);
}

.message-time {
  font-size: 0.75rem;
  color: #888;
  margin-top: 8px;
  text-align: right;
  opacity: 0.8;
}

/* 代码块样式 */
pre {
  background-color: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  line-height: 1.5;
}

code {
  font-family: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
}

.assistant-message pre {
  background: linear-gradient(to right, #1e1e1e, #2d2d2d);
}

.assistant-message code {
  background-color: rgba(30, 30, 30, 0.8);
  color: #d4d4d4;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
}

.user-message code {
  background-color: rgba(0, 0, 0, 0.15);
  color: #e0e0e0;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
}

/* 代码高亮 */
pre .keyword { color: #569cd6; }
pre .string { color: #ce9178; }
pre .comment { color: #6a9955; }
pre .function { color: #dcdcaa; }
pre .number { color: #b5cea8; }
pre .operator { color: #d4d4d4; }
pre .class { color: #4ec9b0; }
pre .variable { color: #9cdcfe; }

/* 打字指示器 */
.typing-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  margin: 0 2px;
  background-color: var(--primary-light);
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .sidebar {
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.1);
  }
  
  #chat-container {
    height: auto;
  }
  
  .chat-main {
    height: calc(100vh - 200px);
    border-radius: var(--border-radius);
  }
  
  .message-content {
    max-width: 85%;
  }
}

/* 表单样式 */
.form-control {
  border-radius: 8px;
  /*border: 1px solid rgba(255, 255, 255, 0.3);*/
  padding: 10px 15px;
  transition: var(--transition);
  background: linear-gradient(135deg, #FFFEFA, #FFEFA7);
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  color: var(--text-color);
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(255, 155, 17, 0.1);
  background: linear-gradient(135deg, #FFFEFA, #FFEFA7);
  outline: none;
}

.form-control::placeholder {
  color: rgba(47, 53, 66, 0.6);
}

textarea.form-control {
  resize: none;
  line-height: 1.5;
}

/* 错误消息 */
.alert {
  margin-bottom: 15px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border: none;
}

.alert-danger {
  background-color: rgba(244, 67, 54, 0.1);
  color: var(--danger-color);
}

/* 登录/注册容器 */
#login-container {
  min-height: calc(100vh - 150px);
}

.jumbotron {
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.05), rgba(76, 201, 240, 0.05));
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 3rem 2rem;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

/* 模态框样式 */
.modal-content {
  border-radius: var(--border-radius);
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background-color: var(--bg-light);
  padding: 20px;
}

.modal-body {
  padding: 25px;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background-color: var(--bg-light);
  padding: 15px 20px;
}

.close {
  opacity: 0.5;
  transition: var(--transition);
}

.close:hover {
  opacity: 1;
}

/* 卡片样式 */
.card {
  border-radius: var(--border-radius);
  border: none;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* 预设对话框样式 */
.preset-dialog {
  position: absolute;
  background: var(--bg-light);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  width: 280px;
  z-index: 1000;
  bottom: 100%;
  margin-bottom: 8px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  left: 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.preset-items {
  padding: 8px 0;
}

.preset-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-color);
}

.preset-item:hover {
  background-color: rgba(255, 249, 230, 0.3);
  color: var(--accent-color);
}

/* 图标旋转动画 */
.toggle-icon.rotated {
  transform: rotate(180deg);
}

/* 确保弹出框容器是相对定位 */
.chat-footer .d-flex {
  position: relative;
}

/* 确保空状态内容在背景之上 */
.messages-list .text-center {
  position: relative;
  z-index: 2;
}

