/* ================= ANALYTICS ================= */

html, body {
  height: 100%;
  overflow: hidden;
}

.app {
  height: 100vh;
  overflow: hidden;
}

.main {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar {
  height: 100vh;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb {
  background: #2a3140;
  border-radius: 3px;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: #2a3140 transparent;
}
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb {
  background: #2a3140;
  border-radius: 4px;
}
.content::-webkit-scrollbar-thumb:hover { background: #3a4152; }

.topbar-title h1 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}
.breadcrumb {
  font-size: 11.5px;
  color: var(--muted);
}
.breadcrumb b { color: var(--text); }
.breadcrumb span { color: #7c5cff; }

/* ---------- RANGE TABS ---------- */
.an-range-tabs {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  align-self: flex-start;
  flex-shrink: 0;
}
.an-range {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
  white-space: nowrap;
}
.an-range:hover { color: var(--text); }
.an-range.active {
  background: linear-gradient(180deg, #8a6dff, #6a4bea);
  color: #fff;
  font-weight: 600;
}

/* ---------- KPI CARDS ---------- */
.an-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  flex-shrink: 0;
}

.an-kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: 0.2s;
  position: relative;
  overflow: hidden;
}
.an-kpi::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(124,92,255,0.06), transparent 70%);
  pointer-events: none;
}
.an-kpi:hover {
  border-color: rgba(124,92,255,0.3);
  transform: translateY(-2px);
}

.an-kpi-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.an-kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.an-kpi-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.an-kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  font-family: 'SF Mono', 'Consolas', monospace;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.an-kpi-value.green { color: #29c26b; }
.an-kpi-sub {
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.an-kpi-sub .green { color: #29c26b; font-weight: 600; }
.an-kpi-sub .red   { color: #ef4c5a; font-weight: 600; }
.an-kpi-sub .muted { color: var(--muted); }

/* ---------- PANEL ---------- */
.an-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
}
.an-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.an-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}
.an-panel-sub {
  font-size: 12px;
  color: var(--muted);
}

.an-chart-legend {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--muted);
}
.an-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.an-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.an-dot.green { background: #29c26b; }
.an-dot.red   { background: #ef4c5a; }

/* ---------- MAIN CHART ---------- */
.an-chart-wrap {
  width: 100%;
  height: 340px;
  position: relative;
}
.an-chart-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}
.an-chart-grid-line {
  stroke: rgba(255,255,255,0.05);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.an-chart-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.an-chart-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.an-cs-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.an-cs-value {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-family: 'SF Mono', 'Consolas', monospace;
}
.an-cs-value.green { color: #29c26b; }
.an-cs-value.red   { color: #ef4c5a; }

/* ---------- 2 COLUMNS GRID ---------- */
.an-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---------- BAR CHART ---------- */
.an-bars-wrap {
  width: 100%;
  height: 240px;
}
.an-bars-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}
.bar-grid-line {
  stroke: rgba(255,255,255,0.05);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}
.bar-label {
  fill: #8b93a7;
  font-size: 10px;
  font-family: 'Inter', sans-serif;
  text-anchor: middle;
}
.bar-value {
  fill: #fff;
  font-size: 10px;
  font-weight: 600;
  font-family: 'SF Mono', monospace;
  text-anchor: middle;
}

/* ---------- DONUT ---------- */
.an-donut-wrap {
  display: flex;
  align-items: center;
  gap: 26px;
  justify-content: center;
}
.an-donut-wrap svg {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
}
.donut-seg {
  transition: 0.3s;
  cursor: pointer;
}
.donut-seg:hover {
  filter: brightness(1.15);
}

.an-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.donut-leg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.donut-leg-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.donut-leg-name {
  color: #fff;
  font-weight: 600;
  min-width: 60px;
}
.donut-leg-pct {
  font-family: 'SF Mono', monospace;
  font-weight: 700;
}

/* ---------- TOP / WORST TRADES ---------- */
.an-trades-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trade-card {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: 0.15s;
}
.trade-card:hover {
  border-color: rgba(124,92,255,0.3);
  transform: translateX(2px);
}

.trade-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}
.trade-ico.green { background: rgba(41,194,107,0.15); color: #29c26b; }
.trade-ico.red   { background: rgba(239,76,90,0.15); color: #ef4c5a; }

.trade-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.trade-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-time {
  font-size: 11px;
  color: var(--muted);
}
.trade-pnl {
  font-family: 'SF Mono', monospace;
  font-weight: 700;
  font-size: 14px;
}
.trade-pnl.green { color: #29c26b; }
.trade-pnl.red   { color: #ef4c5a; }

.trade-pct {
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}
.trade-pct.green { background: rgba(41,194,107,0.12); color: #29c26b; }
.trade-pct.red   { background: rgba(239,76,90,0.12); color: #ef4c5a; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
  .an-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .an-grid-2   { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .an-kpi-grid { grid-template-columns: 1fr; }
  .an-chart-stats { grid-template-columns: repeat(2, 1fr); }
  .an-donut-wrap { flex-direction: column; }
  .an-chart-wrap { height: 220px; }
}
/* ================= LIVE ANIMATIONS ================= */

/* KPI-карточки — плавное свечение */
.an-kpi {
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

/* Числа KPI — плавное изменение цвета */
.an-kpi-value {
  transition: color 0.4s ease, transform 0.15s ease;
}
.an-kpi-value.green {
  text-shadow: 0 0 20px rgba(41,194,107,0.35);
}

/* Главный график — плавное обновление */
#anChartLine {
  transition: d 0.25s ease-out;
}
#anChartArea {
  transition: d 0.25s ease-out;
}
#anChartDot {
  transition: cx 0.25s ease-out, cy 0.25s ease-out, r 0.15s ease-out;
  filter: drop-shadow(0 0 8px rgba(41,194,107,0.6));
}

/* Bar chart — бары плавно меняют высоту */
#barBars rect {
  transition: y 0.4s ease, height 0.4s ease;
}

/* Donut — сектора плавно двигаются */
.donut-seg {
  transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.donut-seg:hover {
  filter: brightness(1.2);
  transform: scale(1.03);
}

/* Trade-карточки — лёгкое появление */
.trade-card {
  transition: 0.3s ease;
  animation: tradeAppear 0.4s ease;
}
@keyframes tradeAppear {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Trade P&L — плавная смена цвета */
.trade-pnl,
.trade-pct {
  transition: color 0.3s ease, background 0.3s ease;
}

/* Live-индикатор в углу */
.an-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(41,194,107,0.12);
  border: 1px solid rgba(41,194,107,0.3);
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: #29c26b;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.an-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #29c26b;
  box-shadow: 0 0 8px rgba(41,194,107,0.8);
  animation: anPulse 1.2s infinite;
}
@keyframes anPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.8); }
}
/* ============================================================
   AXIS ANALYTICS — STYLISH PAGE TITLE
   Градиентный заголовок + красивая лицензия
   ============================================================ */

/* ---------- Заголовок "Analytics Axis Crypto" ---------- */
.topbar-title h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.3px;
  line-height: 1.15;
  background: linear-gradient(135deg,
    #ffffff 0%,
    #e8ddff 40%,
    #b9a8ff 75%,
    #7c9bff 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  position: relative;
  display: inline-block;
  padding-right: 2px;
  filter: drop-shadow(0 0 18px rgba(164, 75, 255, 0.35))
          drop-shadow(0 0 6px rgba(46, 168, 255, 0.2));
}

/* Тонкая градиентная полоска под заголовком */
.topbar-title h1::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    #ff8a2b 0%,
    #ff3d8a 35%,
    #a44bff 65%,
    #2ea8ff 100%);
  box-shadow: 0 0 12px rgba(164, 75, 255, 0.6);
  opacity: 0.85;
}

/* Вертикальная градиентная полоска слева */
.topbar-title {
  position: relative;
  padding-left: 14px;
}
.topbar-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg,
    #ff8a2b 0%,
    #ff3d8a 35%,
    #a44bff 65%,
    #2ea8ff 100%);
  box-shadow: 0 0 12px rgba(164, 75, 255, 0.6);
}

/* ---------- Лицензия под заголовком ---------- */
.breadcrumb {
  font-size: 11.5px;
  color: #8b93a7;
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb::before {
  content: '🔒';
  font-size: 10px;
  opacity: 0.5;
  margin-right: -2px;
}
.breadcrumb b {
  font-family: 'SF Mono', 'Consolas', monospace !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #c8b5ff !important;
  padding: 2px 8px;
  background: rgba(164, 75, 255, 0.1);
  border: 1px solid rgba(164, 75, 255, 0.25);
  border-radius: 5px;
  text-shadow: 0 0 8px rgba(164, 75, 255, 0.4);
}
.breadcrumb span {
  color: #a48cff !important;
  font-weight: 800;
}