/* ============================================================
   ONBOARDING.CSS — shared base + auth/onboarding-only styles
   Split from styles.css for the auth.tradebook.com.ng / root
   onboarding project. Pairs with onboarding.html + auth.js.
============================================================ */

:root {
  --bg: #ffffff;
  --panel: #f7f7f7;
  --panel-alt: #efefef;
  --border: #e2e2e2;
  --border-light: #cfcfcf;
  --text: #111111;
  --text-dim: #5a5a5a;
  --text-faint: #9a9a9a;
  --sell: #c6392a;
  --win: #2e9e5b;
  --accent: #111111;
  --accent-contrast: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(17, 17, 17, 0.14);
  --glass-shadow: rgba(17, 17, 17, 0.14);
}

[data-theme="dark"] {
  --bg: #0b0f14;
  --panel: #151b23;
  --panel-alt: #1b222c;
  --border: #262f3b;
  --border-light: #333e4c;
  --text: #eceff3;
  --text-dim: #9aa5b1;
  --text-faint: #5b6572;
  --sell: #e0574a;
  --win: #3ddc84;
  --accent: #ffffff;
  --accent-contrast: #111111;
  --glass-bg: rgba(21, 27, 35, 0.55);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  transition:
    background 0.2s,
    color 0.2s;
}

.display {
  font-family: "Bebas Neue", "Inter", sans-serif;
  letter-spacing: 0.5px;
}

/* Every tab's first element gets the same breathing room below
         the header, regardless of whether it's plain text (greeting),
         buttons (subtabs), or a bordered card (perf/settings blocks). */

.btn-row .btn-primary,
.btn-row .btn-outline {
  width: auto;
  flex: 1;
}

.mood-tag-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 10px;
  padding: 12px 0;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary:hover {
  opacity: 0.85;
}

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

.subtab-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

/* ---------- closed trades: tap to reveal edit dropdown ---------- */

/* ---------- TP/SL quick-close chooser (close-trade modal) ---------- */

.tpsl-choice-btn.active.tpsl-choice-sl {
  background: var(--sell);
  color: #fff;
  border-color: var(--sell);
}

.tpsl-choice-btn.active.tpsl-choice-tp {
  background: var(--win);
  color: #fff;
  border-color: var(--win);
}

.tpsl-slider-preview.hidden {
  display: none;
}

/* ---------- ongoing trades: layout density toggle (desktop) ---------- */

@media (max-width: 899px) {
  .layout-toggle-btn {
    display: none;
  }
}

@media (min-width: 900px) {
  .ongoing-list.compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }
  .ongoing-list.compact .swipe-wrap {
    margin-bottom: 0;
  }
}

/* ---------- swipe-to-reveal (mobile ongoing trades) ---------- */

/* Closed trades: single edit action, one-time use only. */

/* ---------- pair picker popup ---------- */

/* ---------- inline pair dropdown (attached directly under the field) ---------- */

.pair-dropdown.hidden {
  display: none;
}

/* ---------- pre-trade checklist ---------- */

/* ---------- performance visual chart ---------- */

.range-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.nav-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.auth-screen,
.setup-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card,
.setup-card {
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 32px;
  width: 340px;
  max-width: 100%;
}

.setup-eyebrow,
.auth-eyebrow {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.setup-title,
.auth-title {
  margin: 0 0 8px;
  font-size: 30px;
}

.setup-desc,
.auth-desc {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 20px;
  line-height: 1.5;
}

.auth-error {
  color: var(--sell);
  font-size: 12px;
  margin: -4px 0 12px;
  min-height: 14px;
}

.auth-tab-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.field {
  margin-bottom: 12px;
}

.field-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 5px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.field-input,
select.field-input,
textarea.field-input {
  width: 100%;
  background: var(--panel-alt);
  border: 1px solid var(--border-light);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 14px;
  font-family: "Inter", sans-serif;
}

textarea.field-input {
  min-height: 60px;
  resize: vertical;
}

.dir-btn.dir-buy.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.dir-btn.dir-sell.active {
  background: var(--sell);
  color: #fff;
}

.risk-mode-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-overlay .modal-box {
    animation: none;
  }
}

.modal-overlay.hidden {
  display: none;
}

.settings-row .field {
  flex: 1;
  margin-bottom: 0;
}

.hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
  line-height: 1.4;
}

.profile-dropdown.hidden {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .profile-dropdown {
    animation: none;
  }
}

.theme-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

/* ---------- toast feedback ---------- */

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
  .toast.toast-out {
    animation: none;
    display: none;
  }
}

/* ---------- tactile press feedback ---------- */

.btn-primary,
.btn-outline,
.btn-danger,
.btn-small,
.btn-icon-small,
.nav-btn,
.subtab-btn,
.range-btn,
.dir-btn,
.theme-btn {
  transition:
    transform 0.08s ease,
    opacity 0.15s,
    background 0.15s;
}

.btn-primary:active:not(:disabled),
.btn-outline:active:not(:disabled),
.btn-danger:active:not(:disabled),
.btn-small:active:not(:disabled),
.close-trade-cta:active {
  transform: scale(0.97);
}

@media (hover: hover) {
  .card,
  .stat-card,
  .closed-row,
  .perf-row {
    transition:
      border-color 0.15s,
      transform 0.15s;
  }
  .card:hover,
  .closed-row:hover {
    border-color: var(--border-light);
  }
}

/* ---------- welcome tour ---------- */

#tourLayer.active {
  display: block;
}

.tour-dot.active {
  background: var(--accent);
}

/* No spinner arrows on any number input, anywhere */

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* No visible scrollbar on the modal or main content — still scrolls, just not shown */

/* ---------- Desktop (≥900px) ---------- */

@media (min-width: 900px) {
  .app-shell {
    max-width: 1320px;
    border: none;
  }
  .topbar {
    left: 240px;
    right: 0;
    max-width: none;
    width: auto;
    padding: 22px 44px;
  }
  .bottomnav {
    top: 0;
    left: 0;
    bottom: 0;
    transform: none;
    width: 240px;
    max-width: 240px;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 6px;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    background: var(--panel);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    padding: 92px 14px 24px;
  }
  .bottomnav::before {
    content: "TRADEBOOK";
    position: absolute;
    top: 26px;
    left: 18px;
    font-family: "Bebas Neue", "Inter", sans-serif;
    font-size: 19px;
    letter-spacing: 1px;
    color: var(--text);
  }
  .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 8px;
  }
  .nav-btn svg {
    width: 18px;
    height: 18px;
  }
  .nav-label {
    font-size: 13px;
  }
  .content {
    margin-left: 240px;
    padding: 100px 48px 60px;
    max-width: 1040px;
  }
  .topbar .brand-label {
    display: none;
  }
  .topbar {
    justify-content: flex-end;
  }
  .auth-screen,
  .setup-screen {
    padding: 24px;
  }
  .swipe-actions {
    display: none;
  }
  .card-actions {
    display: flex;
  }
  .home-header-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
  }
  .home-header-row .greeting {
    margin-bottom: 0;
  }
  .home-actions-col {
    width: auto;
  }
  .home-actions-col .btn-row {
    margin-bottom: 0;
  }
  .home-actions-col .btn-primary,
  .home-actions-col .btn-outline {
    padding: 8px 18px;
    font-size: 12px;
    white-space: nowrap;
  }
  .home-actions-col .btn-primary svg,
  .home-actions-col .btn-outline svg {
    width: 13px !important;
    height: 13px !important;
  }
  .home-stat-row {
    flex-wrap: nowrap;
  }
}

@media (max-width: 899px) {
  .card-actions {
    display: none;
  }
}

/* ============================================================
   TRADE MODALS — Add / Edit / Close / Edit closed / Add closed
   Scoped visual pass only. No calculation logic lives here or
   is affected by it — see script.js for that.
============================================================ */

:root {
  --risk-accent: #d9a02a;
}

.trade-modal .field {
  margin-bottom: 16px;
}

.trade-modal .field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.trade-modal .field-input,
.trade-modal select.field-input,
.trade-modal textarea.field-input {
  padding: 12px 13px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
}

/* Risk field — Add Trade modal only. The input + %/$ toggle are the
   real, always-present controls (script.js keeps reading/writing
   #f_risk regardless of what's visible). When syncRiskFromLot() can
   estimate risk from the lot size, it adds .locked to #f_riskField;
   this pass just hides the box in that state and shows the combined
   $/% readout instead. When it can't estimate (crypto, indices, no
   live rate), .locked is removed and the input + toggle reappear so
   the trader can still type a risk value by hand. */

.trade-modal .risk-input-row .field-input#f_risk {
  flex: 1 1 auto;
  min-width: 0;
}

.trade-modal .hint {
  line-height: 1.5;
}

.trade-modal .btn-primary {
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
}

/* ============================================================
   MOOD TAGS — chips on closed-trade rows + the Mood patterns
   insight card on Performance. Monochrome; win/sell only used
   for the win-rate readout, not the chip itself.
============================================================ */

/* ============================================================
   STREAK CARD — Home tab. Consecutive win/loss streak + days
   since last logged trade. A habit signal, so it sits above the
   weekly recap where it's seen on every app open.
============================================================ */

/* ============================================================
   PERFORMANCE CALENDAR — day-by-day P&L heatmap on the
   Performance tab. Intensity via color-mix() on --win/--sell so
   it stays inside the existing two-color system, no new hues.
============================================================ */

/* ---- onboarding/auth-only rules ---- */

.btn-link {
  background: none;
  border: none;
  color: var(--text-dim);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.auth-info {
  color: var(--text-dim);
  font-size: 12px;
  margin: -4px 0 12px;
  min-height: 14px;
}

.auth-tabs {
  display: flex;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.auth-tab-btn {
  flex: 1;
  padding: 9px 0;
  background: var(--panel-alt);
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.password-field-wrap {
  position: relative;
}

.password-field-wrap input {
  padding-right: 38px;
}

.pw-eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
  display: flex;
  align-items: center;
}

.pw-eye-btn svg {
  width: 17px;
  height: 17px;
}

.pw-strength-meter {
  height: 4px;
  border-radius: 3px;
  background: var(--panel-alt);
  margin-top: 7px;
  overflow: hidden;
}

.pw-strength-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--sell);
  transition:
    width 0.2s,
    background 0.2s;
}

.pw-strength-label {
  font-size: 11px;
  margin-top: 5px;
  color: var(--text-faint);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 0;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-google:hover {
  background: var(--panel);
}

.btn-google svg {
  width: 17px;
  height: 17px;
}
