/* AtlasFX - Professional dark trading platform theme (Binomo/MT5 style) */

:root {
  --bg: #0B0E14;
  --surface: #131722;
  --surface2: #1A202E;
  --border: #232A3B;
  --text: #E6EAF2;
  --muted: #8A94A6;
  --up: #00C076;
  --down: #F6465D;
  --primary: #2962FF;
  --gold: #F0B90B;
  --shadow: 0 4px 16px rgba(0,0,0,.4);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

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

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Inline SVG default styling */
svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

/* Global focus state */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

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

/* Numeric color helpers */
.pos { color: var(--up); }
.neg { color: var(--down); }
.zero { color: var(--muted); }

/* ===== Login Screen ===== */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 20%, #131722, #0B0E14 70%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
}

.login-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
  text-align: center;
  margin-bottom: 24px;
}

.login-email,
.login-password {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 12px;
}

.login-email::placeholder,
.login-password::placeholder {
  color: var(--muted);
}

.login-email:focus,
.login-password:focus {
  border-color: var(--primary);
  outline: none;
}

.btn-login,
.btn-demo {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: 150ms ease;
}

.btn-login:hover,
.btn-demo:hover {
  filter: brightness(1.08);
}

.btn-login:active,
.btn-demo:active {
  transform: scale(.97);
}

.btn-demo {
  background: transparent;
  border: 1px solid var(--border);
  margin-top: 10px;
  color: var(--text);
}

.btn-show-register {
  display: block;
  margin-top: 18px;
  margin-left: auto;
  margin-right: auto;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
}

.login-error {
  background: rgba(246,70,93,.12);
  border: 1px solid rgba(246,70,93,.4);
  color: var(--down);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ===== App Shell & Topbar ===== */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(11,14,20,.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.acc-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: 150ms ease;
}

.acc-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pill-demo.active { color: var(--gold); }
.pill-real.active { color: var(--up); }

.balance-box {
  text-align: right;
}

.balance-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.balance-value {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
}

.avatar-menu {
  position: relative;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.btn-deposit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--up);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 150ms ease;
}

.btn-deposit:hover {
  filter: brightness(1.08);
}

.btn-deposit:active {
  transform: scale(.97);
}

/* ===== Desktop Layout ===== */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  height: calc(100dvh - 60px);
  overflow: hidden;
}

.asset-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
}

.chart-area {
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-x: hidden;
  overflow-y: hidden;
  background: var(--bg);
  min-width: 0;
}

.trade-panel {
  border-left: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  padding: 16px;
}

/* ===== Asset Sidebar ===== */
.asset-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.asset-search input {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}

.asset-search input:focus {
  outline: none;
  border-color: var(--primary);
}

.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  overflow: visible;
}

.cat-tab {
  padding: 5px 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: 150ms ease;
}

.cat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.asset-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Asset row */
.asset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: 150ms ease;
}

.asset-row:hover {
  background: var(--surface2);
}

.asset-row.active {
  background: #1A202E;
  border-left: 3px solid var(--primary);
}

.asset-sym {
  font-size: 14px;
  font-weight: 700;
}

.asset-name {
  font-size: 11px;
  color: var(--muted);
}

.asset-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.asset-price {
  font-size: 13px;
  font-weight: 600;
}

.asset-chg {
  font-size: 12px;
  font-weight: 600;
}

/* ===== Chart Area ===== */
.asset-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chart-asset-name {
  font-size: 18px;
  font-weight: 700;
}

.chart-asset-cat {
  font-size: 12px;
  color: var(--muted);
}

.chart-price {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.chart-change {
  font-size: 14px;
  font-weight: 600;
}

.tf-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 14px 0;
  overflow: visible;
  padding-bottom: 2px;
}

.tf-tab {
  padding: 6px 12px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: 150ms ease;
}

.tf-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.chart-canvas {
  width: 100%;
  flex: 1;
  min-height: 380px;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.chart-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

.chart-spread .value,
.chart-payout .value {
  color: var(--text);
  font-weight: 600;
}

.chart-payout .value {
  color: var(--up);
}

/* ===== Trade Panel ===== */
.trade-panel h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
}

.trade-amount {
  margin-bottom: 18px;
}

.qty-btn,
.exp-chip {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 150ms ease;
}

.qty-btn:hover,
.exp-chip:hover {
  border-color: var(--primary);
}

.qty-btn.active,
.exp-chip.active {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}

.expiry-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trade-btns {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-up,
.btn-down {
  flex: 1;
  height: 56px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: 150ms ease;
}

.btn-up {
  background: var(--up);
}

.btn-down {
  background: var(--down);
}

.btn-up:hover,
.btn-down:hover {
  filter: brightness(1.08);
}

.btn-up:active,
.btn-down:active {
  transform: scale(.97);
}

.payout-up,
.payout-down {
  opacity: .85;
  font-size: 13px;
  font-weight: 600;
}

/* ===== Active Trade ===== */
.active-trade {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.at-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.at-asset {
  font-size: 14px;
  font-weight: 700;
}

.at-amount {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.at-dir {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.at-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0 8px;
}

.at-progress-bar {
  height: 100%;
  background: var(--primary);
  width: 0;
  transition: width 250ms linear;
}

.at-countdown {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.at-entry {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ===== Bottom Navigation (Mobile) ===== */
.bottom-nav {
  display: none;
}

/* ===== Views ===== */
.view {
  display: none;
  padding: 16px;
  padding-bottom: 24px;
}

.view.active {
  display: block;
}

/* ===== Stat Cards ===== */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
}

.stat-total .stat-value { color: var(--text); }
.stat-winrate .stat-value { color: var(--primary); }
.stat-profit .stat-value { color: var(--up); }
.stat-active .stat-value { color: var(--gold); }

/* ===== History ===== */
.hist-filters {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.hf-tab {
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: 150ms ease;
}

.hf-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.history-list {
  display: grid;
  grid-template-columns: 110px 1fr 70px 90px 80px 80px 100px;
  gap: 8px;
  align-items: center;
}

.h-row {
  display: contents;
}

.h-row > span {
  padding: 10px 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
}

.h-head > span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

/* ===== Profile ===== */
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
}

.profile-email {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.profile-since {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.profile-bal-demo,
.profile-bal-real {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 14px;
}

.profile-bal-demo .bal-label,
.profile-bal-real .bal-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.profile-bal-demo .bal-val { color: var(--gold); }
.profile-bal-real .bal-val { color: var(--up); }

.profile-bal-val {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
}

.profile-stats {
  margin-top: 20px;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.btn-deposit-2,
.btn-withdraw {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 150ms ease;
}

.btn-deposit-2 {
  background: var(--primary);
  color: #fff;
  border: none;
}

.btn-deposit-2:hover {
  filter: brightness(1.08);
}

.btn-withdraw {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-withdraw:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-logout {
  background: transparent;
  color: var(--down);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 150ms ease;
}

.btn-logout:hover {
  border-color: var(--down);
}

.version {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: modalIn 200ms ease;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
}

.method-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: 150ms ease;
}

.method-opt.active {
  border-color: var(--primary);
  background: var(--surface2);
}

.deposit-amount,
.withdraw-amount,
.reg-name,
.reg-email,
.reg-pass {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 12px;
}

.deposit-amount:focus,
.withdraw-amount:focus,
.reg-name:focus,
.reg-email:focus,
.reg-pass:focus {
  border-color: var(--primary);
  outline: none;
}

.btn-deposit-confirm,
.btn-withdraw-confirm,
.btn-register {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: 150ms ease;
}

.btn-deposit-confirm:hover,
.btn-withdraw-confirm:hover,
.btn-register:hover {
  filter: brightness(1.08);
}

.btn-deposit-confirm:active,
.btn-withdraw-confirm:active,
.btn-register:active {
  transform: scale(.97);
}

/* ===== Modal Result ===== */
.modal-result {
  text-align: center;
}

.result-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-icon.win {
  background: rgba(0,192,118,.15);
  color: var(--up);
}

.result-icon.lose {
  background: rgba(246,70,93,.15);
  color: var(--down);
}

.result-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.btn-result-close {
  padding: 12px 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 150ms ease;
}

.btn-result-close:hover {
  filter: brightness(1.08);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast {
  max-width: 320px;
  width: 100%;
  background: var(--surface2);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  animation: toastIn 200ms ease;
}

.toast.success { border-left-color: var(--up); }
.toast.error { border-left-color: var(--down); }
.toast.info { border-left-color: var(--primary); }

/* ===== Badges & Hints ===== */
.badge-up,
.badge-down,
.badge-open {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge-up {
  background: rgba(0,192,118,.15);
  color: var(--up);
}

.badge-down {
  background: rgba(246,70,93,.15);
  color: var(--down);
}

.badge-open {
  background: rgba(41,98,255,.15);
  color: var(--primary);
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

/* ===== Responsive: Mobile (<768px) ===== */
@media (max-width: 767px) {
  body {
    padding-bottom: 70px;
  }

  .layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .asset-sidebar {
    display: none;
  }

  .chart-area {
    order: 1;
  }

  .trade-panel {
    order: 2;
  }

  .chart-canvas {
    min-height: 300px;
  }

  .tf-tabs {
    order: 3;
  }

  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-list {
    display: block;
  }

  .h-row {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
  }

  .h-row > span {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
  }

  .h-head {
    display: none;
  }

  /* Bottom navigation */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
  }

  .nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    transition: 150ms ease;
  }

  .nav-btn.active {
    color: var(--primary);
  }
}
/* END */
