/* 布局样式 */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f8f9fa;
  color: #212529;
  overflow: hidden;
}

.container {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

.input-panel {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}

.ggb-panel {
  padding: 10px;
  position: relative;
  width: 620px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}

/* 标题样式 */
.ggb-title {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 24px;
  font-weight: 500;
  flex-shrink: 0;
}

/* GeoGebra画板 */
#ggb-element {
  border: 1px solid #ddd;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  min-height: 300px;
}

/* 命令输入区域 */
#ggb-commands {
  width: 100%;
  min-height: 300px;
  font-family: monospace;
  font-size: 14px;
  border: 1px solid #ced4da;
  border-radius: 8px;
  padding: 12px;
  box-sizing: border-box;
  resize: vertical;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
}

#execute-btn {
  margin-top: 10px;
  padding: 10px 16px;
  font-size: 16px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-weight: 500;
}

#execute-btn:hover {
  background-color: #218838;
}

/* 聊天区域 */
.chat-container {
  flex: 1;
  border: 1px solid #ced4da;
  overflow-y: auto;
  padding: 15px;
  margin-bottom: 15px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
  display: flex;
  flex-direction: column;
}

.message {
  margin-bottom: 15px;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 90%;
  position: relative;
  animation: fadeIn 0.2s ease-in;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

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

.user-message {
  background-color: #007bff;
  color: white;
  text-align: left;
  margin-left: auto;
  margin-right: 0;
  border-bottom-right-radius: 4px;
  padding:0.4rem 0.4rem 0.4rem 0.6rem
}

.user-message p{
  margin:0;
  padding: 0;
}

.ai-message {
  background-color: #f1f3f4;
  color: #202124;
  text-align: left;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.ai-thinking {
  color: #6c757d;
  font-style: italic;
  background-color: #f8f9fa;
  border: 1px dashed #dee2e6;
}

/* 用户输入区域 */
.user-input-container {
  display: flex;
  flex-direction: column;
}

.input-wrapper {
  display: flex;
  gap: 10px;
}

#user-input {
  flex: 1;
  padding: 12px 15px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  border: 1px solid #ced4da;
  border-radius: 8px;
  box-sizing: border-box;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  resize: vertical;
  min-height: 80px;
  overflow-y: auto;
}

.input-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 5px 0;
}

.send-btn {
  background-color: #007bff; /* 浅蓝色 */
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.send-btn:hover {
  background-color: #0069d9; /* 深蓝色 */
}

.send-btn::before {
  content: "🠝";
  font-size: 18px;
  line-height: 1;
}

.image-attachment-btn {
  background-color: transparent;
  border: none;
  color: #007bff; /* 浅蓝色 */
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-attachment-btn:hover {
  color: #0069d9; /* 深蓝色 */
}

.image-attachment-btn::before {
  content: "◪";
  width: 36px;
  height: 30px;
  font-size: 40px;
}

.close-preview-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #fff;
  border: 1px solid #ddd;
  font-size: 18px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.close-preview-btn:hover {
  background-color: #f8f9fa;
  color: #000;
}

.image-preview-wrapper {
  text-align: right;
  display: none;
}

.image-preview-wrapper.active {
  display: block;
}

.image-preview-container {
  margin-bottom: 10px;
  position: relative;
  display: inline-block;
}

#image-preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.chat-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 代码块样式 */
pre {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  font-family: 'Courier New', Courier, monospace;
  white-space: pre-wrap;
  overflow-x: auto;
}

pre code {
  background-color: transparent;
  padding: 0;
  font-size: 13px;
}

/* GeoGebra代码块样式 */
.ggb-code-block {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  font-family: 'Courier New', Courier, monospace;
  white-space: pre-wrap;
  position: relative;
  overflow-x: auto;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  min-height: 60px;
  font-size: 14px;
  color: #212529;
  line-height: 1.5;
}

.ggb-code-block:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.ggb-code-block code {
  background-color: transparent;
  padding: 0;
  font-size: 13px;
}

/* GeoGebra执行按钮容器 */
.ggb-execute-container {
  margin: 10px 0;
  text-align: left;
}

/* GeoGebra执行按钮样式 */
.ggb-execute-btn {
  display: inline-flex;
  align-items: center;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-right: 10px;
}

.ggb-execute-btn:hover {
  background-color: #218838;
  transform: translateY(-1px);
}

.ggb-execute-btn:active {
  transform: translateY(0);
}

/* GeoGebra执行按钮图标 */
.ggb-execute-icon {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid white;
  margin-right: 8px;
}

/* 行内代码样式 */
code {
  background-color: #f1f3f4;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
}

/* 设置面板样式 */
.button-group {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  margin-top: auto;
  align-self: flex-start;
  flex-shrink: 0;
}

.settings-btn {
  padding: 8px 12px;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: background-color 0.2s;
}

.settings-btn:hover {
  background-color: #5a6268;
}

.guide-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: background-color 0.2s;
}

.guide-link:hover {
  background-color: #0069d9;
}

.settings-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 800px;
  background-color: #fff;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  border-top: 1px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  border-radius: 8px 8px 0 0;
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.settings-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.close-settings-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.close-settings-btn:hover {
  background-color: #f1f3f4;
}

.model-selection {
  margin-bottom: 20px;
}

.model-selection label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.model-select,
.api-key-input,
.azure-endpoint-input,
.azure-model-input,
.qwen-endpoint-input,
.qwen-model-input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 15px;
  box-sizing: border-box;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.model-select:focus,
.api-key-input:focus,
.azure-endpoint-input:focus,
.azure-model-input:focus,
.qwen-endpoint-input:focus,
.qwen-model-input:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

#system-prompt {
  width: 100%;
  min-height: 200px;
  max-height: 300px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  margin-bottom: 15px;
  box-sizing: border-box;
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 12px;
  resize: vertical;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#system-prompt:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.save-settings-btn {
  width: 100%;
  padding: 12px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.save-settings-btn:hover {
  background-color: #218838;
}

.guide-link {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  font-size: 14px;
  transition: color 0.2s;
}