/* ════════════════════════════════════════════════════════════════
 * 万象 · 通用组件样式 v4.0
 * 微信小程序原生风 · 简洁中性
 * ════════════════════════════════════════════════════════════════ */

/* ─── 按钮 ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  line-height: 1;
  color: #FFF;
  background: var(--color-gold);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
  min-height: 48px;
}

.btn:hover {
  background: var(--color-gold-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.btn:disabled,
.btn.is-loading {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--secondary {
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-gold);
}

.btn--secondary:hover {
  background: var(--color-gold-bg);
}

.btn--ghost {
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-line);
  box-shadow: none;
}

.btn--ghost:hover {
  color: var(--color-gold);
  border-color: var(--color-gold);
  background: var(--color-gold-bg);
}

.btn--purple {
  color: #FFF;
  background: var(--color-purple);
}

.btn--purple:hover {
  background: var(--color-purple-dark, #6A51E6);
}

.btn--sm {
  padding: 10px 16px;
  font-size: var(--text-sm);
  min-height: 40px;
}

.btn--lg {
  padding: 16px 28px;
  font-size: var(--text-md);
  min-height: 52px;
}

.btn--block {
  display: flex;
  width: 100%;
}

/* ─── 卡片 ─── */
.card {
  position: relative;
  padding: 20px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-base) var(--ease-out);
  overflow: hidden;
}

.card:hover {
  border-color: var(--color-gold-light);
  box-shadow: var(--shadow-md);
}

.card--highlight {
  border-color: var(--color-gold);
  box-shadow: var(--shadow-sm);
}

.card--purple {
  border-color: var(--color-purple);
}

.card__title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin-bottom: 12px;
}

.card__body {
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* ─── 表单 ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: var(--fw-medium);
}

.input,
.select,
.textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg-input);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  outline: none;
  font-family: inherit;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--color-gold-light);
}

.input:focus,
.select:focus,
.textarea:focus {
  background: #FFF;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(184,149,106,0.1);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--color-text-mute);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='%23B8956A'%3e%3cpath d='M6 8L0 0h12z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
  padding-right: 32px;
}

.textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

/* ─── 标签 / 徽章 ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  line-height: 1.6;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge--gold {
  color: #FFF;
  background: var(--color-gold);
}

.badge--purple {
  color: #FFF;
  background: var(--color-purple);
}

.badge--success {
  color: #FFF;
  background: var(--color-success);
}

.badge--warn {
  color: #FFF;
  background: var(--color-warning);
}

.badge--outline {
  color: var(--color-gold);
  background: transparent;
  border: 1px solid var(--color-gold);
}

.badge--soft {
  color: var(--color-text-secondary);
  background: var(--color-bg-base);
  border: 1px solid var(--color-line);
}

/* ─── 模态框 ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn var(--duration-base) var(--ease-out);
}

.modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--duration-base) var(--ease-spring);
}

.modal--wide {
  max-width: 640px;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  color: var(--color-text-mute);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.modal__close:hover {
  color: var(--color-text);
  background: var(--color-bg-base);
}

.modal__title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin-bottom: 12px;
  text-align: center;
}

.modal__subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 20px;
}

/* ─── Toast 提示 ─── */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 90%;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  min-width: 240px;
  max-width: 360px;
  background: rgba(28, 28, 30, 0.9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #FFF;
  font-size: var(--text-sm);
  pointer-events: auto;
  animation: slideInTop var(--duration-base) var(--ease-out);
}

.toast--success { background: rgba(52, 199, 89, 0.9); }
.toast--warn    { background: rgba(255, 149, 0, 0.9); }
.toast--error   { background: rgba(255, 59, 48, 0.9); }

.toast.is-leaving { 
  animation: slideOutTop var(--duration-base) var(--ease-out) forwards; 
}

/* ─── 动画 ─── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideInTop {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideOutTop {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-20px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 减少动画偏好（无障碍） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
