/* ================================================================
   mobile/css/common.css — 智能报销助手 移动端 H5 公共样式
   ================================================================ */

/* -------------------- CSS Variables -------------------- */
:root {
  --primary: #667eea;
  --primary-dark: #764ba2;
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --success: #0f9b8e;
  --success-light: #0ab595;
  --success-gradient: linear-gradient(145deg, #0f9b8e 0%, #0ab595 100%);
  --bg: #f5f6fa;
  --bg-white: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-light: #bbbbbb;
  --card-bg: #f8f9fc;
  --border: #e8eaef;
  --border-light: #f0f0f0;
  --danger: #e04848;
  --warning: #f0a020;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 32px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.03);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.15);
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

/* -------------------- Reset & Base -------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: #f0f2f5;
  display: flex;
  justify-content: center;
  padding: 20px;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

/* -------------------- Phone Container -------------------- */
.phone {
  width: 375px;
  min-height: 100vh;
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
}

.phone.bg-gray {
  background: var(--bg);
}

/* -------------------- Status Bar -------------------- */
.status-bar {
  height: 44px;
  background: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-size: 12px;
  color: #333;
  flex-shrink: 0;
}

.phone.bg-gray .status-bar {
  background: var(--bg);
}

/* -------------------- Navigation Bar -------------------- */
.nav {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-white);
}

.phone.bg-gray .nav {
  background: var(--bg);
}

.nav .back {
  font-size: 20px;
  color: #333;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.nav .title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.nav .right-btn {
  font-size: 13px;
  color: var(--success);
  cursor: pointer;
  font-weight: 500;
  flex-shrink: 0;
}

/* -------------------- Buttons -------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  border: none;
  transition: opacity 0.2s, transform 0.15s;
  font-family: inherit;
  line-height: 1.2;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(102,126,234,0.35);
}

.btn-success {
  background: var(--success-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(15,155,142,0.25);
}

.btn-outline {
  background: #fff;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-draft {
  background: #f0f0f0;
  color: var(--text-secondary);
}

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

/* -------------------- Form Inputs -------------------- */
.input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-size: 15px;
  color: #333;
  background: #fafbfc;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.input:focus {
  border-color: var(--primary);
  background: #fff;
}

.input.success-color:focus {
  border-color: var(--success);
}

.textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: #333;
  background: #fafbfc;
  min-height: 70px;
  resize: none;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.form-label .required {
  color: var(--danger);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* -------------------- Card -------------------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card.card-hover:active {
  background: #f8f9fc;
}

/* -------------------- Tag / Badge -------------------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.tag-green {
  background: #e6f7f5;
  color: var(--success);
}

.tag-yellow {
  background: #fef8e7;
  color: #b0780a;
}

.tag-red {
  background: #fde8e8;
  color: #c0392b;
}

.tag-gray {
  background: #f0f0f0;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary {
  background: rgba(102,126,234,0.12);
  color: var(--primary);
}

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

.badge-warning {
  background: #fef8e7;
  color: #b0780a;
}

.badge-danger {
  background: #fde8e8;
  color: var(--danger);
}

/* -------------------- Status Dot -------------------- */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.dot-green { background: var(--success-light); }
.dot-yellow { background: var(--warning); }
.dot-red { background: var(--danger); }
.dot-gray { background: #ccc; }

/* -------------------- Toast -------------------- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  color: #fff;
  z-index: 9999;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  box-shadow: var(--shadow);
  white-space: nowrap;
  max-width: 90vw;
}

.toast-success { background: var(--success-gradient); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary-gradient); }

#toast-container {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* -------------------- Loading -------------------- */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading-spinner .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.loading-overlay .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* -------------------- Empty State -------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state .empty-text {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.empty-state .empty-hint {
  font-size: 12px;
  color: #ccc;
}

/* -------------------- Bottom TabBar -------------------- */
.tabbar {
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  transition: color 0.2s;
  text-decoration: none;
  gap: 2px;
}

.tabbar .tab .tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tabbar .tab.active {
  color: var(--primary);
}

.tabbar .tab.active .tab-icon {
  color: var(--primary);
}

/* -------------------- Section Title -------------------- */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 12px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title .more {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  cursor: pointer;
}

/* -------------------- Divider -------------------- */
.divider-text {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.divider-text .line {
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.divider-text .text {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
}

/* -------------------- Scrollbar -------------------- */
.phone ::-webkit-scrollbar {
  width: 4px;
}

.phone ::-webkit-scrollbar-track {
  background: transparent;
}

.phone ::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

/* -------------------- Utility -------------------- */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }

/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.25s ease;
}

/* Slide-up animation */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-up {
  animation: slideUp 0.35s ease;
}
