/* 二维码生成页专属样式 —— 参考草料二维码 cli.im 风格 */

.page-qr {
  max-width: 1120px;
}

/* —— 共享组件 —— */

.side-block {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.side-block h3 {
  margin: 0 0 12px;
  font-size: 0.88rem;
  font-weight: 600;
}

.qr-sub-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.qr-sub-title:not(:first-child) {
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.field:last-child { margin-bottom: 0; }

.field > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.field > span em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field textarea,
.field select {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
  font-family: inherit;
  resize: vertical;
}

.field textarea {
  min-height: 100px;
  line-height: 1.5;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: pointer;
}

.check-inline input {
  accent-color: var(--accent);
}

/* —— 顶部 tab 切换（参考草料顶部内容类型导航） —— */
.qr-panel {
  padding: 0;
  overflow: hidden;
}

.qr-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 118, 110, 0.03);
}

.qr-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  position: relative;
  transition: color 0.15s;
}

.qr-tab:hover {
  color: var(--ink);
}

.qr-tab:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.65;
}

.qr-tab:disabled:hover {
  color: var(--muted);
}

.qr-tab-soon {
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 500;
  color: var(--accent);
  background: rgba(15, 118, 110, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.4;
}

.qr-tab:disabled .qr-tab-soon {
  background: rgba(93, 107, 122, 0.1);
  color: var(--muted);
}

.qr-tab.active {
  color: var(--accent);
  font-weight: 600;
}

.qr-tab.active::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.qr-tab-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 8px;
}

#panel-generate,
#panel-decode {
  padding: 20px;
}

/* —— 双栏布局 —— */
.qr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.qr-editor {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qr-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 16px;
}

/* —— 输入区 —— */
.qr-input-area {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.qr-textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
  font-family: inherit;
  resize: vertical;
  background: #fafbfc;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.qr-textarea:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  background: #fff;
}

.qr-textarea::placeholder { color: #b0b0b0; }

.qr-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.qr-form .field-full { grid-column: 1 / -1; }

.type-panel[hidden] { display: none !important; }

/* —— 高级编辑折叠面板 —— */
.qr-advanced {
  padding: 0;
  overflow: hidden;
}

.qr-advanced-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.qr-advanced-head h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.qr-advanced-arrow {
  width: 12px;
  height: 8px;
  color: var(--muted);
  transition: transform 0.2s;
}

.qr-advanced.collapsed .qr-advanced-arrow {
  transform: rotate(-90deg);
}

.qr-advanced-body {
  padding: 0 16px 16px;
}

.qr-advanced.collapsed .qr-advanced-body {
  display: none;
}

/* —— 预览区 —— */
.qr-preview-block {
  padding: 20px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: center;
}

.qr-stage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 260px;
  height: 260px;
  margin: 0 auto;
  padding: 16px;
  border-radius: 14px;
  background:
    linear-gradient(45deg, #e8edf3 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #e8edf3 25%, transparent 25%) 0 8px / 16px 16px,
    linear-gradient(45deg, transparent 75%, #e8edf3 75%) 8px -8px / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #e8edf3 75%) -8px 0 / 16px 16px,
    #f8fafc;
  border: 1px solid var(--line);
}

.qr-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(24, 33, 43, 0.1);
}

.qr-stage canvas[hidden] { display: none !important; }

.qr-stage-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.qr-stage-empty strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.qr-spec {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* —— 参数列表（参考草料：点击展开，默认折叠） —— */
.qr-params-block {
  padding: 0;
  overflow: hidden;
}

.qr-params-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.qr-params-head h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.qr-params-arrow {
  width: 12px;
  height: 8px;
  color: var(--muted);
  transition: transform 0.2s;
}

.qr-params-block:not(.collapsed) .qr-params-arrow {
  transform: rotate(180deg);
}

.qr-params-body {
  padding: 0 16px 14px;
  display: none;
}

.qr-params-block:not(.collapsed) .qr-params-body {
  display: block;
}

.qr-params {
  display: flex;
  flex-direction: column;
}

.qr-param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.qr-param-row:last-child { border-bottom: none; }

.qr-param-label {
  color: var(--muted);
  flex-shrink: 0;
}

.qr-param-value {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.qr-param-select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 28px 6px 10px;
  font-size: 0.85rem;
  color: var(--ink);
  font-family: inherit;
  font-weight: 600;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235d6b7a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  cursor: pointer;
  text-align: right;
  min-width: 120px;
}

.qr-param-select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* —— 颜色 —— */
.qr-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.qr-color-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.qr-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 8px 4px 4px;
  background: #fff;
}

.qr-swatch input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.qr-swatch input[type="text"] {
  flex: 1;
  min-width: 0;
  border: none;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
  background: transparent;
}

.qr-swatch input[type="text"]:focus { outline: none; }

.qr-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.qr-presets button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
  appearance: none;
  transition: transform 0.15s;
}

.qr-presets button:hover { transform: scale(1.1); }

.qr-presets button.active {
  box-shadow: 0 0 0 2px var(--accent);
}

/* —— Logo —— */
.qr-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.qr-logo-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
  background:
    linear-gradient(45deg, #e8edf3 25%, transparent 25%) 0 0 / 10px 10px,
    #fff;
}

.qr-logo-thumb[hidden],
#logo-controls[hidden] { display: none !important; }

.qr-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 10px 0 6px;
}

.qr-slider em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
  float: right;
}

.qr-slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* —— 下载按钮区 —— */
.qr-download-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.qr-btn-download {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
}

.qr-actions-extra {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 0.8rem;
}

.qr-text-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.qr-text-link:disabled {
  color: #bbb;
  cursor: not-allowed;
}

.qr-text-link:not(:disabled):hover { text-decoration: underline; }

.qr-dot { color: #ccc; }

/* —— 解码面板 —— */
.qr-decode-panel {
  max-width: 560px;
  margin: 0 auto;
}

.qr-decode-drop {
  border: 2px dashed rgba(15, 118, 110, 0.28);
  border-radius: 14px;
  padding: 36px 20px;
  text-align: center;
  background: rgba(15, 118, 110, 0.03);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.qr-decode-drop:hover,
.qr-decode-drop.dragover {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.07);
}

.qr-decode-drop .dropzone-icon {
  margin: 0 auto 12px;
}

.qr-decode-drop h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.qr-decode-drop p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.qr-decode-preview {
  display: block;
  max-width: 200px;
  margin: 14px auto 0;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.qr-decode-preview[hidden] { display: none !important; }

.qr-decode-result {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.06);
  border: 1px solid var(--line);
}

.qr-decode-result[hidden] { display: none !important; }

.qr-decode-result h4 {
  margin: 0 0 8px;
  font-size: 0.86rem;
}

.qr-decode-result pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
  line-height: 1.5;
}

.qr-decode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 860px) {
  .qr-layout {
    grid-template-columns: 1fr;
  }

  .qr-sidebar {
    position: static;
    order: -1;
  }

  .qr-form {
    grid-template-columns: 1fr;
  }

  .qr-colors {
    grid-template-columns: 1fr;
  }

  .qr-tab {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
}
