/* Final visual authority for navigation, Trades controls and mobile appearance. */

.builder-header .builder-brand > div:not(.builder-logo) {
  display: none !important;
}

/* Keep Dashboard/Trades readable and tactile in both themes. */
.builder-header .builder-nav {
  gap: 7px !important;
}

.builder-header .builder-nav [data-view] {
  min-height: 38px !important;
  padding: 0 16px !important;
  border: 1px solid var(--line) !important;
  border-radius: 11px !important;
  font-weight: 820 !important;
  letter-spacing: .01em !important;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease !important;
}

html[data-theme="dark"] .builder-header .builder-nav [data-view] {
  color: #dbeafe !important;
  background: linear-gradient(155deg, rgba(15, 23, 42, .92), rgba(5, 10, 20, .96)) !important;
}

html[data-theme="light"] .builder-header .builder-nav [data-view] {
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
  background: linear-gradient(155deg, rgba(255, 255, 255, .98), rgba(241, 245, 249, .96)) !important;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .07) !important;
}

.builder-header .builder-nav [data-view]:hover {
  transform: translateY(-1px) !important;
  border-color: rgba(59, 130, 246, .58) !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, .13) !important;
}

.builder-header .builder-nav [data-view].active {
  color: #fff !important;
  border-color: rgba(96, 165, 250, .78) !important;
  background: linear-gradient(135deg, #1d4ed8, #2563eb 54%, #3b82f6) !important;
  box-shadow: 0 10px 28px rgba(37, 99, 235, .25), inset 0 1px 0 rgba(255, 255, 255, .18) !important;
}

/* Exact alignment for Result heading and values. */
.foa-trades-table .trade-head > :last-child,
.foa-trades-table .trade-row > :last-child,
.builder-recent-trades .trade-head > :last-child,
.builder-recent-trades .trade-row > :last-child {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

/* Premium two-button Trades footer. */
body.foa-trades-page-active .foa-trades-controls-footer {
  position: relative !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: stretch !important;
  gap: 11px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 68px !important;
  margin: 12px 0 22px !important;
  padding: 7px !important;
  border: 1px solid rgba(148, 163, 184, .20) !important;
  border-radius: 18px !important;
  background: linear-gradient(155deg, rgba(2, 6, 23, .96), rgba(7, 14, 28, .98)) !important;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .20), inset 0 1px 0 rgba(255, 255, 255, .04) !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

body.foa-trades-page-active .foa-trades-controls-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 0%, rgba(59, 130, 246, .13), transparent 38%),
    radial-gradient(circle at 88% 100%, rgba(239, 68, 68, .10), transparent 36%);
}

body.foa-trades-page-active .foa-reset-trades-icon,
body.foa-trades-page-active .foa-stop-trades-icon {
  position: relative !important;
  isolation: isolate !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 54px !important;
  padding: 0 16px !important;
  border-radius: 13px !important;
  font-size: 12.5px !important;
  font-weight: 900 !important;
  letter-spacing: .035em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, filter 150ms ease !important;
}

body.foa-trades-page-active .foa-reset-trades-icon::after,
body.foa-trades-page-active .foa-stop-trades-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 18%, rgba(255, 255, 255, .08) 48%, transparent 76%);
  transform: translateX(-120%);
  transition: transform 350ms ease !important;
}

body.foa-trades-page-active .foa-reset-trades-icon:hover::after,
body.foa-trades-page-active .foa-stop-trades-icon:hover::after {
  transform: translateX(120%);
}

body.foa-trades-page-active .foa-reset-trades-icon:hover,
body.foa-trades-page-active .foa-stop-trades-icon:hover {
  transform: translateY(-2px) !important;
  filter: brightness(1.06) !important;
}

body.foa-trades-page-active .foa-reset-trades-icon:active,
body.foa-trades-page-active .foa-stop-trades-icon:active {
  transform: translateY(0) scale(.99) !important;
}

body.foa-trades-page-active .foa-reset-trades-icon {
  color: #e2e8f0 !important;
  border: 1px solid rgba(96, 165, 250, .34) !important;
  background: linear-gradient(145deg, rgba(2, 6, 23, .98), rgba(15, 23, 42, .98)) !important;
  box-shadow: 0 12px 28px rgba(2, 6, 23, .35), inset 0 1px 0 rgba(255, 255, 255, .05) !important;
}

body.foa-trades-page-active .foa-reset-trades-icon:hover {
  border-color: rgba(96, 165, 250, .66) !important;
  box-shadow: 0 14px 32px rgba(37, 99, 235, .17), inset 0 1px 0 rgba(255, 255, 255, .07) !important;
}

body.foa-trades-page-active .foa-stop-trades-icon {
  color: #fff1f2 !important;
  border: 1px solid rgba(248, 113, 113, .54) !important;
  background: linear-gradient(145deg, rgba(69, 10, 10, .98), rgba(127, 29, 29, .96) 55%, rgba(153, 27, 27, .94)) !important;
  box-shadow: 0 12px 30px rgba(127, 29, 29, .30), inset 0 1px 0 rgba(255, 255, 255, .08) !important;
}

body.foa-trades-page-active .foa-stop-trades-icon:hover {
  border-color: rgba(252, 165, 165, .80) !important;
  box-shadow: 0 15px 34px rgba(185, 28, 28, .34), inset 0 1px 0 rgba(255, 255, 255, .10) !important;
}

body.foa-trades-page-active .foa-reset-trades-icon:disabled,
body.foa-trades-page-active .foa-stop-trades-icon:disabled {
  opacity: .55 !important;
  cursor: wait !important;
  transform: none !important;
}

body.foa-trades-page-active .foa-reset-trades-icon svg,
body.foa-trades-page-active .foa-stop-trades-icon svg {
  display: none !important;
}

body.foa-trades-page-active .foa-reset-trades-icon::before {
  content: "Clear Trades";
}

body.foa-trades-page-active .foa-stop-trades-icon::before {
  content: "Stop Trading";
}

/* Drawer theme authority. */
html[data-theme="dark"] .foa-mobile-drawer {
  color: #f8fafc !important;
  background:
    radial-gradient(circle at 0 0, rgba(59, 130, 246, .18), transparent 18rem),
    linear-gradient(160deg, #07111d, #03070d 72%) !important;
}

html[data-theme="light"] .foa-mobile-drawer {
  color: #0f172a !important;
  background:
    radial-gradient(circle at 0 0, rgba(37, 99, 235, .10), transparent 18rem),
    linear-gradient(160deg, #ffffff, #f3f6fb 72%) !important;
  box-shadow: 28px 0 70px rgba(15, 23, 42, .18) !important;
}

html[data-theme="light"] .foa-mobile-drawer-backdrop {
  background: rgba(15, 23, 42, .35) !important;
}

html[data-theme="light"] .foa-mobile-menu-button,
html[data-theme="light"] .foa-mobile-drawer-close,
html[data-theme="light"] .foa-mobile-risk-button {
  color: #0f172a !important;
  background: rgba(255, 255, 255, .90) !important;
}

html[data-theme="light"] .foa-mobile-account-card,
html[data-theme="light"] .foa-mobile-theme-row {
  color: #0f172a !important;
  background: rgba(37, 99, 235, .05) !important;
}

/* Appearance slider clearly changes with theme. */
html[data-theme="dark"] .foa-mobile-theme-toggle {
  border-color: rgba(148, 163, 184, .34) !important;
  background: #172033 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025) !important;
}

html[data-theme="dark"] .foa-mobile-theme-toggle::after {
  background: #e2e8f0 !important;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .34) !important;
}

html[data-theme="light"] .foa-mobile-theme-toggle {
  border-color: #cbd5e1 !important;
  background: #dbe3ef !important;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .025) !important;
}

html[data-theme="light"] .foa-mobile-theme-toggle::after {
  background: #334155 !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .18) !important;
}

html[data-theme="light"] .foa-mobile-theme-toggle[aria-checked="true"],
html[data-theme="dark"] .foa-mobile-theme-toggle[aria-checked="true"] {
  background: #2563eb !important;
  border-color: #2563eb !important;
}

html[data-theme="light"] .foa-mobile-theme-toggle[aria-checked="true"]::after,
html[data-theme="dark"] .foa-mobile-theme-toggle[aria-checked="true"]::after {
  background: #fff !important;
}

.foa-final-limit-notifier {
  z-index: 140 !important;
}

.foa-final-limit-notifier .foa-limit-values {
  display: block;
  margin-top: 2px;
  font-weight: 800;
}

@media (max-width: 760px) {
  /* Close icon first, then Dashboard/Trades, then Appearance. */
  .foa-mobile-drawer-head {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex: 0 0 auto !important;
    min-height: 42px !important;
    padding-bottom: 8px !important;
  }

  .foa-mobile-drawer-head > div {
    display: none !important;
  }

  .foa-mobile-drawer-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 8px 0 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  .foa-mobile-drawer-nav [data-mobile-view="settings"] {
    display: none !important;
  }

  .foa-mobile-nav-button {
    min-height: 48px !important;
    padding: 0 10px !important;
    border-radius: 13px !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    text-align: center !important;
    letter-spacing: .01em !important;
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease !important;
  }

  html[data-theme="dark"] .foa-mobile-nav-button {
    color: #e2e8f0 !important;
    border: 1px solid rgba(148, 163, 184, .22) !important;
    background: linear-gradient(145deg, rgba(15, 23, 42, .96), rgba(2, 6, 23, .98)) !important;
  }

  html[data-theme="light"] .foa-mobile-nav-button {
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    background: linear-gradient(145deg, #ffffff, #f1f5f9) !important;
    box-shadow: 0 7px 18px rgba(15, 23, 42, .07) !important;
  }

  .foa-mobile-nav-button.active,
  html[data-theme="light"] .foa-mobile-nav-button.active,
  html[data-theme="dark"] .foa-mobile-nav-button.active {
    color: #fff !important;
    border-color: rgba(96, 165, 250, .82) !important;
    background: linear-gradient(135deg, #1d4ed8, #2563eb 56%, #3b82f6) !important;
    box-shadow: 0 10px 26px rgba(37, 99, 235, .25), inset 0 1px 0 rgba(255, 255, 255, .18) !important;
  }

  .foa-mobile-nav-button:active {
    transform: scale(.985) !important;
  }

  .foa-mobile-theme-row {
    margin-top: 8px !important;
    flex: 0 0 auto !important;
  }

  /* Account/actions occupy the bottom without pushing navigation down. */
  .foa-mobile-account-card {
    order: 1 !important;
    margin: auto 0 0 !important;
  }

  .foa-mobile-drawer-actions {
    order: 2 !important;
    margin-top: 7px !important;
    padding-top: 0 !important;
  }

  body.foa-trades-page-active .foa-trades-controls-footer {
    gap: 8px !important;
    min-height: 62px !important;
    padding: 6px !important;
    border-radius: 15px !important;
  }

  body.foa-trades-page-active .foa-reset-trades-icon,
  body.foa-trades-page-active .foa-stop-trades-icon {
    min-height: 50px !important;
    padding: 0 8px !important;
    border-radius: 11px !important;
    font-size: 10.5px !important;
    letter-spacing: .025em !important;
  }

  .foa-trades-table .trade-head > :last-child,
  .foa-trades-table .trade-row > :last-child {
    justify-content: center !important;
    text-align: center !important;
  }
}
