:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #334155;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.5);
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --glass: rgba(15, 23, 42, 0.7);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: var(--accent);
  transition: color 0.2s;
}

a:hover {
  color: #60a5fa;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* Navigation */
.top-nav {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 800;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 0;
  position: relative;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* Dashboard Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  padding: 32px 0;
  flex: 1;
}

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

/* Sidebar / Stats Panel */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

.stat-title {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  padding: 4px 8px;
  border-radius: 99px;
  font-weight: 600;
}

.live-badge::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.price-display {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

.change-display {
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.change-display.up { color: var(--success); }
.change-display.down { color: var(--danger); }

/* Chart Header Controls */
.chart-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timeframe-selector {
  display: flex;
  background: var(--bg);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.tf-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.tf-btn:hover {
  color: var(--text);
}

.tf-btn.active {
  background: var(--bg-hover);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Lower Dashboard Grid */
.dashboard-grid-lower {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 24px;
}

.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

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

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

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

/* Trades Table */
.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.trades-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}

.trades-table td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  font-variant-numeric: tabular-nums;
}

.trade-buy { color: var(--success); }
.trade-sell { color: var(--danger); }

/* Main Chart Area */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  height: 600px;
  display: flex;
  flex-direction: column;
}

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

.chart-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.chart-title p {
  font-size: 0.9rem;
  color: var(--muted);
}

#chart-container {
  flex: 1;
  width: 100%;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.5); /* Slightly darker inner chart bg */
  min-height: 400px; /* Ensure minimum height */
}

#chart-display {
  width: 100%;
  height: 100%;
}

/* Bot Signal Card */
.signal-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(30, 58, 138, 0.3) 100%);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.signal-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.signal-value {
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.4;
}

/* Grid of mini-stats */
.mini-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mini-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: background 0.2s;
}

.mini-stat:hover {
  background: var(--bg-hover);
}

.mini-stat h4 {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.mini-stat p {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 32px 0;
  background: var(--bg-card);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* Form Styles */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; color: var(--text); }
.form-input, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-textarea { resize: vertical; min-height: 140px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: all 0.2s;
}

.btn.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.btn.primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn.secondary {
  background: var(--bg-hover);
  color: var(--text);
}

.btn.secondary:hover {
  background: var(--border);
}

/* Text Content */
.text-content {
  max-width: 800px;
  margin: 40px auto;
  background: var(--bg-card);
  padding: 40px;
  border-radius: 16px;
  border: 1px solid var(--border);
}
.text-content h1 { margin-bottom: 24px; font-size: 2rem; }
.text-content h3 { color: var(--text); margin-top: 32px; margin-bottom: 16px; font-size: 1.25rem; }
.text-content p { margin-bottom: 16px; color: var(--muted); }
.text-content ul { padding-left: 20px; margin-bottom: 16px; color: var(--muted); }
.text-content li { margin-bottom: 8px; }

/* Contact Page Grid */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 40px;
}

@media (max-width: 768px) {
  .contact-grid { grid-template-columns: 1fr; }
  .chart-card { height: 400px; }
  .nav-links { display: none; } /* Simplified for mobile for now */
  .mini-stats-grid { grid-template-columns: 1fr 1fr; } /* Keep 2 cols on mobile for mini stats */
}
