/* Reset and Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  background: #0a0e1a;
  color: #00ffff;
  font-size: 13px;
  letter-spacing: 0.05em;
  overflow: hidden;
}

/* Terminal Container */
.terminal-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #0a0e1a;
  border: 2px solid #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

/* Header */
.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #0d1117;
  border-bottom: 1px solid #00ffff;
  box-shadow: 0 2px 10px rgba(0, 255, 255, 0.2);
}

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

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

.terminal-prompt {
  color: #00ffff;
  font-weight: 600;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff0000;
  box-shadow: 0 0 5px currentColor;
  animation: pulse 2s infinite;
}

.status-dot.online {
  background: #00ff00;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.balance-display,
.mode-display {
  display: flex;
  gap: 8px;
}

.label {
  color: #4a9eff;
}

.value {
  color: #00ffff;
  font-weight: 600;
}

/* Body Layout */
.terminal-body {
  display: grid;
  grid-template-columns: 200px 1fr 250px;
  gap: 10px;
  padding: 10px;
  flex: 1;
  overflow: hidden;
}

/* Panels */
.panel {
  background: #0d1117;
  border: 1px solid #00ffff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.1);
}

.panel-header {
  padding: 8px 12px;
  background: #161b22;
  border-bottom: 1px solid #00ffff;
  color: #00ffff;
  font-weight: 600;
  text-align: center;
  white-space: pre;
  font-size: 11px;
}

.panel-title {
  display: block;
}

.panel-body {
  padding: 12px;
  overflow-y: auto;
}

/* Sidebar Left: Pair List */
.sidebar-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pair-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pair-item {
  padding: 8px 12px;
  background: #161b22;
  border: 1px solid #00d4ff;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pair-item:hover {
  background: #1c2128;
  border-color: #00ffff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.pair-item.active {
  background: #1c2128;
  border-color: #00ff00;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.pair-symbol {
  color: #00ffff;
  font-weight: 600;
  font-size: 14px;
}

.pair-price {
  color: #4a9eff;
  font-size: 11px;
}

.pair-status {
  font-size: 10px;
  color: #888;
  transition: all 0.3s;
}

.pair-status.bot-active {
  color: #00ff00;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  font-weight: 600;
}

.pair-status.bot-standby {
  color: #666;
  text-shadow: none;
}

.pair-status.in-position {
  color: #ffaa00;
  text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

/* Main Content */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

/* Info Panel - compact */
.info-panel {
  flex: 0 0 auto;
}

/* EMA Panel - compact */
.ema-panel {
  flex: 0 0 auto;
}

/* Chart Panel - takes up 70% of remaining space */
.chart-panel {
  flex: 7;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.chart-panel .panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.chart-panel canvas {
  background: #0d1117;
  flex: 1;
  width: 100% !important;
  height: 100% !important;
}

/* Trade Log - takes up remaining 30% */
.trade-log-panel {
  flex: 3;
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

/* Info Panel */
.info-panel .panel-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-display {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

#current-price {
  font-size: 20px;
  color: #00ffff;
  text-shadow: 0 0 10px #00ffff;
}

/* EMA Panel */
.ema-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.ema-row {
  display: flex;
  justify-content: space-between;
  padding: 6px;
  background: #161b22;
  border: 1px solid #00d4ff;
}

.ema-label {
  color: #4a9eff;
}

.ema-value {
  color: #00ffff;
  font-weight: 600;
}

.ema-analysis {
  padding: 10px;
  background: #161b22;
  border: 1px solid #00ffff;
  color: #00ffff;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-line;
}

/* Trade Log */
.trade-log {
  font-size: 11px;
}

.log-header {
  display: grid;
  grid-template-columns: 80px 60px 50px 100px 80px 80px;
  gap: 10px;
  padding: 6px;
  background: #161b22;
  border: 1px solid #00ffff;
  color: #00ffff;
  font-weight: 600;
  margin-bottom: 4px;
}

.log-entries {
  max-height: 200px;
  overflow-y: auto;
}

.log-entry {
  display: grid;
  grid-template-columns: 80px 60px 50px 100px 80px 80px;
  gap: 10px;
  padding: 6px;
  border-bottom: 1px solid #00d4ff;
}

.log-entry.buy {
  color: #00ff00;
}

.log-entry.sell {
  color: #ff0000;
}

/* Sidebar Right */
.sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Monkey Icon */
.sidebar-icon {
  padding: 1px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 5px;
}

.ascii-monkey {
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.2;
  margin-left: 80px;
  text-align: center;
  font-family: "Courier New", monospace;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.terminal-btn {
  width: 100%;
  padding: 22px;
  background: #161b22;
  border: 2px solid #00ffff;
  color: #00ffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-shadow: 0 0 5px currentColor;
}

.terminal-btn:hover:not(:disabled) {
  background: #1c2128;
  box-shadow: 0 0 15px currentColor;
}

.terminal-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  border-color: #444;
  color: #666;
  text-shadow: none;
}

.buy-btn {
  border-color: #00ff00;
  color: #00ff00;
  margin-bottom: 8px;
}

.sell-btn {
  border-color: #ff0000;
  color: #ff0000;
  margin-bottom: 8px;
}

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

.position-item {
  padding: 8px;
  background: #161b22;
  border: 1px solid #ffaa00;
  font-size: 11px;
}

.position-pair {
  color: #00ffff;
  font-weight: 600;
  margin-bottom: 4px;
}

.position-details {
  color: #4a9eff;
  line-height: 1.4;
}

/* Manual Trading Controls */
.control-group {
  margin-bottom: 15px;
}

.control-label {
  display: block;
  color: var(--text-primary);
  font-size: 11px;
  margin-bottom: 5px;
  font-weight: 600;
  letter-spacing: 1px;
}

.terminal-input,
.terminal-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: "Courier New", monospace;
  font-size: 14px;
  border-radius: 2px;
  transition: all 0.2s;
}

.terminal-input:focus,
.terminal-select:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

.terminal-input:hover,
.terminal-select:hover {
  border-color: var(--text-secondary);
}

.control-hint {
  display: block;
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 4px;
  font-style: italic;
}

.control-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.terminal-btn {
  flex: 1;
  padding: 12px;
  font-size: 13px;
}

/* Footer */
.terminal-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 20px;
  background: #0d1117;
  border-top: 1px solid #00ffff;
  font-size: 11px;
  color: #4a9eff;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0d1117;
}

::-webkit-scrollbar-thumb {
  background: #00ffff;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #00d4ff;
}

/* Optional: Scanline Effect */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1000;
  opacity: 0.3;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .terminal-body {
    grid-template-columns: 180px 1fr 220px;
  }
}

@media (max-width: 900px) {
  .terminal-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .sidebar-left,
  .sidebar-right {
    flex-direction: row;
    overflow-x: auto;
  }
}
