/* Antigravity Custom Premium CSS Design System */
:root {
  --bg-color: #0b0f19;
  --card-bg: rgba(17, 24, 39, 0.7);
  --card-border: rgba(255, 255, 255, 0.07);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-label: #6b7280;

  --neon-emerald: #10b981;
  --neon-emerald-glow: rgba(16, 185, 129, 0.15);
  --neon-coral: #ef4444;
  --neon-coral-glow: rgba(239, 68, 68, 0.15);
  --neon-blue: #3b82f6;
  --neon-blue-glow: rgba(59, 130, 246, 0.15);
  --neon-amber: #f59e0b;
  --neon-purple: #8b5cf6;
  
  --font-main: 'Inter', sans-serif;
  --font-logo: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Glass background overlay */
.glass-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  backdrop-filter: blur(10px);
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.5) 0%, rgba(11, 15, 25, 0.95) 100%);
}

/* Animated neon glow orbs */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -2;
  opacity: 0.4;
  animation: orbFloat 25s infinite alternate ease-in-out;
}

#orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--neon-blue) 0%, rgba(0, 0, 0, 0) 70%);
  top: -100px;
  right: -100px;
}

#orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--neon-purple) 0%, rgba(0, 0, 0, 0) 70%);
  bottom: -100px;
  left: -100px;
  animation-delay: -5s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, -40px) scale(1.1); }
  100% { transform: translate(-40px, 50px) scale(0.95); }
}

/* Scrollbar customizations */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* App Container Layout */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--card-border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  font-size: 32px;
  color: var(--neon-blue);
  filter: drop-shadow(0 0 8px var(--neon-blue-glow));
}

.header-logo h1 {
  font-family: var(--font-logo);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.status-item .label {
  font-size: 9px;
  color: var(--text-label);
  font-weight: 600;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--neon-blue);
}

#status-mode {
  color: var(--neon-emerald);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.15);
  padding: 6px 12px;
  border-radius: 30px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-emerald);
  box-shadow: 0 0 8px var(--neon-emerald);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

/* Card glass aesthetics */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Metrics Row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.balance-icon { background: rgba(59, 130, 246, 0.1); color: var(--neon-blue); border: 1px solid rgba(59, 130, 246, 0.2); }
.win-icon { background: rgba(16, 185, 129, 0.1); color: var(--neon-emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.profit-icon { background: rgba(139, 92, 246, 0.1); color: var(--neon-purple); border: 1px solid rgba(139, 92, 246, 0.2); }
.active-icon { background: rgba(245, 158, 11, 0.1); color: var(--neon-amber); border: 1px solid rgba(245, 158, 11, 0.2); }

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}

.metric-change {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-label);
}

.metric-change.positive { color: var(--neon-emerald); }
.metric-change.negative { color: var(--neon-coral); }

/* Layout grid body */
.layout-body {
  display: grid;
  grid-template-columns: 8fr 4fr;
  gap: 24px;
  align-items: start;
}

.left-column, .right-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Card Header standard */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h3 .icon {
  color: var(--neon-blue);
}

/* Buttons */
.btn {
  border: none;
  outline: none;
  font-family: var(--font-main);
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: var(--neon-blue);
  color: var(--text-main);
  box-shadow: 0 4px 12px var(--neon-blue-glow);
}
.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 20px var(--neon-blue-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}
.btn-secondary.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--neon-blue);
}

/* Charts */
.chart-wrapper {
  height: 300px;
  position: relative;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

th {
  color: var(--text-label);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.empty-state {
  text-align: center;
  color: var(--text-label);
  padding: 32px 0 !important;
}

/* Outcome styling in table */
.text-profit { color: var(--neon-emerald); font-weight: 600; }
.text-loss { color: var(--neon-coral); font-weight: 600; }
.badge-long { color: var(--neon-blue); background: rgba(59, 130, 246, 0.1); padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.badge-short { color: var(--neon-purple); background: rgba(139, 92, 246, 0.1); padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.outcome-win { background: rgba(16, 185, 129, 0.1); color: var(--neon-emerald); padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.outcome-loss { background: rgba(239, 68, 68, 0.1); color: var(--neon-coral); padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* Action Hub Card */
.action-buttons {
  display: flex;
  gap: 12px;
}

.status-msg {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-msg.hide { display: none; }

.loader-dot {
  width: 6px;
  height: 6px;
  background: var(--neon-blue);
  border-radius: 50%;
  animation: pulse 1s infinite alternate;
}

/* Active Positions Panel */
.position-dot {
  font-size: 11px;
  font-weight: 600;
  color: var(--neon-amber);
  background: rgba(245, 158, 11, 0.08);
  padding: 2px 8px;
  border-radius: 30px;
}

.positions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-positions {
  text-align: center;
  color: var(--text-label);
  font-size: 13px;
  padding: 20px 0;
}

.position-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 14px;
}

.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pos-symbol {
  font-weight: 700;
  font-size: 14px;
}

.pos-side {
  font-size: 11px;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  font-size: 12px;
  margin-bottom: 8px;
}

.pos-cell {
  display: flex;
  flex-direction: column;
}

.pos-cell .lbl {
  color: var(--text-label);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.pos-cell .val {
  font-weight: 500;
}

.pos-pnl {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 8px;
  margin-top: 4px;
}

.pos-pnl-label {
  font-size: 11px;
  color: var(--text-muted);
}

.pos-pnl-value {
  font-weight: 700;
  font-size: 14px;
}

/* Market Monitor Live Ticker Grid */
.ticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.ticker-row {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background 0.2s;
}

.ticker-row.flash-green { background: rgba(16, 185, 129, 0.08); }
.ticker-row.flash-red { background: rgba(239, 68, 68, 0.08); }

.ticker-row.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-label);
  font-size: 12px;
  padding: 10px 0;
}

.ticker-sym {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.ticker-prc {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-logo);
}

/* Logs Feed */
.logs-container {
  height: 160px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 10px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-row {
  color: #a78bfa;
}
.log-row.info { color: #3b82f6; }
.log-row.success { color: #10b981; }
.log-row.warn { color: #f59e0b; }
.log-row.error { color: #ef4444; }

/* Responsive adjustments */
@media(max-width: 1024px) {
  .layout-body {
    grid-template-columns: 1fr;
  }
}

/* Phase 2: Interactive Candlestick Charts & Dropdowns styling */
.dropdown-select {
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  font-family: var(--font-main);
  transition: border-color 0.2s, background-color 0.2s;
}

.dropdown-select:hover, .dropdown-select:focus {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(31, 41, 55, 0.9);
}

.dropdown-select option {
  background: #0b0f19;
  color: var(--text-main);
}

.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.flex-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.full-width {
  width: 100%;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.mb-2 {
  margin-bottom: 8px;
}

.mr-2 {
  margin-right: 8px;
}

.hide {
  display: none !important;
}

#candlestickChart {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
}

/* Circuit Breaker Alert Banner */
.cb-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(8px);
}
.cb-alert-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cb-alert-icon {
  font-size: 20px;
  color: var(--neon-coral);
}

/* Modal Styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
}
.modal-content {
  max-width: 500px;
  width: 90%;
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 10px 40px rgba(239, 68, 68, 0.15);
  animation: modalSlideIn 0.3s ease-out;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: 12px;
  padding: 24px;
}
@keyframes modalSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.modal-header h3 {
  color: var(--neon-coral);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.warning-icon {
  color: var(--neon-coral);
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal-close-btn:hover {
  color: var(--text-main);
}
.modal-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.modal-body p {
  margin-bottom: 12px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 16px;
}

/* Mobile Compliance (Responsive adjustments) */
@media (max-width: 1024px) {
  .layout-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .header-status {
    flex-wrap: wrap;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }
  
  .status-item {
    align-items: flex-start;
  }
  
  .app-container {
    padding: 16px;
  }
  
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .cb-alert {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 16px;
  }
  .cb-alert-content {
    flex-direction: column;
    gap: 8px;
  }
  .cb-alert button {
    width: 100%;
    margin-left: 0 !important;
  }
}

@media (max-width: 480px) {
  .header-status {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .status-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .status-indicator {
    justify-content: center;
  }
  
  .metrics-row {
    grid-template-columns: 1fr;
  }
  
  .flex-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
