/* CSS DESIGN SYSTEM: MACODE-TRADER */

:root {
  --bg-dark: #080c15;
  --card-bg: rgba(13, 22, 38, 0.55);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-glow: rgba(242, 184, 75, 0.25);
  
  /* Accent Colors */
  --gold: #f2b84b;
  --gold-glow: rgba(242, 184, 75, 0.5);
  --blue: #2979ff;
  --blue-glow: rgba(41, 121, 255, 0.4);
  --success: #00e676;
  --success-glow: rgba(0, 230, 118, 0.4);
  --danger: #ff1744;
  --danger-glow: rgba(255, 23, 68, 0.4);
  
  /* Text */
  --text-main: #f0f4f9;
  --text-muted: #8a99ad;
  --text-dark: #0f172a;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 2rem;
}

/* Ambient glow nodes */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}

.glow-gold {
  background: var(--gold);
  top: -150px;
  left: -150px;
}

.glow-blue {
  background: var(--blue);
  bottom: -150px;
  right: -150px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Frosted glass cards */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border 0.3s ease, box-shadow 0.3s ease;
}

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

/* HEADER STYLE */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
}

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

.icon-logo {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--gold), #ffde91);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.brand-text h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 24px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--card-border);
}

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: relative;
}

.pulse-dot.connected {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success-glow);
  animation: pulse-green 1.5s infinite;
}

.pulse-dot.disconnected {
  background-color: var(--danger);
  box-shadow: 0 0 10px var(--danger-glow);
  animation: pulse-red 1.5s infinite;
}

/* METRICS CARDS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

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

.metric-card:nth-child(4) {
  border-color: var(--card-border-glow);
  box-shadow: 0 8px 32px 0 rgba(242, 184, 75, 0.08);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.4rem;
  color: var(--gold);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-card:nth-child(2) .card-icon { color: var(--blue); }
.metric-card:nth-child(3) .card-icon { color: var(--success); }

.card-info h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-info .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.card-info .sub-value {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* MAIN LAYOUT */
.dashboard-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

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

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

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

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
}

.card-header h2 i {
  color: var(--gold);
}

.badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-accent {
  background: rgba(242, 184, 75, 0.1);
  border-color: rgba(242, 184, 75, 0.2);
  color: var(--gold);
}

/* CHART DESIGN */
.chart-wrapper {
  position: relative;
  height: 300px;
  width: 100%;
}

/* DATA TABLES */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #ffce6b);
  color: var(--text-dark);
  box-shadow: 0 4px 12px rgba(242, 184, 75, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(242, 184, 75, 0.4);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #ff4d6d);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 23, 68, 0.25);
}

.btn-danger:hover {
  box-shadow: 0 6px 18px rgba(255, 23, 68, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

/* NEWS FEED */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 6px;
}

.news-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 14px;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.news-item:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.news-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.news-title {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 6px;
}

.news-title a {
  color: var(--text-main);
  text-decoration: none;
}

.news-title a:hover {
  color: var(--gold);
}

.news-sentiment-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

/* BOTTOM SECTION: SETTINGS & CONSOLE */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

/* Form Styles */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.form-group select option {
  background: #0d1322;
  color: #ffffff;
  padding: 10px;
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold-glow);
}

/* Toggle Switch */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.toggle-checkbox {
  display: none;
}

.toggle-label {
  width: 44px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s ease;
  border: 1px solid var(--card-border);
}

.toggle-label::after {
  content: '';
  width: 16px;
  height: 16px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
}

.toggle-checkbox:checked + .toggle-label {
  background-color: var(--success);
}

.toggle-checkbox:checked + .toggle-label::after {
  transform: translateX(20px);
}

.toggle-text {
  font-size: 0.85rem;
  font-weight: 600;
}

/* SYSTEM CONSOLE LOGS */
.console-wrapper {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 16px;
  height: 230px;
  font-family: 'Space Grotesk', monospace;
  overflow: hidden;
}

.console-body {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #a6b5c9;
}

.console-body::-webkit-scrollbar {
  width: 6px;
}

.console-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.log-line {
  word-break: break-all;
}

/* Color highlights for log levels */
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-blue { color: var(--blue); }
.text-gold { color: var(--gold); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-warning { color: var(--gold); }
.mt-4 { margin-top: 2rem; }
.p-3 { padding: 1rem; }

/* Pulse animations */
@keyframes pulse-green {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(0, 230, 118, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); }
}

@keyframes pulse-red {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(255, 23, 68, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 23, 68, 0); }
}

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

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}
.dashboard-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 40px;
}

/* Telemetry Bar styling */
.telemetry-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: rgba(0, 0, 0, 0.4);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--card-border);
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.telemetry-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  font-weight: 500;
}

.telemetry-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.telemetry-result {
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.telemetry-result.pass {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.25);
}

.telemetry-result.fail {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.25);
}

/* TOP PANELS GRID */
.top-panels-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  margin-bottom: 20px;
}

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

/* DECISION SUMMARY BADGE */
.header-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.decision-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.decision-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.decision-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.signal-buy {
  background: rgba(46, 204, 113, 0.15) !important;
  color: #2ecc71 !important;
  border: 1px solid rgba(46, 204, 113, 0.3) !important;
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.2);
  animation: pulse-green 2s infinite;
}

.signal-sell {
  background: rgba(231, 76, 60, 0.15) !important;
  color: #e74c3c !important;
  border: 1px solid rgba(231, 76, 60, 0.3) !important;
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.2);
  animation: pulse-red 2s infinite;
}

.signal-hold {
  background: rgba(241, 196, 15, 0.1) !important;
  color: #f1c40f !important;
  border: 1px solid rgba(241, 196, 15, 0.2) !important;
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.1);
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* SETTINGS MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 16, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.settings-modal {
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  transform: translateY(30px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .settings-modal {
  transform: translateY(0);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
  padding: 0 5px;
}

.btn-close-modal:hover {
  color: var(--danger);
}

/* RESPONSIVE DESIGN ADJUSTMENTS FOR MOBILE */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    text-align: center;
    padding: 16px 20px;
  }
  
  .brand {
    flex-direction: column;
    gap: 8px;
    justify-content: center;
  }
  
  .header-controls {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .status-indicator {
    justify-content: center;
  }
  
  .telemetry-bar {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)) !important;
    gap: 8px;
    padding: 8px;
  }
  
  .telemetry-item {
    padding: 6px;
  }

  .telemetry-label {
    font-size: 0.65rem;
  }

  .telemetry-val {
    font-size: 0.95rem;
  }
  
  .settings-modal {
    padding: 20px;
    width: 95%;
  }
  
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .card-header {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
  }
  
  .header-title-group {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}
