/**
 * components.css — Bubbles 官网统一组件库
 * 统一按钮、卡片、表单、模态框等高频组件样式
 * 最后修改: 2026-08-03 20:35:00
 *
 * 设计原则：
 * 1. 使用 b- 前缀避免与历史类名冲突
 * 2. 历史页面可逐步迁移，不强制一次性替换
 * 3. 新页面必须使用本文件定义的组件类
 * 4. 所有组件遵循 WCAG AA 可访问性标准
 */

/* ============================================================
   按钮：统一主按钮、次按钮、文字按钮
   ============================================================ */

/* 主按钮：金色渐变（用于核心 CTA） */
.b-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--b-space-2);
  padding: 14px 34px;
  border: none;
  border-radius: var(--b-radius-full);
  background: var(--b-gradient-gold-shine);
  background-size: 150% auto;
  color: var(--b-navy);
  font-family: inherit;
  font-size: var(--b-text-lg);
  font-weight: var(--b-weight-bold);
  cursor: pointer;
  transition: all var(--b-duration-base) var(--b-ease-spring);
  box-shadow: var(--b-shadow-gold);
  text-decoration: none;
  white-space: nowrap;
}
.b-btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--b-shadow-gold-hover);
  background-position: right center;
}
.b-btn-primary:active { transform: translateY(0); }
.b-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--b-shadow-sm);
}

/* 次按钮：描边（用于次要操作） */
.b-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--b-space-2);
  padding: 14px 34px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--b-radius-full);
  background: rgba(255, 255, 255, 0.07);
  color: var(--b-text-white);
  font-family: inherit;
  font-size: var(--b-text-lg);
  font-weight: var(--b-weight-semibold);
  cursor: pointer;
  transition: all var(--b-duration-base) var(--b-ease-spring);
  text-decoration: none;
  white-space: nowrap;
}
.b-btn-secondary:hover {
  border-color: var(--b-gold-bright);
  color: var(--b-gold-bright);
  background: rgba(190, 166, 114, 0.12);
  box-shadow: 0 0 28px rgba(190, 166, 114, 0.2);
  transform: translateY(-2px);
}

/* 描边按钮（浅色背景用） */
.b-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--b-space-2);
  padding: 10px 20px;
  border: 1.5px solid var(--b-border-light);
  border-radius: var(--b-radius-md);
  background: var(--b-bg-card);
  color: var(--b-text-secondary);
  font-family: inherit;
  font-size: var(--b-text-base);
  font-weight: var(--b-weight-medium);
  cursor: pointer;
  transition: all var(--b-duration-fast);
  text-decoration: none;
  white-space: nowrap;
}
.b-btn-outline:hover {
  border-color: var(--b-gold);
  color: var(--b-gold);
}

/* 提交按钮（表单用，全宽） */
.b-btn-submit {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: var(--b-radius-md);
  background: var(--b-gradient-gold);
  color: var(--b-navy);
  font-family: inherit;
  font-size: var(--b-text-md);
  font-weight: var(--b-weight-semibold);
  cursor: pointer;
  transition: all var(--b-duration-fast);
  box-shadow: 0 2px 8px rgba(190, 166, 114, 0.25);
}
.b-btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(190, 166, 114, 0.35);
}
.b-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   卡片：统一容器卡片
   ============================================================ */

/* 标准卡片 */
.b-card {
  background: var(--b-bg-card);
  border-radius: var(--b-radius-lg);
  box-shadow: var(--b-shadow-card);
  overflow: hidden;
  transition: transform var(--b-duration-base) var(--b-ease-spring),
              box-shadow var(--b-duration-base) var(--b-ease-spring);
}
.b-card-hoverable:hover {
  transform: translateY(-4px);
  box-shadow: var(--b-shadow-card-hover);
}

/* 卡片头部 */
.b-card-header {
  padding: var(--b-space-4) var(--b-space-5);
  border-bottom: 1px solid var(--b-border-light);
  font-size: var(--b-text-md);
  font-weight: var(--b-weight-semibold);
  color: var(--b-text-body);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 卡片内容 */
.b-card-body {
  padding: var(--b-space-4) var(--b-space-5);
}

/* ============================================================
   表单：统一输入框、文本域、选择框
   ============================================================ */

/* 表单分组 */
.b-form-group {
  margin-bottom: var(--b-space-4);
}
.b-form-group label {
  display: block;
  font-size: var(--b-text-sm);
  font-weight: var(--b-weight-medium);
  color: var(--b-text-secondary);
  margin-bottom: var(--b-space-2);
}

/* 输入框（字号 ≥16px，避免 iOS Safari 自动缩放） */
.b-input,
.b-textarea,
.b-select {
  width: 100%;
  height: 44px;
  padding: 0 var(--b-space-3);
  border: 1px solid var(--b-border-light);
  border-radius: var(--b-radius-md);
  background: var(--b-bg-card);
  color: var(--b-text-body);
  font-family: inherit;
  font-size: var(--b-text-lg);  /* ≥16px 防 iOS 缩放 */
  outline: none;
  transition: border-color var(--b-duration-fast), box-shadow var(--b-duration-fast);
  box-sizing: border-box;
}
.b-textarea {
  height: 80px;
  padding: var(--b-space-3);
  resize: vertical;
  line-height: var(--b-leading-normal);
}
.b-input:focus,
.b-textarea:focus,
.b-select:focus {
  border-color: var(--b-gold);
  box-shadow: 0 0 0 3px rgba(190, 166, 114, 0.12);
}
.b-input::placeholder,
.b-textarea::placeholder {
  color: var(--b-text-placeholder);
}
.b-input.field-error,
.b-textarea.field-error {
  border-color: var(--b-error);
}

/* 表单错误提示 */
.b-form-error-msg {
  font-size: var(--b-text-xs);
  color: var(--b-error);
  margin-top: var(--b-space-1);
  display: none;
}
.b-input.field-error + .b-form-error-msg,
.b-textarea.field-error + .b-form-error-msg {
  display: block;
}

/* 密码切换按钮（可访问：≥44px 触控目标） */
.b-pwd-toggle {
  position: absolute;
  right: var(--b-space-2);
  top: 50%;
  transform: translateY(-50%);
  width: 44px;   /* WCAG 2.5.5：最小 44px 触控目标 */
  height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--b-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--b-duration-fast);
  z-index: 1;
}
.b-pwd-toggle:hover { color: var(--b-gold); }
.b-pwd-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 复选框（金色 accent） */
.b-checkbox {
  display: flex;
  align-items: center;
  gap: var(--b-space-2);
  font-size: var(--b-text-sm);
  color: var(--b-text-secondary);
  cursor: pointer;
}
.b-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--b-gold);
  cursor: pointer;
}

/* ============================================================
   模态框：无障碍对话框
   ============================================================ */

.b-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--b-space-5);
}
.b-modal.open { display: flex; }
.b-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.b-modal-card {
  position: relative;
  background: var(--b-bg-card);
  border-radius: var(--b-radius-lg);
  padding: var(--b-space-8);
  max-width: 480px;
  width: 100%;
  animation: bModalIn var(--b-duration-slow) var(--b-ease-spring);
}
@keyframes bModalIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.b-modal-close {
  position: absolute;
  top: var(--b-space-3);
  right: var(--b-space-4);
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  font-size: 22px;
  color: var(--b-text-light);
  cursor: pointer;
  transition: color var(--b-duration-fast);
}
.b-modal-close:hover { color: var(--b-text-body); }

/* ============================================================
   信息行：键值对列表（院校库等详情页用）
   ============================================================ */

.b-info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--b-space-2) 0;
  border-bottom: 1px dashed var(--b-border-light);
  gap: var(--b-space-4);
}
.b-info-row:last-child { border-bottom: none; }
.b-info-row .b-info-key {
  font-size: var(--b-text-sm);
  color: var(--b-text-light);
  white-space: nowrap;
  flex-shrink: 0;
}
.b-info-row .b-info-val {
  font-size: var(--b-text-sm);
  color: var(--b-text-body);
  text-align: right;
  word-break: break-word;
}

/* ============================================================
   徽章/标签
   ============================================================ */

.b-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--b-space-1) var(--b-space-3);
  border-radius: var(--b-radius-full);
  font-size: var(--b-text-xs);
  font-weight: var(--b-weight-medium);
  background: var(--b-bg-page);
  color: var(--b-text-body);
}
.b-badge-gold {
  background: var(--b-gradient-gold);
  color: var(--b-navy-dark);
  font-weight: var(--b-weight-bold);
}
.b-badge-navy {
  background: var(--b-navy);
  color: var(--b-text-white);
}

/* ============================================================
   响应式：移动端按钮缩小
   ============================================================ */
@media (max-width: 768px) {
  .b-btn-primary,
  .b-btn-secondary {
    padding: var(--b-space-3) var(--b-space-6);
    font-size: var(--b-text-md);
  }
}
