/**
 * 组件层：按钮、卡片、标签、状态徽章、表格、表单、进度条、滚动渐显。
 */

/* ===== 滚动渐显 ===== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 12px 22px;
  font-size: var(--fs-base);
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-base) var(--ease),
    background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.btn:active { transform: translateY(1px); }

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(140deg, var(--brand) 0%, #0e9488 100%);
  box-shadow:
    var(--shadow-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-primary:hover {
  color: #fff;
  background: linear-gradient(140deg, var(--brand-strong) 0%, var(--brand) 100%);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.btn-ghost {
  color: var(--brand);
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(8px) saturate(160%);
  backdrop-filter: blur(8px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 14px rgba(40, 60, 100, 0.08);
}

.btn-ghost:hover {
  color: var(--brand-strong);
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.8);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 14px;
  font-size: var(--fs-sm);
}

/* ===== 卡片：外层玻璃 ===== */
.card {
  position: relative;
  padding: var(--sp-6);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: url(#lg-refraction) blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow:
    var(--glass-shadow),
    inset 0 2px 0 var(--glass-hi-top),
    inset 0 0 0 1px var(--glass-hi-ring),
    inset 0 0 34px var(--glass-hi-glow);
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease);
}

/* 顶部弧形高光：拟真玻璃反光（伪元素，不占布局、不影响文本） */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 46%;
  border-radius: 50% 50% 100% 100% / 0 0 100% 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
  opacity: 0.7;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow:
    var(--glass-shadow-hover),
    inset 0 2px 0 var(--glass-hi-top),
    inset 0 0 0 1px var(--glass-hi-ring),
    inset 0 0 34px var(--glass-hi-glow);
  border-color: rgba(255, 255, 255, 0.92);
}

.card:hover::before { opacity: 1; }

/* 卡片内容需在上层，避免被高光伪元素遮挡 */
.card > * { position: relative; z-index: 1; }

.card h3 {
  font-size: var(--fs-md);
  margin-bottom: var(--sp-2);
}

.card p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}

.card-no {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand);
  background: rgba(213, 242, 238, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
}

/* ===== 标签 / 徽章 ===== */
.tag {
  display: inline-block;
  padding: 5px 12px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-600);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.chip {
  display: inline-block;
  padding: 4px 10px;
  font-size: var(--fs-xs);
  color: var(--brand);
  background: rgba(213, 242, 238, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* 半透明色底：在玻璃上仍能保持语义色，同时不破坏通透感 */
.status-badge.tone-live {
  color: #15803d;
  background: rgba(220, 252, 231, 0.78);
}

.status-badge.tone-building {
  color: #b45309;
  background: rgba(254, 243, 199, 0.82);
}

.status-badge.tone-planned {
  color: var(--ink-500);
  background: rgba(241, 245, 249, 0.72);
}

.tick {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--brand);
  background: rgba(213, 242, 238, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
}

/* ===== 表格：玻璃容器 + 内层可读性处理 ===== */
.table-wrap {
  overflow-x: auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: url(#lg-refraction) blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow:
    var(--glass-shadow),
    inset 0 2px 0 var(--glass-hi-top),
    inset 0 0 0 1px var(--glass-hi-ring);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}

.data-table th,
.data-table td {
  padding: var(--sp-3) var(--sp-5);
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  white-space: nowrap;
  vertical-align: middle;
}

/* 注：此处刻意不使用 position:sticky。
   .table-wrap 为 overflow-x:auto 且无高度限制，overflow-y 会计算为 auto，
   sticky 相对该容器定位但容器没有滚动高度，吸顶不会生效（属于无效声明）。
   若将来表格变长需要吸顶，需同时给 .table-wrap 设 max-height。 */
.data-table thead th {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #134e4a;
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1.5px solid rgba(15, 118, 110, 0.25);
}

.data-table tbody tr { transition: background-color 0.15s ease; }
.data-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.26); }
.data-table tbody tr:nth-child(odd)  { background: rgba(255, 255, 255, 0.1); }
.data-table tbody tr:hover           { background: rgba(213, 242, 238, 0.5); }

.data-table td:not(:last-child),
.data-table th:not(:last-child) {
  border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.data-table tbody tr:last-child td { border-bottom: none; }

/* ===== 表单 ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
}

.field label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-700);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--ink-800);
  /* 玻璃上的输入控件需提高不透明度，否则输入内容难以辨认 */
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-400);
}

.textarea {
  resize: vertical;
  min-height: 120px;
}

.form-note {
  margin: var(--sp-3) 0 0;
  min-height: 20px;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

.form-note.is-error { color: var(--danger); }
.form-note.is-success { color: var(--success); }

/* ===== 进度条 ===== */
.progress-track {
  height: 8px;
  background: rgba(148, 163, 184, 0.22);
  border-radius: var(--radius-full);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #14b8a6);
  border-radius: var(--radius-full);
  transition: width var(--dur-slow) var(--ease);
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
}
