:root {
  --primary-bg: #FFFFFF;
  --secondary-bg: #F8F8F8;
  --border-color: #E5E5E5;
  --text-primary: #1A1A1A;
  --text-secondary: #888888;
  --text-muted: #B2B2B2;
  --accent-color: #07C160;
  --user-bubble: #95EC69;
  --staff-bubble: #212529;
  --system-bubble: #F8F8F8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --sum-color: #FA5151;
  --link-color: #576B95;
  --link-hover: #07C160;
  --link-active: #06AD56;
  --link-visited: #7D7D7D;
  --link-focus-ring: rgba(7, 193, 96, 0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 全局样式 - 修复底部固定 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;  /* 添加这行 - 确保html和body有完整高度 */
  overflow: hidden;  /* 隐藏body滚动条 */
}

body {
  background: var(--secondary-bg);
  display: flex;  /* 添加flex布局 */
  align-items: center;  /* 垂直居中 */
  justify-content: center;  /* 水平居中 */
  min-height: 100vh;
}
/* 链接样式 */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  font-weight: 500;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:focus {
  outline: 2px solid var(--link-focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

a:active {
  color: var(--link-active);
  transform: translateY(1px);
}

a:visited {
  color: var(--link-visited);
}

/* 聊天容器 */
.chat-container {
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  border-radius: 0;  /* 去掉圆角，完全填满 */
}

/* 普通表单样式 */
.chat-form {
  margin: 0;
  background: var(--primary-bg);
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  box-shadow: none;
  flex-shrink: 0;
}

/* 固定底部表单 - 使用 fixed 定位 */
.chat-form.fixedBottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 12px 20px;
  background: var(--primary-bg);
  border-top: 1px solid var(--border-color);
  border-radius: 0;
  border-left: none;
  border-right: none;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.chat-container:hover {
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.chat-header {
  padding: 2px 4px;
  background: var(--primary-bg);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  position: relative;
  flex-shrink: 0;
}

.chat-title {
  color: #be002f;
  text-align: center;
  margin: 0;
  padding: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-bottom: none;
  display: inline-block;
}

.chat-status {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* iframe 样式 - 填充剩余空间 */
.fullscreen-iframe {
    width: 100%;
    flex: 1;
    min-height: 0;
    border: none;
    height: 100%;
    display: block;
    overflow: auto !important;  /* iframe内部保留滚动条，外部不显示 */
}

iframe {
    overflow: auto !important;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}


.chat-group input,
.chat-group textarea {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 1rem; 
  border: 1px solid var(--border-color); 
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  background: var(--secondary-bg);
  box-sizing: border-box; 
  transition: var(--transition);
  line-height: 1.5;
    margin-bottom: 0.3rem;
}

.chat-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.chat-group input:focus,
.chat-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.chat-submit {
  background: var(--sum-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.chat-submit:hover {
  background: #9A1F1C;
  transform: translateY(-1px);
}
/* DeepSeek 风格输入区域 */
.chat-input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 8px 12px;
  transition: var(--transition);
}

.chat-input-container:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--link-focus-ring);
}

.chat-input-container textarea {
  flex: 1;
  min-height: 40px;
  max-height: 150px;
  resize: none;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  transition: var(--transition);
  outline: none;
}

.chat-input-container textarea:focus {
  outline: none;
  box-shadow: none;
}

/* 上传按钮组 */
.chat-upload-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 上传按钮样式 */
.chat-upload-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
}

.chat-upload-btn:hover {
  background: var(--secondary-bg);
  color: var(--accent-color);
}

.chat-upload-btn svg {
  width: 20px;
  height: 20px;
}

/* 隐藏原生文件输入 */
.chat-file-input {
  display: none;
}

/* DeepSeek 风格提交按钮 */

.chat-submit {
  background: var(--sum-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.chat-submit.with-text {
  width: auto;
  min-width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--accent-color);
  color: white;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
  padding: 0 12px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-submit.with-text:has(span:not(:empty)) {
  padding: 0 16px;
  gap: 6px;
}

.chat-submit.with-text::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M22 2L11 13' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M22 2L15 22L11 13L2 9L22 2Z' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  position: static;
  transform: none;
  flex-shrink: 0;
}

.chat-submit.with-text span {
  display: inline-block;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-submit.with-text:not(:has(span:not(:empty))) {
  padding: 0;
  border-radius: 50%;
}

.chat-submit.with-text:hover {
  background: #06AD56;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.chat-submit.with-text:active {
  transform: translateY(0);
  transition: transform 0.1s;
}

.chat-submit.with-text:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chat-submit.with-text svg {
  display: none;
}

/* 文件预览区域 */
.chat-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  background: var(--secondary-bg);
  border-radius: var(--radius-sm);
}

.chat-file-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 12px;
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text-primary);
}

.chat-file-item .file-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-file-item .file-remove {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.chat-file-item .file-remove:hover {
  background: var(--secondary-bg);
  color: var(--sum-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
  body {
    padding-bottom: 85px;
  }
  
  .chat-container {
    width: 100%;
    height: calc(100vh - 10px);
    margin: 5px 0;
    border-radius: 0;
  }
  
  .fullscreen-iframe {
    min-height: 0;
  }
  
  .chat-form.fixedBottom {
    padding: 10px 12px;
  }
  
  .chat-header {
    padding: 0.1rem 0.1rem;
  }
  
  .chat-title {
    font-size: 1.1rem;
  }
  
  .chat-input-container {
    gap: 8px;
    padding: 6px 10px;
  }
  
  .chat-submit.with-text {
    min-width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .chat-submit.with-text::before {
    width: 14px;
    height: 14px;
  }
  
  .chat-upload-btn {
    width: 28px;
    height: 28px;
  }
  
  .chat-upload-btn svg {
    width: 16px;
    height: 16px;
  }
  
  .chat-group input,
  .chat-group textarea {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
  }
  
  .chat-submit {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  body {
    padding-bottom: 75px;
  }
  
  .chat-form.fixedBottom {
    padding: 8px 10px;
  }
  
  .chat-container {
    height: calc(100vh - 5px);
  }
  
  .chat-header {
    padding: 0.1rem 0.1rem;
  }
  
  .chat-title {
    font-size: 1rem;
  }
  
  .chat-status {
    position: static;
    transform: none;
    justify-content: center;
    margin-top: 0.3rem;
    font-size: 0.65rem;
  }
  
  .chat-input-container {
    gap: 6px;
    padding: 4px 8px;
  }
  
  .chat-submit.with-text {
    min-width: 26px;
    height: 26px;
  }
  
  .chat-submit.with-text::before {
    width: 12px;
    height: 12px;
  }
  
  .chat-submit.with-text span {
    max-width: 60px;
    font-size: 11px;
  }
  
  .chat-upload-btn {
    width: 26px;
    height: 26px;
  }
  
  .chat-upload-btn svg {
    width: 14px;
    height: 14px;
  }
  .chat-form {
    position: sticky;
    bottom: 0;
    background: var(--primary-bg);
    z-index: 10;
  }
  
  .chat-header {
    padding: 0.1rem 0.1rem;
  }
  
  .chat-title {
    font-size: 1.3rem;
    padding:0 0;
    color: #FFF;
  }
  
  .chat-status {
    right: 1rem;
    font-size: 0.7rem;
  }
  
  .chat-group input,
  .chat-group textarea {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
  }
  
  .chat-submit {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-bg: #1A1A1A;
    --secondary-bg: #121212;
    --border-color: #2D2D2D;
    --text-primary: #E0E0E0;
    --text-secondary: #B0B0B0;
    --text-muted: #888888;
    --accent-color: #07C160;
    --user-bubble: #2A6E3F;
    --staff-bubble: #2D2D2D;
    --system-bubble: #333333;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.5);
    --sum-color: #FF6B6B;
    --link-color: #7D9DCC;
    --link-hover: #5CD189;
    --link-active: #07C160;
    --link-visited: #A0A0A0;
    --link-focus-ring: rgba(92, 209, 137, 0.4);
  }
  
  .chat-title {
    color: #FFF;
  }
  
  .chat-form.fixedBottom {
    background: #1a1a1a;
    border-top-color: #2d2d2d;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  }
}

/* 简单文本链接版本 */
.home-link {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--link-color);
  text-decoration: none;
  transition: var(--transition);
  z-index: 10;
}

.home-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}
