/* ============================================================
   主题.css — VA-UI H5 组件库核心主题
   基于项目规范 #396FFF 主色体系，CSS变量全局控制
   对标 Ant Design Mobile 动画效果、选中态、阴影、间距
   ============================================================ */

/* ==================== 1. CSS 变量体系 ==================== */
:root {
  /* --- 品牌色 --- */
  --va-primary: #396FFF;
  --va-primary-hover: #5C86FF;
  --va-primary-active: #1A45E0;
  --va-primary-light: #EBF1FF;
  --va-primary-light-border: #B3CCFF;

  /* --- 功能色 --- */
  --va-success: #52C41A;
  --va-warning: #FAAD14;
  --va-error: #FF4D4F;
  --va-link: #396FFF;

  /* --- 中性色 --- */
  --va-text-primary: #262626;
  --va-text-body: #333333;
  --va-text-secondary: #595959;
  --va-text-placeholder: #8C8C8C;
  --va-text-disabled: #BFBFBF;
  --va-border: #D9D9D9;
  --va-border-light: #E8E8E8;
  --va-bg-base: #FFFFFF;
  --va-bg-light: #FAFAFA;
  --va-bg-item: #F7F8FA;
  --va-bg-disabled: #F5F5F5;
  --va-overlay: #00000073;

  /* --- 间距 --- */
  --va-space-xs: 4px;
  --va-space-sm: 8px;
  --va-space-md: 12px;
  --va-space-lg: 16px;
  --va-space-xl: 24px;

  /* --- 圆角 --- */
  --va-radius-xs: 2px;
  --va-radius-sm: 4px;
  --va-radius-md: 6px;
  --va-radius-lg: 8px;
  --va-radius-xl: 10px;
  --va-radius-full: 9999px;

  /* --- 字体 --- */
  --va-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --va-font-title: 600 16px/1.4;
  --va-font-body: 400 14px/1.5;
  --va-font-caption: 400 12px/1.5;

  /* --- H5按钮 --- */
  --va-btn-height: 42px;
  --va-btn-radius: var(--va-radius-sm);
  --va-btn-font: 400 14px/1;

  /* --- H5输入框 --- */
  --va-input-height: 44px;
  --va-input-radius: var(--va-radius-sm);

  /* --- H5卡片 --- */
  --va-card-radius: var(--va-radius-xl);
  --va-card-padding: 10px;
  --va-card-margin: 10px;
  --va-card-shadow: 0 1px 4px rgba(0,0,0,0.06);

  /* --- 阴影层级 --- */
  --va-shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --va-shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --va-shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --va-shadow-focus: 0 0 0 2px rgba(57,111,255,0.15);

  /* --- 动画 --- */
  --va-duration-fast: 0.15s;
  --va-duration-normal: 0.25s;
  --va-duration-slow: 0.35s;
  --va-ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --va-ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
  --va-ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- z-index --- */
  --va-z-base: 0;
  --va-z-popup: 1000;
  --va-z-toast: 1100;
}

/* ==================== 2. 全局 Reset ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--va-font-family);
  font: var(--va-font-body);
  color: var(--va-text-body);
  background-color: #F7F8FA;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

a {
  color: var(--va-link);
  text-decoration: none;
}

img {
  max-width: 100%;
  vertical-align: middle;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

/* ==================== 2.5 H5页面布局骨架 ==================== */

/* 手机壳容器 - 375标准宽度居中，限制在手机壳内 */
.va-phone-shell {
  max-width: 375px;
  margin: 0 auto;
  height: 100vh;
  position: relative;
  background: #F7F8FA;
  overflow: hidden;
}

/* 页面容器 - 铁律：height:100%;overflow:hidden */
.va-page {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* H5内容区 - 铁律：flex:1;overflow-y:auto */
.va-h5-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 10px 0;
  box-sizing: border-box;
}

/* 弹层打开时锁定背景滚动 */
.va-scroll-locked .va-h5-content,
.va-scroll-locked .va-content,
.va-scroll-locked .va-page {
  overflow: hidden !important;
}

/* ==================== 3. 动画关键帧 ==================== */

/* 涟漪波纹 */
@keyframes va-ripple {
  0% {
    transform: scale(0);
    opacity: 0.4;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* 渐入 */
@keyframes va-fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* 渐出 */
@keyframes va-fade-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* 从下滑入 */
@keyframes va-slide-up {
  0% {
    transform: translate3d(0, 100%, 0);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

/* 从下滑出 */
@keyframes va-slide-down-out {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 100%, 0);
    opacity: 0;
  }
}

/* 从右滑入 */
@keyframes va-slide-right {
  0% {
    transform: translate3d(100%, 0, 0);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

/* 缩放弹入 */
@keyframes va-zoom-in {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 缩放弹出 */
@keyframes va-zoom-out {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0;
  }
}

/* Modal弹入（含居中修正） */
@keyframes va-modal-in {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translate3d(-50%, -50%, 0) scale(1);
    opacity: 1;
  }
}

/* Modal弹出（含居中修正） */
@keyframes va-modal-out {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(-50%, -50%, 0) scale(0.8);
    opacity: 0;
  }
}

/* 微弹缩放（按钮按下反馈） */
@keyframes va-press {
  0% { transform: scale(1); }
  50% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

/* Toast 提示 */
@keyframes va-toast-in {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translate3d(-50%, -50%, 0) scale(1);
    opacity: 1;
  }
}

/* 旋转 loading */
@keyframes va-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==================== 4. 通用工具类 ==================== */

/* 涟漪容器 */
.va-ripple-container {
  position: relative;
  overflow: hidden;
}

.va-ripple-container .va-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: va-ripple 0.5s ease-out;
  pointer-events: none;
}

/* 深色涟漪（白底按钮用） */
.va-ripple-dark .va-ripple {
  background: rgba(0, 0, 0, 0.08);
}

/* 安全区域 */
.va-safe-top {
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
}

.va-safe-bottom {
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

/* 文本省略 */
.va-ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.va-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 不可选择 */
.va-no-select {
  -webkit-user-select: none;
  user-select: none;
}

/* 禁用态 */
.va-disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* 清除浮动 */
.va-clearfix::after {
  content: '';
  display: table;
  clear: both;
}
