/* ═══════════════════════════════════════════════════════
   AXE CAPITAL — Terminal-grade trading UI
   Dark theme, monospace numerals, Bloomberg density
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Surface palette — neutral blacks, no blue tint */
  --ax-bg:              #050505;
  --ax-bg-raised:       #0d0d0d;
  --ax-bg-surface:      #141414;
  --ax-bg-hover:        #1a1a1a;
  --ax-border:          #262626;
  --ax-border-subtle:   #1a1a1a;

  /* Text */
  --ax-text-primary:    #f5f5f5;
  --ax-text-secondary:  #737373;
  --ax-text-muted:      #525252;
  --ax-text-dim:        #404040;

  /* Signal colors */
  --price-up:           #22c55e;
  --price-down:         #ef4444;
  --price-neutral:      var(--ax-text-secondary);
  --price-flash-up:     rgba(34, 197, 94, 0.18);
  --price-flash-down:   rgba(239, 68, 68, 0.18);
  --flash-duration:     500ms;
  --price-stale:        var(--ax-text-dim);

  /* Accents — monochrome with gold premium touch */
  --ax-accent:          #ffffff;
  --ax-accent-hover:    #e5e5e5;
  --ax-accent-subtle:   rgba(255, 255, 255, 0.08);
  --ax-gold:            #d4af37;
  --ax-gold-subtle:     rgba(212, 175, 55, 0.1);
  --ax-warning:         #f59e0b;

  /* Typography */
  --font-display:       'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:          'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;

  /* Sizing */
  --row-height:         44px;
  --header-height:      56px;
}

/* ── Reset overrides for admin template ─────────────── */
.axe-trading-root {
  background: var(--ax-bg) !important;
  min-height: 100vh;
  color: var(--ax-text-primary);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.axe-trading-root *,
.axe-trading-root *::before,
.axe-trading-root *::after {
  border-color: var(--ax-border);
}

/* ── Top bar ────────────────────────────────────────── */
.axe-topbar {
  height: var(--header-height);
  background: var(--ax-bg-raised);
  border-bottom: 1px solid var(--ax-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.axe-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.axe-brand-logo {
  height: 28px;
  width: auto;
  display: block;
  filter: brightness(1);
  transition: opacity 0.15s ease;
}

.axe-brand:hover .axe-brand-logo {
  opacity: 0.85;
}

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

/* ── Kite Connect button ───────────────────────────── */
.axe-kite-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ax-text-secondary);
  background: var(--ax-bg-surface);
  border: 1px solid var(--ax-border);
  border-radius: 4px;
  padding: 5px 12px;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.axe-kite-btn:hover {
  color: var(--ax-text-primary);
  border-color: var(--ax-text-muted);
  background: var(--ax-bg-hover);
}

.axe-kite-btn.connected {
  color: var(--price-up);
  border-color: rgba(34, 197, 94, 0.25);
}

.axe-kite-btn.connected .axe-kite-icon {
  filter: drop-shadow(0 0 3px rgba(34, 197, 94, 0.4));
}

.axe-kite-btn.connected:hover {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.4);
}

/* ── Sync button (superuser) ────────────────────────── */
.axe-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ax-text-secondary);
  background: var(--ax-bg-surface);
  border: 1px solid var(--ax-border);
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.axe-sync-btn:hover {
  color: var(--ax-text-primary);
  border-color: var(--ax-text-muted);
  background: var(--ax-bg-hover);
}

.axe-sync-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.axe-sync-btn i.spin {
  animation: syncSpin 0.8s linear infinite;
}

@keyframes syncSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Connection status ──────────────────────────────── */
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ax-text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--ax-bg-surface);
  border: 1px solid var(--ax-border);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.live {
  background-color: var(--price-up);
  box-shadow: 0 0 6px var(--price-up);
  animation: pulse-glow 2s ease-in-out infinite;
}

.status-dot.reconnecting {
  background-color: var(--ax-warning);
  animation: pulse-glow 1s ease-in-out infinite;
}

.status-dot.disconnected {
  background-color: var(--price-down);
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Watchlist selector ─────────────────────────────── */
.axe-wl-selector {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--ax-bg-surface);
  border-radius: 6px;
  padding: 3px;
  border: 1px solid var(--ax-border);
}

.axe-wl-tab {
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ax-text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  background: none;
  white-space: nowrap;
}

.axe-wl-tab:hover {
  color: var(--ax-text-primary);
  background: var(--ax-bg-hover);
}

.axe-wl-tab.active {
  color: var(--ax-bg);
  background: var(--ax-accent);
  font-weight: 700;
}

.axe-wl-tab.add-tab {
  color: var(--ax-text-muted);
  font-size: 0.85rem;
  padding: 5px 10px;
}

.axe-wl-tab.add-tab:hover {
  color: var(--ax-accent);
  background: var(--ax-accent-subtle);
}

/* ── Search bar ─────────────────────────────────────── */
.axe-search-wrap {
  position: relative;
  width: 320px;
}

.axe-search-input {
  width: 100%;
  height: 34px;
  background: var(--ax-bg-surface) !important;
  border: 1px solid var(--ax-border) !important;
  border-radius: 6px !important;
  color: var(--ax-text-primary) !important;
  font-family: var(--font-display);
  font-size: 0.8rem;
  padding: 0 12px 0 34px !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.axe-search-input::placeholder {
  color: var(--ax-text-muted);
}

.axe-search-input:focus {
  border-color: var(--ax-accent) !important;
  box-shadow: 0 0 0 2px var(--ax-accent-subtle) !important;
  outline: none;
}

.axe-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ax-text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.axe-search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--ax-text-muted);
  border: 1px solid var(--ax-border);
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.4;
  pointer-events: none;
}

/* ── Search dropdown ────────────────────────────────── */
.search-dropdown {
  position: absolute;
  z-index: 1000;
  width: 100%;
  max-height: 380px;
  overflow-y: auto;
  background: var(--ax-bg-raised);
  border: 1px solid var(--ax-border);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  margin-top: 4px;
}

.search-dropdown .search-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.1s;
  border-bottom: 1px solid var(--ax-border-subtle);
}

.search-dropdown .search-item:last-child {
  border-bottom: none;
}

.search-dropdown .search-item:hover {
  background-color: var(--ax-bg-hover);
}

.search-dropdown .search-item .symbol-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ax-text-primary);
}

.search-dropdown .search-item .symbol-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ax-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--ax-bg-surface);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ── Main content area ──────────────────────────────── */
.axe-content {
  padding: 0;
}

/* ── Welcome Hero ───────────────────────────────────── */
.axe-welcome-hero {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 6vh;
  text-align: center;
  overflow: hidden;
  z-index: 10;
  background: var(--ax-bg);
}

/* Particle canvas — absolute fill, behind everything */
.axe-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* All content above particles */
.axe-welcome-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: wReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes wReveal {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Radial glow behind logo */
.axe-welcome-inner::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 65%);
  pointer-events: none;
  animation: wGlow 4s ease-in-out infinite;
}

@keyframes wGlow {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;   transform: translateX(-50%) scale(1.15); }
}

.axe-welcome-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  animation: wLogo 1s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

@keyframes wLogo {
  from { opacity: 0; filter: brightness(2.5); transform: scale(0.85); }
  to   { opacity: 1; filter: brightness(1);   transform: scale(1); }
}

.axe-welcome-divider {
  width: 48px;
  height: 1px;
  background: var(--ax-text-dim);
  margin: 20px 0;
  position: relative;
  animation: wLine 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

.axe-welcome-divider::before,
.axe-welcome-divider::after {
  content: '';
  position: absolute;
  top: 0;
  height: 1px;
  width: 2px;
  background: var(--ax-border);
}
.axe-welcome-divider::before { left: -6px; }
.axe-welcome-divider::after  { right: -6px; }

@keyframes wLine {
  from { width: 0; opacity: 0; }
  to   { width: 48px; opacity: 1; }
}

.axe-welcome-heading {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ax-text-primary);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  animation: wReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

.axe-welcome-accent {
  background: linear-gradient(135deg, #ffffff 0%, #a3a3a3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.axe-welcome-sub {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--ax-text-secondary);
  margin: 0 0 32px;
  animation: wReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.axe-welcome-tagline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ax-text-muted);
  padding: 10px 20px;
  border: 1px solid var(--ax-border-subtle);
  border-radius: 2px;
  animation: wReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.55s both;
}

.axe-welcome-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--price-up);
  animation: wDotPulse 2s ease-in-out infinite;
}

@keyframes wDotPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ── Watchlist sub-header ───────────────────────────── */
.axe-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--ax-border);
  background: var(--ax-bg);
}

.axe-item-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ax-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Table ──────────────────────────────────────────── */
.watchlist-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: transparent;
  margin: 0;
  color: var(--ax-text-primary);
}

.watchlist-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.watchlist-table th {
  background: var(--ax-bg-raised);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ax-text-muted);
  padding: 8px 16px;
  border-bottom: 1px solid var(--ax-border);
  text-align: right;
  white-space: nowrap;
  user-select: none;
}

.watchlist-table th:first-child {
  text-align: left;
  padding-left: 20px;
}

.watchlist-table th:last-child {
  padding-right: 20px;
}

.watchlist-table td {
  padding: 0 16px;
  height: var(--row-height);
  vertical-align: middle;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-align: right;
  border-bottom: 1px solid var(--ax-border-subtle);
  transition: background-color var(--flash-duration) ease-out;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.watchlist-table td:first-child {
  text-align: left;
  padding-left: 20px;
}

.watchlist-table td:last-child {
  padding-right: 20px;
}

.watchlist-table tbody tr {
  cursor: default;
  transition: background-color 0.1s ease;
}

.watchlist-table tbody tr:hover {
  background-color: var(--ax-bg-hover);
}

.watchlist-table tbody tr:last-child td {
  border-bottom: none;
}

/* Symbol column */
.sym-cell {
  font-family: var(--font-display) !important;
}

.sym-ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ax-text-primary);
  letter-spacing: -0.01em;
}

.sym-name {
  font-family: var(--font-display);
  font-size: 0.68rem;
  color: var(--ax-text-muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.sym-exchange {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ax-text-dim);
  background: var(--ax-bg-surface);
  padding: 1px 4px;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Price columns */
.ltp-cell {
  font-weight: 700;
  font-size: 0.88rem !important;
}

.change-cell,
.change-pct-cell {
  font-weight: 500;
  font-size: 0.8rem !important;
}

.ohlc-cell {
  font-size: 0.76rem !important;
  color: var(--ax-text-secondary);
}

.volume-cell {
  color: var(--ax-text-secondary);
  font-size: 0.76rem !important;
}

/* Signal coloring */
.price-up { color: var(--price-up) !important; }
.price-down { color: var(--price-down) !important; }

/* ── Flash animations ───────────────────────────────── */
.tick-flash-up {
  animation: flashUp var(--flash-duration) ease-out;
}
.tick-flash-down {
  animation: flashDown var(--flash-duration) ease-out;
}

/* Row-level flash — entire row lights up */
tr.row-flash-up td {
  animation: rowFlashUp var(--flash-duration) ease-out;
}
tr.row-flash-down td {
  animation: rowFlashDown var(--flash-duration) ease-out;
}

@keyframes flashUp {
  0%  { background-color: var(--price-flash-up); }
  100% { background-color: transparent; }
}
@keyframes flashDown {
  0%  { background-color: var(--price-flash-down); }
  100% { background-color: transparent; }
}
@keyframes rowFlashUp {
  0%  { background-color: var(--price-flash-up); }
  100% { background-color: transparent; }
}
@keyframes rowFlashDown {
  0%  { background-color: var(--price-flash-down); }
  100% { background-color: transparent; }
}

/* Stale prices */
.price-stale .ltp-cell,
.price-stale .change-cell,
.price-stale .change-pct-cell,
.price-stale .ohlc-cell,
.price-stale .volume-cell {
  color: var(--price-stale) !important;
}

/* ── Delete row button ──────────────────────────────── */
.row-delete {
  visibility: hidden;
  opacity: 0;
  background: none;
  border: none;
  color: var(--ax-text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 3px;
  transition: all 0.15s;
  line-height: 1;
}

.row-delete:hover {
  color: var(--price-down);
  background: var(--price-flash-down);
}

.watchlist-table tbody tr:hover .row-delete {
  visibility: visible;
  opacity: 1;
}

/* ── Empty state ────────────────────────────────────── */
.axe-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.axe-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--ax-bg-surface);
  border: 1px solid var(--ax-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.axe-empty-icon i {
  font-size: 28px;
  color: var(--ax-text-muted);
}

.axe-empty-state h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ax-text-primary);
  margin-bottom: 6px;
}

.axe-empty-state p {
  font-size: 0.82rem;
  color: var(--ax-text-secondary);
  margin-bottom: 24px;
  max-width: 360px;
}

.axe-empty-search {
  width: 100%;
  max-width: 400px;
  position: relative;
  margin-bottom: 20px;
}

.popular-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.popular-chips .popular-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ax-text-muted);
  margin-right: 4px;
}

.popular-chips .popular-add {
  font-family: var(--font-mono) !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: var(--ax-text-secondary) !important;
  background: var(--ax-bg-surface) !important;
  border: 1px solid var(--ax-border) !important;
  border-radius: 4px !important;
  padding: 4px 10px !important;
  cursor: pointer;
  transition: all 0.15s;
}

.popular-chips .popular-add:hover {
  color: var(--ax-accent) !important;
  border-color: var(--ax-accent) !important;
  background: var(--ax-accent-subtle) !important;
}

/* ── Column widths ──────────────────────────────────── */
.col-sym     { width: 22%; }
.col-ltp     { width: 13%; }
.col-chg     { width: 11%; }
.col-chgp    { width: 11%; }
.col-open    { width: 10%; }
.col-high    { width: 10%; }
.col-low     { width: 10%; }
.col-vol     { width: 10%; }
.col-action  { width: 3%; }

/* ── Responsive: tablet ─────────────────────────────── */
@media (max-width: 1100px) {
  .col-open,
  .col-high,
  .col-low {
    display: none;
  }
  .col-sym   { width: 30%; }
  .col-ltp   { width: 18%; }
  .col-chg   { width: 14%; }
  .col-chgp  { width: 14%; }
  .col-vol   { width: 14%; }
}

/* ── Responsive: mobile ─────────────────────────────── */
@media (max-width: 768px) {
  .axe-topbar {
    padding: 0 12px;
    height: 48px;
  }

  .axe-search-wrap {
    width: 180px;
  }

  .axe-wl-selector {
    max-width: 200px;
    overflow-x: auto;
  }

  .col-open, .col-high, .col-low, .col-vol {
    display: none;
  }

  .col-sym   { width: 40%; }
  .col-ltp   { width: 22%; }
  .col-chg   { width: 18%; }
  .col-chgp  { width: 18%; }

  .watchlist-table td,
  .watchlist-table th {
    padding: 0 10px;
  }

  .watchlist-table td:first-child,
  .watchlist-table th:first-child {
    padding-left: 12px;
  }

  .watchlist-table td {
    height: 42px;
    font-size: 0.78rem;
  }

  .sym-name {
    display: none;
  }

  .axe-subheader {
    padding: 8px 12px;
  }

  .row-delete {
    display: none;
  }
}

@media (max-width: 480px) {
  .col-chg { display: none; }
  .col-sym  { width: 45%; }
  .col-ltp  { width: 28%; }
  .col-chgp { width: 27%; }

  .axe-search-wrap {
    width: 140px;
  }

  .axe-search-kbd {
    display: none;
  }
}

/* ── Scrollbar (dark) ───────────────────────────────── */
.axe-trading-root ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.axe-trading-root ::-webkit-scrollbar-track {
  background: transparent;
}
.axe-trading-root ::-webkit-scrollbar-thumb {
  background: var(--ax-border);
  border-radius: 3px;
}
.axe-trading-root ::-webkit-scrollbar-thumb:hover {
  background: var(--ax-text-dim);
}

/* ── Utility ────────────────────────────────────────── */
.font-mono { font-family: var(--font-mono); }
