/* 店铺财务系统 v4 - 自定义样式 */
/* ==================== 基础 ==================== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

/* 数字等宽，避免跳动 */
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ==================== 输入框 ==================== */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* iOS 自动缩放修复 */
input, select, textarea { font-size: 16px; }

/* ==================== 动画 ==================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.fade-in { animation: fadeIn 0.25s ease-out; }
.fade-in-up { animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }

#tabContent > div { animation: fadeInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1); }

/* ==================== 卡片 ==================== */
.stat-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ==================== 模态框 ==================== */
#passwordModal, #userMgmtModal, #detailModal {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

#passwordModal > div, #userMgmtModal > div, #detailModal > div {
  animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==================== Tab Bar (移动端) ==================== */
.m-tab {
  -webkit-tap-highlight-color: transparent;
}
.m-tab:active {
  transform: scale(0.95);
}
.m-tab.active-mobile {
  color: #6366f1;
}

/* ==================== 渐变背景 ==================== */
.gradient-bg {
  background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 50%, #fef3c7 100%);
  background-attachment: fixed;
}

.gradient-mesh {
  background:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
}

/* ==================== 加载状态 ==================== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 0px, #e2e8f0 40px, #f1f5f9 80px);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

.spinner {
  border: 2px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
}

/* ==================== Toast ==================== */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 0.5rem;
}

/* ==================== 触屏优化 ==================== */
@media (hover: none) and (pointer: coarse) {
  /* 移动端：按钮增加反馈 */
  button:active:not(:disabled) {
    transform: scale(0.97);
    transition: transform 0.1s;
  }
}

/* ==================== 响应式细节 ==================== */
@media (max-width: 767px) {
  /* 移动端：减少内边距 */
  .container { padding-left: 0.75rem; padding-right: 0.75rem; }
  /* 表单行在移动端垂直堆叠 */
  .entry-row { grid-template-columns: 1fr !important; gap: 0.5rem !important; }
  .entry-row > * { width: 100% !important; }
}

/* 平板及以上 */
@media (min-width: 768px) {
  .entry-row { gap: 0.25rem !important; }
}

/* ==================== 隐藏滚动条但保留滚动 ==================== */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { scrollbar-width: none; -ms-overflow-style: none; }

/* ==================== 暗色模式预留（暂不启用） ==================== */
/* @media (prefers-color-scheme: dark) { ... } */

/* ==================== 实用 ==================== */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}

.transition-fast { transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1); }
.transition-base { transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1); }

/* 防止 iOS 橡皮筋效果影响模态框 */
.modal-scroll {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* 数字输入框右侧箭头提示 */
.amount-input {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1.05rem;
}