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

:root {
  --bg-primary: #0a0d14;
  --bg-card: rgba(18, 24, 38, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-green: #00e676;
  --accent-red: #ff1744;
  --accent-gold: #ffb300;
  --text-main: #f0f4f8;
  --text-muted: #94a3b8;
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
}

body {
  background: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 242, 254, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(79, 172, 254, 0.08) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  padding: 20px;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: var(--glass-shadow);
}

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

.brand-icon {
  font-size: 28px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.online {
  background: rgba(0, 230, 118, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.status-badge.offline {
  background: rgba(255, 23, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(255, 23, 68, 0.3);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* Control Buttons */
.controls-bar {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-start {
  background: linear-gradient(135deg, #00c853, #00e676);
  color: #000;
}

.btn-stop {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-emergency {
  background: linear-gradient(135deg, #d50000, #ff1744);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 23, 68, 0.4);
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--glass-shadow);
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
}

.card-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
}

.card-value.green { color: var(--accent-green); }
.card-value.red { color: var(--accent-red); }
.card-value.cyan { color: var(--accent-cyan); }

/* Main Section Layout */
.main-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

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

/* Live Terminal Log */
.log-box {
  position: relative;
  background: #05070a;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  height: 380px;
  overflow-y: auto;
  font-family: 'Consolas', 'Fira Code', Monaco, monospace;
  font-size: 13px;
  line-height: 1.6;
  transition: height 0.3s ease;
}

.log-box.expanded {
  height: 650px;
  font-size: 14px;
}

.log-filter-select,
.log-search-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 11px;
  padding: 4px 8px;
  outline: none;
  transition: border-color 0.2s ease;
}

.log-filter-select:focus,
.log-search-input:focus {
  border-color: var(--accent-cyan);
}

.log-search-input {
  width: 130px;
}

.scroll-pause-banner {
  background: rgba(255, 179, 0, 0.15);
  color: #ffb74d;
  border: 1px solid rgba(255, 179, 0, 0.3);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scroll-pause-banner:hover {
  background: rgba(255, 179, 0, 0.25);
}

.btn-log-tool {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-log-tool:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Log Level Color Schemes */
.log-entry {
  margin-bottom: 4px;
  color: #a0aec0;
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}

.log-entry.log-error {
  color: #ff5252;
  background: rgba(255, 23, 68, 0.1);
  border-left: 3px solid #ff1744;
  font-weight: 600;
}

.log-entry.log-warn {
  color: #ffb74d;
  background: rgba(255, 152, 0, 0.08);
  border-left: 3px solid #ff9800;
}

.log-entry.log-trade {
  color: #00f2fe;
  background: rgba(0, 242, 254, 0.08);
  border-left: 3px solid #00f2fe;
  font-weight: 500;
}

.log-entry.log-signal {
  color: #00e676;
  background: rgba(0, 230, 118, 0.08);
  border-left: 3px solid #00e676;
}

.log-entry.log-system {
  color: #ab47bc;
  background: rgba(171, 71, 188, 0.08);
  border-left: 3px solid #ab47bc;
}

.log-entry.log-info {
  color: #cbd5e1;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* Login Modal Overlay */
.login-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 10, 0.92);
  backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-box {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 30px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

/* Trade Journal Table */
.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

.journal-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 11px;
}

.journal-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.journal-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.pnl-green { color: var(--accent-green); font-weight: 600; }
.pnl-red { color: var(--accent-red); font-weight: 600; }

.btn-journal-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-journal-tab:hover, .btn-journal-tab.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Mobile & Responsive Enhancements */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 16px;
  }

  .brand {
    flex-direction: column;
    gap: 6px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .controls-bar {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .controls-bar .status-badge {
    width: 100%;
    justify-content: center;
  }

  .controls-bar .btn,
  .controls-bar .btn-log-tool {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    text-align: center;
    font-size: 12px;
    padding: 10px 12px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .card-title {
    font-size: 11px;
  }

  .card-value {
    font-size: 20px;
  }

  .main-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .log-box {
    height: 300px;
    font-size: 11px;
    padding: 12px;
  }

  .log-box.expanded {
    height: 450px;
  }

  .journal-table th, 
  .journal-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
}

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

  .controls-bar .btn,
  .controls-bar .btn-log-tool {
    flex: 1 1 100%;
  }

  .brand h1 {
    font-size: 16px;
  }

  .login-box {
    padding: 20px;
    width: 95%;
  }
}

