/* ===== Full Screen Chart Mode ===== */

.chart-fs {
  position: fixed;
  inset: 0;
  z-index: 10080;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0a0e17 0%, #0d1117 45%, #0b1019 100%);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
  transition:
    opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.38s;
  pointer-events: none;
}

.chart-fs.is-active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
}

body.chart-fs-active {
  overflow: hidden !important;
}

body.chart-fs-active .app,
body.chart-fs-active .mobile-app {
  pointer-events: none;
}

/* ── Top bar ── */
.chart-fs__top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: rgba(17, 24, 39, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.chart-fs__exit {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.chart-fs__exit:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.chart-fs__exit:active {
  transform: scale(0.96);
}

.chart-fs__market {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
  transition: background 0.2s;
}

.chart-fs__market:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chart-fs__flags {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.chart-fs__pair {
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-fs__otc {
  background: rgba(0, 149, 255, 0.18);
  color: #38bdf8;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

.chart-fs__pct {
  color: #00e676;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.chart-fs__top-spacer {
  flex: 1;
}

.chart-fs__balance-wrap {
  text-align: right;
  flex-shrink: 0;
}

.chart-fs__acc-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #64748b;
  text-transform: uppercase;
}

.chart-fs__acc-label.demo {
  color: #38bdf8;
}

.chart-fs__acc-label.live {
  color: #00e676;
}

.chart-fs__balance {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.chart-fs__trade-time {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(0, 149, 255, 0.08);
  border: 1px solid rgba(0, 149, 255, 0.15);
}

.chart-fs__trade-time-lbl {
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chart-fs__trade-time-val {
  font-size: 13px;
  font-weight: 800;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

/* ── Chart section ── */
.chart-fs__chart-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.chart-fs__tools {
  flex-shrink: 0;
}

.chart-fs__body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.chart-fs__body .m-chart {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.chart-fs__body .chart-container-wrap {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
}

.chart-fs__body .tv-chart-container {
  width: 100% !important;
  height: calc(100% - 34px) !important;
  margin-bottom: 34px !important;
}

.chart-fs__tools-bottom {
  flex-shrink: 0;
}

.chart-fs__chart-section .chart-toolbar {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-fs__chart-section .chart-bottom-tools {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-fs__chart-section .m-tf-bar {
  position: relative;
  bottom: auto;
  left: auto;
  right: auto;
}

/* ── Bottom trading panel ── */
.chart-fs__bottom {
  flex-shrink: 0;
  padding: 12px 14px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.97) 0%, rgba(11, 14, 23, 0.99) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
}

.chart-fs__inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.chart-fs__field {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.chart-fs__field:hover {
  border-color: rgba(0, 149, 255, 0.25);
  background: rgba(0, 149, 255, 0.04);
}

.chart-fs__field-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.chart-fs__field-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.chart-fs__invest-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-fs__invest-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.chart-fs__invest-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.chart-fs__invest-input {
  flex: 1;
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  outline: none;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.chart-fs__invest-currency {
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  flex-shrink: 0;
}

.chart-fs__trade-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chart-fs__btn-up,
.chart-fs__btn-down {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  letter-spacing: 0.02em;
}

.chart-fs__btn-up {
  background: linear-gradient(135deg, #00c853 0%, #00e676 100%);
  box-shadow: 0 6px 24px rgba(0, 200, 83, 0.28);
}

.chart-fs__btn-down {
  background: linear-gradient(135deg, #ff1744 0%, #ff5252 100%);
  box-shadow: 0 6px 24px rgba(255, 23, 68, 0.28);
}

.chart-fs__btn-up:hover,
.chart-fs__btn-down:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.chart-fs__btn-up:active,
.chart-fs__btn-down:active {
  transform: scale(0.98);
}

.chart-fs__btn-arrow {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

#fsTimeDropdown {
  top: auto;
  bottom: calc(100% + 6px);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.55);
}

/* Fullscreen toggle button in chart toolbar */
.tool-btn.fs-toggle-btn,
.m-fs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-btn.fs-toggle-btn svg,
.m-fs-btn svg {
  width: 16px;
  height: 16px;
}

.m-fs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text3);
  width: 28px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.m-fs-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.tool-btn.fs-toggle-btn.is-fs-active,
.m-fs-btn.is-fs-active {
  color: #38bdf8;
  background: rgba(0, 149, 255, 0.12);
}

/* Tablet / Desktop fullscreen */
@media (min-width: 768px) {
  .chart-fs__top {
    padding: 12px 20px;
    gap: 16px;
  }

  .chart-fs__pair {
    font-size: 16px;
  }

  .chart-fs__balance {
    font-size: 18px;
  }

  .chart-fs__bottom {
    padding: 14px 24px 18px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
  }

  .chart-fs__btn-up,
  .chart-fs__btn-down {
    padding: 18px 16px;
    font-size: 18px;
  }
}

@media (min-width: 1100px) {
  .chart-fs__bottom {
    max-width: 860px;
  }
}
