:root {
  --bg-dark: #0b0e14;
  --bg-card: rgba(22, 27, 38, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --green-buy: #10b981;
  --green-glow: rgba(16, 185, 129, 0.25);
  --red-sell: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.25);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  padding: 20px;
}

/* Header */
.app-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: 16px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 28px;
}

.brand h1 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ticker-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ticker-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bg-card-border);
  padding: 4px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  white-space: nowrap;
}

.ticker-pill span {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
}

.ticker-pill strong {
  font-weight: 600;
  font-size: 11.5px;
}

.badge-demo {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Main Layout Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: 16px;
  padding: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);
}

/* Chart Container */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pair-select {
  background: #1e293b;
  color: var(--text-main);
  border: 1px solid var(--bg-card-border);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

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

/* Technical Analysis Bar */
.ta-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.ta-metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--bg-card-border);
  padding: 12px;
  border-radius: 10px;
  text-align: center;
}

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

.ta-metric value {
  font-size: 16px;
  font-weight: 600;
}

/* Signal Badge */
.signal-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

.signal-STRONG_BUY, .signal-BUY {
  background: rgba(16, 185, 129, 0.2);
  color: var(--green-buy);
  border: 1px solid var(--green-buy);
}

.signal-STRONG_SELL, .signal-SELL {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red-sell);
  border: 1px solid var(--red-sell);
}

.signal-NEUTRAL {
  background: rgba(156, 163, 175, 0.2);
  color: var(--text-muted);
  border: 1px solid var(--text-muted);
}

/* Order Form Panel */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  background: #1e293b;
  color: var(--text-main);
  border: 1px solid var(--bg-card-border);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-blue);
}

.side-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-side {
  padding: 10px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s;
}

.btn-side.active {
  opacity: 1;
  box-shadow: 0 0 15px currentColor;
}

.btn-side-long {
  background: var(--green-buy);
  color: #fff;
}

.btn-side-short {
  background: var(--red-sell);
  color: #fff;
}

.btn-submit {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  background: linear-gradient(135deg, var(--green-buy), #059669);
  box-shadow: 0 4px 14px var(--green-glow);
}

.btn-submit:hover {
  transform: translateY(-1px);
}

/* Positions & Bot Grid */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

@media (max-width: 1024px) {
  .bottom-grid {
    grid-template-columns: 1fr;
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.table th, .table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--bg-card-border);
  font-size: 13px;
}

.table th {
  color: var(--text-muted);
  font-weight: 500;
}

.btn-close-pos {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-sell);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.btn-close-pos:hover {
  background: var(--red-sell);
  color: #fff;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--green-buy);
}

input:checked + .slider:before {
  transform: translateX(20px);
}
