/* scanner.css - 二维码解析器样式（优化版） */

/* 基础样式重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
  width: 100%;
  min-height: 100vh;
  padding: 30px 20px;
  background: linear-gradient(135deg, #f0f4f8 0%, #dfe8f3 100%);
  color: #2d3748;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  font-size: 28px;
  color: #2c5282;
  margin-bottom: 25px;
  font-weight: 600;
}

h2 {
  font-size: 22px;
  color: #2b6cb0;
  margin: 25px 0 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid #cbd5e0;
  font-weight: 500;
}

h3 {
  font-size: 18px;
  color: #4a5568;
  margin-bottom: 12px;
  font-weight: 500;
}

/* 分区样式 */
.section {
  background: white;
  border-radius: 14px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

/* 输入组样式 */
.input-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #4a5568;
}

input[type="file"] {
  width: 100%;
  padding: 14px;
  border: 2px solid #cbd5e0;
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.3s;
  background: #f7fafc;
}

/* 二维码预览和结果容器 */
.qr-preview-container {
  display: flex;
  gap: 25px;
  margin-top: 20px;
}

.qr-preview {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
  text-align: center;
}

#qr-preview-image {
  max-width: 100%;
  max-height: 250px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 10px;
  box-sizing: border-box;
}

.result-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* 解析结果样式 */
#result-content {
  flex: 1;
  background: #f7fafc;
  border-radius: 10px;
  padding: 15px;
  border: 2px solid #e2e8f0;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-y: auto;
  max-height: 200px;
}

/* 操作按钮 */
.actions {
  display: flex;
  gap: 15px;
  justify-content: flex-start;
  margin-top: 15px;
}

.actions button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  min-width: 120px;
}

#copy-result {
  background: #4299e1;
  color: white;
}

#copy-result:hover {
  background: #3182ce;
}

#open-result {
  background: #38a169;
  color: white;
}

#open-result:hover {
  background: #2f855a;
}

/* 摄像头扫描区域 */
.camera-container {
  margin-top: 20px;
  position: relative;
}

#camera-preview {
  width: 100%;
  max-height: 400px;
  border-radius: 12px;
  border: 2px solid #cbd5e0;
  background: #000;
  display: none; /* 默认隐藏 */
}

.camera-controls {
  display: flex;
  gap: 15px;
  margin-top: 15px;
  flex-wrap: wrap; /* 确保在小屏幕上换行 */
}

#start-camera {
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  background: #4299e1;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  flex: 1;
}

#start-camera:hover {
  background: #3182ce;
}

#capture-scan {
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  background: #38a169;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  flex: 1;
  display: none; /* 默认隐藏 */
}

#capture-scan:hover {
  background: #2f855a;
}

/* 状态消息 */
.status-message {
  margin-top: 15px;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
}

.status-error {
  background-color: #fed7d7;
  color: #e53e3e;
  border: 1px solid #fc8181;
}

.status-success {
  background-color: #c6f6d5;
  color: #38a169;
  border: 1px solid #9ae6b4;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .qr-preview-container {
    flex-direction: column;
    gap: 20px;
  }
  
  .qr-preview {
    max-width: 100%;
  }
  
  body {
    padding: 15px 10px;
  }
  
  .section {
    padding: 15px;
  }
  
  .actions, .camera-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  .actions button, .camera-controls button {
    width: 100%;
  }
  
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  #result-content {
    max-height: 150px;
  }
}

/* 新增关闭摄像头按钮样式 */
#stop-camera {
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  background: #e53e3e;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  flex: 1;
}

#stop-camera:hover {
  background: #c53030;
}

.camera-controls button {
  flex: 1;
  min-width: 120px; /* 确保最小宽度 */
}