/* ============================================
   体检预约平台 - 公共样式 精致版
   柔和配色 · 细腻质感 · 舒适体验
   ============================================ */

/* ===== 设计令牌 - 全局变量 ===== */
:root {
  /* 主色调 */
  --primary-50: #F0F9F8;
  --primary-100: #D9F0ED;
  --primary-200: #B3E1DB;
  --primary-300: #8DCFCC;
  --primary-400: #5EBFB9;
  --primary-500: #3AA99F;
  --primary-600: #2D8A82;
  --primary-700: #236B66;
  --primary-800: #1B524B;
  --primary-900: #133936;

  /* 强调色 */
  --accent-50: #FFF5F5;
  --accent-100: #FFE3E3;
  --accent-200: #FFBDBD;
  --accent-300: #FF9B9B;
  --accent-400: #FF7B7B;
  --accent-500: #F0626B;
  --accent-600: #E84A54;

  /* 文字色 */
  --text-primary: #2D3748;
  --text-secondary: #5A6778;
  --text-muted: #8896A7;
  --text-light: #B8C4CE;

  /* 背景色 */
  --bg-page: #FAFBFC;
  --bg-card: #FFFFFF;
  --bg-hover: #F7F9FA;

  /* 功能色 */
  --success: #52C89B;
  --success-bg: #E8F9F3;
  --warning: #F5B95D;
  --warning-bg: #FEF6E7;
  --error: #F16B7A;
  --error-bg: #FEF0F2;
  --info: #6BA3D6;
  --info-bg: #EDF5FC;

  /* 渐变 */
  --gradient-primary: linear-gradient(135deg, #3AA99F 0%, #6BC4B8 100%);
  --gradient-hero: linear-gradient(160deg, #E8F6F4 0%, #D9F0ED 30%, #FFF5F5 70%, #FFE8EA 100%);

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(45, 55, 72, 0.03);
  --shadow-sm: 0 2px 8px rgba(45, 55, 72, 0.04), 0 1px 2px rgba(45, 55, 72, 0.02);
  --shadow-md: 0 4px 12px rgba(45, 55, 72, 0.06), 0 2px 4px rgba(45, 55, 72, 0.03);
  --shadow-lg: 0 8px 24px rgba(45, 55, 72, 0.08), 0 4px 8px rgba(45, 55, 72, 0.04);
  --shadow-xl: 0 16px 40px rgba(45, 55, 72, 0.1), 0 8px 16px rgba(45, 55, 72, 0.05);
  --shadow-card: 0 2px 16px rgba(58, 169, 159, 0.06);

  /* 圆角 */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* 过渡 */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* ===== 基础重置 ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* ===== 页面容器 ===== */
.page-container {
  min-height: 100vh;
  background: var(--bg-page);
}

/* ===== 顶部导航栏 ===== */
.top-bar {
  background: linear-gradient(135deg, #3AA99F 0%, #5EBFB9 100%);
  color: white;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 99;
}

.top-bar .back-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--duration-fast) var(--ease-out);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  margin-left: 8px;
}

.top-bar .back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.top-bar .back-btn:active {
  transform: scale(0.95);
}

.top-bar .back-btn svg {
  width: 22px;
  height: 22px;
  color: white;
}

.top-bar .title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
  padding-right: 52px;
}

.top-bar .action-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--duration-fast) var(--ease-out);
  margin-right: 8px;
}

.top-bar .action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.top-bar .action-btn svg {
  width: 22px;
  height: 22px;
  color: white;
}

/* ===== 内容区域 ===== */
.page-content {
  padding: 20px 16px;
  padding-bottom: 100px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0, 0, 0, 0.02);
  transition: var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--duration-fast) var(--ease-out);
  text-decoration: none;
  outline: none;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(58, 169, 159, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(58, 169, 159, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--text-light);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  color: var(--primary-600);
  border: 1.5px solid var(--primary-200);
}

.btn-secondary:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
}

.btn-accent {
  background: linear-gradient(135deg, #F0626B 0%, #F8A4AB 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(240, 98, 107, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(240, 98, 107, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary-400);
  color: var(--primary-600);
}

.btn-outline:hover {
  background: var(--primary-50);
}

.btn-sm {
  padding: 10px 18px;
  font-size: 13px;
  border-radius: var(--radius-lg);
}

.btn-lg {
  padding: 16px 36px;
  font-size: 16px;
  border-radius: var(--radius-full);
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group .required {
  color: var(--accent-500);
  margin-left: 3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--bg-page);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--bg-page);
  outline: none;
  transition: var(--duration-fast) var(--ease-out);
  color: var(--text-primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-light);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-400);
  background: white;
  box-shadow: 0 0 0 3px rgba(58, 169, 159, 0.08);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238896A7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ===== 标签/徽章 ===== */
.tag,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

.tag-primary,
.badge-primary {
  background: var(--primary-50);
  color: var(--primary-600);
}

.tag-success,
.badge-success {
  background: var(--success-bg);
  color: #3A9D71;
}

.tag-error,
.badge-error {
  background: var(--error-bg);
  color: var(--accent-600);
}

.tag-warning,
.badge-warning {
  background: var(--warning-bg);
  color: #C98D2F;
}

.tag-info,
.badge-info {
  background: var(--info-bg);
  color: #4A82B8;
}

.tag-gray,
.badge-gray {
  background: var(--bg-page);
  color: var(--text-muted);
}

/* ===== 价格 ===== */
.price {
  color: var(--accent-600);
  font-size: 24px;
  font-weight: 700;
}

.price-symbol {
  font-size: 14px;
  font-weight: 600;
}

.price-unit {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
  margin-left: 3px;
}

.price-old {
  color: var(--text-light);
  text-decoration: line-through;
  font-size: 13px;
  margin-left: 10px;
  font-weight: 400;
}

/* ===== 列表项 ===== */
.list-item {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 0 16px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--duration-normal) var(--ease-out);
  border: 1px solid rgba(0, 0, 0, 0.02);
}

.list-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.list-item:active {
  transform: scale(0.99);
}

/* ===== 分隔线 ===== */
.divider {
  height: 1px;
  background: var(--bg-page);
  margin: 18px 0;
}

.divider-vertical {
  width: 1px;
  background: var(--bg-page);
  align-self: stretch;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
}

.animate-fadeInUp {
  animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
}

.animate-scaleIn {
  animation: scaleIn var(--duration-normal) var(--ease-spring) forwards;
}

.animate-slideUp {
  animation: slideUp var(--duration-slow) var(--ease-out) forwards;
}

/* 延迟动画 */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ===== 底部导航栏 ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(70px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: flex-start;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(45, 55, 72, 0.04);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--duration-fast) var(--ease-out);
  position: relative;
}

.tab-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 30px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 3px 3px;
  transition: var(--duration-fast) var(--ease-out);
}

.tab-item.active::before {
  transform: translateX(-50%) scaleX(1);
}

.tab-item.active {
  color: var(--primary-500);
}

.tab-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--duration-fast) var(--ease-out);
}

.tab-item:hover .tab-icon {
  transform: translateY(-2px);
}

.tab-item.active .tab-icon {
  transform: scale(1.1);
}

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(45, 55, 72, 0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn var(--duration-fast) var(--ease-out);
  backdrop-filter: blur(4px);
}

.modal {
  background: white;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--duration-normal) var(--ease-out);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--duration-fast) var(--ease-out);
  color: var(--text-muted);
}

.modal-close:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

.modal-close svg {
  width: 22px;
  height: 22px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-page);
}

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--primary-50), var(--accent-50));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg {
  width: 40px;
  height: 40px;
  color: var(--text-light);
}

.empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(45, 55, 72, 0.9);
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 14px;
  z-index: 9999;
  max-width: 70vw;
  text-align: center;
  backdrop-filter: blur(10px);
  animation: toastIn 2.5s forwards;
  box-shadow: var(--shadow-lg);
}

@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== Loading ===== */
.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(250, 251, 252, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  gap: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2.5px solid var(--primary-100);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.p-4 { padding: 16px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ===== 响应式 ===== */
@media (min-width: 768px) {
  .page-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
  }

  .card {
    padding: 24px;
  }
}
