/* ====== 二维码工具 - 专属样式 ====== */

/* ----- 模式 Tab 切换（复用 hash-tabs） ----- */
.hash-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--space-5);
}

.hash-tab {
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color var(--duration-normal) var(--ease-default), border-color var(--duration-normal) var(--ease-default);
  outline: none;
}

.hash-tab:hover { color: var(--color-text); }
.hash-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ----- 生成模式 ----- */
.qr-input-group textarea {
  width: 100%;
  min-height: 72px;
  box-sizing: border-box;
  font-size: var(--text-base);
}

.qr-input-group textarea::placeholder {
  font-size: var(--text-sm);
}

.qr-input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.qr-templates {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.qr-template-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-right: var(--space-1);
}

.tpl-icon {
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ----- 选项区（Grid 布局 + 可折叠） ----- */
.qr-options-wrapper {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.qr-options-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-2) 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--duration-normal) var(--ease-default);
  outline: none;
}

.qr-options-toggle:hover { color: var(--color-text); }

.qr-options-arrow {
  font-size: 10px;
  transition: transform var(--duration-normal) var(--ease-default);
}

.qr-options-wrapper.collapsed .qr-options-arrow { transform: rotate(-90deg); }
.qr-options-wrapper.collapsed .qr-options { display: none; }

.qr-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-2) var(--space-6);
  padding: var(--space-3) 0 var(--space-4);
}

.qr-options-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.qr-options-col-full {
  grid-column: 1 / -1;
  flex-direction: row;
}

.qr-options-col-full .qr-option-row {
  flex: 1;
}

.qr-option-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.qr-option-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}

.qr-option-val {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  min-width: 42px;
}

.qr-options select {
  height: 32px;
  font-size: var(--text-sm);
  flex: 1;
  min-width: 0;
}

.qr-options input[type="color"] {
  width: 32px;
  height: 32px;
  padding: 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.qr-options input[type="range"] {
  width: 100px;
}

/* ----- 预览区 ----- */
.qr-preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-4);
}

.qr-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  min-height: 200px;
  max-width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-4);
}

.qr-preview-placeholder {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
}

.qr-actions {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ----- 解码：子 Tab ----- */
.qr-decode-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* ----- 摄像头扫码 ----- */
.qr-decode-section {
  position: relative;
}

.qr-camera-box {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 0 auto var(--space-4);
}

.qr-camera-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-camera-frame {
  width: 200px;
  height: 200px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.qr-camera-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.qr-camera-hint {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ----- 上传图片解码 ----- */
.qr-drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--duration-normal) var(--ease-default), background-color var(--duration-normal) var(--ease-default);
}

.qr-drop-zone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.hash-drop-icon {
  margin-bottom: var(--space-3);
}

.hash-drop-icon img {
  opacity: 0.45;
}

.hash-drop-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.hash-drop-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.qr-file-preview {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-top: var(--space-3);
}

.qr-file-preview img {
  max-height: 120px;
  border-radius: var(--radius-sm);
}

/* ----- 解码结果 ----- */
.qr-decode-result {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-success);
  border-radius: var(--radius-md);
  background: var(--color-success-bg);
}

.qr-decode-result-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-success);
  margin-bottom: var(--space-2);
}

.qr-decode-result-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text);
  word-break: break-all;
  line-height: 1.5;
  margin-bottom: var(--space-3);
}

.qr-decode-result-actions {
  display: flex;
  gap: var(--space-2);
}

.qr-decode-error {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-md);
  background: var(--color-error-bg);
  color: var(--color-error);
  font-size: var(--text-sm);
}

/* ----- SVG 二维码 ----- */
.qr-preview-box svg {
  display: block;
  max-width: 100%;
  height: auto;
}

#qr-svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ----- 工具描述 + FAQ 同容器宽度 ----- */
.tool-header .tool-desc {
  max-width: none;
}

.faq-section { max-width: none; }

.qr-color2 {
  margin-left: var(--space-2);
}

/* ----- Logo 上传 ----- */
.qr-logo-file {
  font-size: var(--text-xs);
  max-width: 160px;
}

.qr-logo-file::file-selector-button {
  font-size: var(--text-xs);
  padding: 2px 8px;
}

/* ----- 预设样式按钮 ----- */
.qr-presets {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.qr-preset-btn {
  width: 28px;
  height: 28px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--duration-normal) var(--ease-default), transform var(--duration-normal) var(--ease-default);
  background: var(--color-surface);
}

.qr-preset-btn:hover {
  transform: scale(1.15);
}

.qr-preset-btn.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.qr-preset-btn[data-preset="classic"] { color: #000; }
.qr-preset-btn[data-preset="ocean"] { color: #0284c7; }
.qr-preset-btn[data-preset="forest"] { color: #16a34a; }
.qr-preset-btn[data-preset="sunset"] { color: #ea580c; }
.qr-preset-btn[data-preset="purple"] { color: #7c3aed; }
.qr-preset-btn[data-preset="midnight"] { color: #1e3a5f; }

/* ----- 移动端 700px 断点 ----- */
@media (max-width: 700px) {
  .qr-options {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .qr-options-col-full {
    flex-direction: column;
  }

  .qr-preview-box {
    min-width: 160px;
    min-height: 160px;
  }

  .qr-camera-frame {
    width: 140px;
    height: 140px;
  }
}
