/* =====================================================
   Trading Platform - Light Theme Global Styles
   Primary: #0166FC | Rise: #0166FC | Fall: #F23C48
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: #1A222B;
  background: #F8F8F8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  justify-content: center;
  background: #F0F0F0;
}

/* ===== Page Container ===== */
.page {
  width: 100%;
    min-height: 100vh;
  background: #F8F8F8;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 68px;
}

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFFFFF;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #EEEEEE;
  flex-shrink: 0;
}
.navbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #1A222B;
}
.navbar-back {
  position: absolute;
  left: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.navbar-back svg { width: 20px; height: 20px; fill: #1A222B; }

/* ===== Bottom Tabbar ===== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 60px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  box-shadow: 0 -1px 0 #EEEEEE, 0 -4px 16px rgba(0,0,0,0.06);
  z-index: 200;
  padding: 0;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  color: #9B9B9B;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.2s;
}
.tab-item svg { width: 22px; height: 22px; fill: #9B9B9B; transition: fill 0.2s; }
.tab-item.active { color: #0166FC; }
.tab-item.active svg { fill: #0166FC; }
.tab-item-icon-wrap {
  width: 42px; height: 42px;
  background: #E8F0FF;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.tab-item.active .tab-item-icon-wrap { background: #0166FC; }
.tab-item.active .tab-item-icon-wrap svg { fill: #fff; }
.tab-item-icon-wrap svg { fill: #0166FC; }
.tab-trade-btn {
  width: 56px; height: 56px;
  background: #0166FC;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(1,102,252,0.4);
  margin-bottom: 18px;
}
.tab-trade-btn svg { fill: #fff; width: 28px; height: 28px; }
.tab-item.trade-center { justify-content: flex-end; padding-bottom: 4px; }

/* ===== Cards ===== */
.card {
  background: #FFFFFF;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* ===== Inputs ===== */
.input-group {
  margin-bottom: 14px;
}
.input-label {
  font-size: 13px;
  color: #9B9B9B;
  margin-bottom: 6px;
  display: block;
}
.input-field {
  width: 100%;
  height: 48px;
  background: #F8F8F8;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 15px;
  color: #1A222B;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.input-field::placeholder { color: #CBCBCB; }
.input-field:focus { border-color: #0166FC; background: #FFF; }

/* ===== Buttons ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s, transform 0.1s;
  outline: none;
}
.btn:active { opacity: 0.85; transform: scale(0.98); }
.btn-primary { background: #0166FC; color: #FFFFFF; }
.btn-danger { background: #F23C48; color: #FFFFFF; }
.btn-outline-primary { background: transparent; color: #0166FC; border: 1.5px solid #0166FC; }
.btn-outline-danger { background: transparent; color: #F23C48; border: 1.5px solid #F23C48; }
.btn-sm { height: 36px; font-size: 13px; border-radius: 18px; }
.btn-ghost { background: transparent; color: #9B9B9B; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Tags / Badges ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-rise { background: #0166FC; color: #FFFFFF; }
.tag-fall { background: #F23C48; color: #FFFFFF; }
.tag-gray { background: #F0F0F0; color: #9B9B9B; }

/* ===== Text Colors ===== */
.text-primary { color: #1A222B; }
.text-secondary { color: #9B9B9B; }
.text-muted { color: #CBCBCB; }
.text-rise { color: #0166FC; }
.text-fall { color: #F23C48; }
.text-blue { color: #0166FC; }
.text-red { color: #F23C48; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.fw-500 { font-weight: 500; }

/* ===== Divider ===== */
.divider { height: 1px; background: #EEEEEE; }
.section-gap { height: 8px; background: #F8F8F8; }

/* ===== Toast ===== */
#toast {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #FFFFFF;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  display: none;
  white-space: nowrap;
  max-width: 80%;
  text-align: center;
  pointer-events: none;
}

/* ===== Modal / Sheet ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-mask.show { display: flex; }
.modal-sheet {
  width: 100%;
    background: #FFFFFF;
  border-radius: 16px 16px 0 0;
  padding: 0 0 32px;
  animation: slideUp 0.28s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: #EEEEEE;
  border-radius: 2px;
  margin: 12px auto 16px;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #1A222B;
  text-align: center;
  padding: 0 16px 12px;
  border-bottom: 1px solid #EEEEEE;
}
.modal-body { padding: 16px; }

/* ===== Market Row ===== */
.market-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #FFFFFF;
  border-bottom: 1px solid #EEEEEE;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,0.04);
  transition: background 0.15s;
}
.market-row:active { background: #F8F8F8; }
.market-left { flex: 1.4; min-width: 0; }
.market-mid { flex: 1; display: flex; align-items: center; justify-content: center; }
.market-right { flex: 1.1; text-align: right; }
.market-name { font-size: 15px; font-weight: 600; color: #1A222B; margin-bottom: 2px; }
.market-code { font-size: 11px; color: #9B9B9B; }
.market-price { font-size: 15px; font-weight: 600; margin-bottom: 3px; }

/* ===== Banner ===== */
.banner-wrap {
  margin: 12px 12px 0;
  border-radius: 12px;
  overflow: hidden;
  height: 120px;
  background: linear-gradient(90deg, #207AFF, #015FEB);
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 20px;
}
.banner-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.banner-text {
  position: relative;
  z-index: 1;
  color: #FFFFFF;
}
.banner-text h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.banner-text p { font-size: 12px; opacity: 0.85; }

/* ===== Section Header ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: #FFFFFF;
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: #1A222B;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title::before {
  content: '';
  width: 3px;
  height: 15px;
  background: #0166FC;
  border-radius: 2px;
}
.section-more { font-size: 12px; color: #9B9B9B; }

/* ===== Table Header ===== */
.table-header {
  display: flex;
  padding: 6px 16px;
  background: #F8F8F8;
  border-bottom: 1px solid #EEEEEE;
}
.th { font-size: 11px; color: #9B9B9B; flex: 1; }
.th:nth-child(2) { text-align: center; }
.th:last-child { text-align: right; }

/* ===== Notice Bar ===== */
.notice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #FFFFFF;
  border-bottom: 1px solid #EEEEEE;
  cursor: pointer;
}
.notice-bar svg { width: 16px; height: 16px; flex-shrink: 0; fill: #FFB300; }
.notice-scroll { flex: 1; overflow: hidden; height: 18px; position: relative; }
.notice-text {
  font-size: 12px;
  color: #9B9B9B;
  white-space: nowrap;
  animation: scrollText 20s linear infinite;
  position: absolute;
}
@keyframes scrollText { 0%{transform:translateX(100%)} 100%{transform:translateX(-200%)} }

/* ===== User Cell ===== */
.user-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #FFFFFF;
  border-bottom: 1px solid #EEEEEE;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.user-cell:active { background: #F8F8F8; }
.user-cell-left { display: flex; align-items: center; gap: 12px; }
.user-cell-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #EEF4FF;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-cell-icon svg { width: 18px; height: 18px; fill: #0166FC; }
.user-cell-label { font-size: 14px; color: #1A222B; }
.user-cell-arrow { color: #CBCBCB; font-size: 18px; }

/* ===== Loading ===== */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  gap: 12px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #EEEEEE;
  border-top-color: #0166FC;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  gap: 12px;
  color: #9B9B9B;
  font-size: 13px;
}
.empty-state svg { width: 48px; height: 48px; fill: #EEEEEE; }

/* ===== Form Page ===== */
.form-page {
  background: #FFFFFF;
  min-height: 100vh;
  padding: 0 24px;
}
.form-logo {
  text-align: center;
  padding: 48px 0 32px;
}
.form-logo img { width: 72px; height: 72px; border-radius: 16px; }
.form-logo-name { font-size: 22px; font-weight: 700; color: #1A222B; margin-top: 12px; }

/* ===== Tab Switch (Buy/Sell) ===== */
.trade-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.trade-tab {
  flex: 1;
  height: 42px;
  border-radius: 8px;
  border: 1.5px solid #0166FC;
  background: transparent;
  color: #0166FC;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.trade-tab.buy.active { background: #0166FC; color: #FFFFFF; border-color: #0166FC; }
.trade-tab.sell { border-color: #F23C48; color: #F23C48; }
.trade-tab.sell.active { background: #F23C48; color: #FFFFFF; border-color: #F23C48; }

/* ===== Amount Presets ===== */
.preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.preset-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #EEEEEE;
  background: #F8F8F8;
  color: #1A222B;
  font-size: 13px;
  cursor: pointer;
}
.preset-btn.active { border-color: #0166FC; color: #0166FC; background: #EEF4FF; }

/* ===== Tabs (Segment) ===== */
.seg-tabs {
  display: flex;
  background: #F8F8F8;
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 14px;
}
.seg-tab {
  flex: 1;
  height: 34px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #9B9B9B;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.seg-tab.active { background: #FFFFFF; color: #1A222B; font-weight: 600; box-shadow: 0 1px 6px rgba(0,0,0,0.08); }

/* ===== Util ===== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.p-16 { padding: 16px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-24 { font-size: 24px; }

/* ===== Order / Record Item ===== */
.record-item {
  background: #FFFFFF;
  margin: 8px 12px;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.record-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.record-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #9B9B9B;
  margin-top: 4px;
}

/* ===== Avatar ===== */
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 32px;
  background: #EEF4FF;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 32px; height: 32px; fill: #0166FC; }

/* ===== Status Badge ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.status-pending { background: #FFF8E6; color: #FFB300; }
.status-done { background: #E8F5FF; color: #0166FC; }
.status-fail { background: #FFF0F0; color: #F23C48; }
