/* ==========================================================================
   DESIGN SYSTEM & THEME VARIABLES
   ========================================================================== */
:root {
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* --- DARK THEME (DEFAULT) --- */
  --bg-gradient-start: #0f0c1b;
  --bg-gradient-end: #030712;
  
  --card-bg: rgba(13, 16, 27, 0.65);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-glow: rgba(6, 182, 212, 0.05);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-color: #06b6d4;      /* Cyber Cyan */
  --accent-secondary: #8b5cf6;  /* Purple Electric */
  --accent-glow: rgba(6, 182, 212, 0.4);

  --success-color: #10b981;     /* Neon Green */
  --success-glow: rgba(16, 185, 129, 0.15);
  
  --danger-color: #f43f5e;      /* Neon Rose/Red */
  --danger-glow: rgba(244, 63, 94, 0.18);
  
  --warning-color: #fbbf24;     /* Neon Amber */
  --warning-glow: rgba(251, 191, 36, 0.15);

  --input-bg: rgba(15, 23, 42, 0.4);
  --input-border: rgba(255, 255, 255, 0.09);
  --input-color: #f8fafc;

  --border-radius-lg: 20px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --box-shadow-glow: 0 0 20px rgba(6, 182, 212, 0.15);
}

/* --- LIGHT THEME --- */
body.light-mode {
  --bg-gradient-start: #e0e7ff;
  --bg-gradient-end: #f8fafc;
  
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(15, 23, 42, 0.1);
  --card-glow: rgba(37, 99, 235, 0.02);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --accent-color: #2563eb;      /* Tech Blue */
  --accent-secondary: #7c3aed;  /* Royal Purple */
  --accent-glow: rgba(37, 99, 235, 0.2);

  --success-color: #059669;     /* Deep Emerald */
  --success-glow: rgba(5, 150, 105, 0.1);
  
  --danger-color: #dc2626;      /* Rich Crimson */
  --danger-glow: rgba(220, 38, 38, 0.1);
  
  --warning-color: #d97706;     /* Warm Amber */
  --warning-glow: rgba(217, 119, 6, 0.1);

  --input-bg: rgba(255, 255, 255, 0.95);
  --input-border: rgba(15, 23, 42, 0.15);
  --input-color: #0f172a;

  --box-shadow-glow: 0 4px 20px rgba(37, 99, 235, 0.08);
}

/* ==========================================================================
   RESET & GLOBAL STYLES
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: radial-gradient(circle at 50% 0%, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 75%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  transition: background 0.5s ease, color 0.3s ease;
}

h1, h2, h3, h4, .balance-display {
  font-family: var(--font-display);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
}

/* ==========================================================================
   COMPONENTS: CARDS & GLASSMORPHISM
   ========================================================================== */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.25), var(--box-shadow-glow);
  border-color: rgba(6, 182, 212, 0.2);
}

body.light-mode .glass-card:hover {
  border-color: rgba(37, 99, 235, 0.2);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

.card-header h3 i {
  color: var(--accent-color);
  text-shadow: 0 0 10px var(--accent-glow);
}

.card-body {
  padding: 24px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

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

.logo-icon {
  font-size: 2.3rem;
  color: var(--accent-color);
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.header-logo h1 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

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

/* Status Badges */
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}

.status-online {
  background: var(--success-glow);
  color: var(--success-color);
  border-color: rgba(16, 185, 129, 0.18);
}

.status-offline {
  background: var(--danger-glow);
  color: var(--danger-color);
  border-color: rgba(244, 63, 94, 0.18);
}

.status-none {
  background: var(--input-bg);
  color: var(--text-muted);
  border-color: var(--input-border);
}

.status-paper {
  background: var(--warning-glow);
  color: var(--warning-color);
  border-color: rgba(251, 191, 36, 0.18);
}

.status-live {
  background: var(--success-glow);
  color: var(--success-color);
  border-color: rgba(16, 185, 129, 0.18);
}

/* ==========================================================================
   NAVIGATION TABS
   ========================================================================== */
.nav-tabs-container {
  display: flex;
  gap: 12px;
}

.nav-tab {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.25);
}

body.light-mode .nav-tab {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .nav-tab:hover {
  background: rgba(15, 23, 42, 0.1);
  color: var(--text-primary);
}

body.light-mode .nav-tab.active {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25);
}

/* ==========================================================================
   LAYOUT GRID
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  transition: var(--transition-smooth);
}

.grid-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ==========================================================================
   WIDGET: KONTOSTAND
   ========================================================================== */
.balance-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 20px;
}

.balance-display .currency {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 4px;
}

#equity-val {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1px;
}

.eur-sub-val {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 6px;
}

.balance-display .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-top: 10px;
}

.balance-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.detail-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  padding: 12px;
  border-radius: var(--border-radius-md);
  text-align: center;
  transition: var(--transition-smooth);
}

body.light-mode .detail-item {
  background: rgba(0, 0, 0, 0.02);
}

.detail-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.light-mode .detail-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

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

.detail-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.detail-value-eur {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

/* ==========================================================================
   WIDGET: STRATEGIE-INDIKATOREN
   ========================================================================== */
.indicators-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ind-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-md);
  transition: var(--transition-smooth);
}

body.light-mode .ind-item {
  background: rgba(0, 0, 0, 0.02);
}

.ind-item:hover {
  transform: scale(1.01);
  background: rgba(255, 255, 255, 0.04);
}

body.light-mode .ind-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.ind-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ind-label i {
  color: var(--accent-secondary);
}

.ind-value {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

.ind-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px var(--accent-glow);
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ind-dot-active {
  background: var(--success-color);
  animation: pulse-glow 2s infinite;
}

.ind-dot-inactive {
  background: var(--text-muted);
}

.ind-item.inactive-item {
  opacity: 0.45;
}

.trend-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.trend-badge.bullish {
  background: var(--success-glow);
  color: var(--success-color);
}

.trend-badge.bearish {
  background: var(--danger-glow);
  color: var(--danger-color);
}

.trend-badge.inactive {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

body.light-mode .trend-badge.inactive {
  background: rgba(0, 0, 0, 0.04);
}

/* RSI Bar styling */
.rsi-bar-container {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
}

body.light-mode .rsi-bar-container {
  background: rgba(0, 0, 0, 0.08);
}

.rsi-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-color);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ==========================================================================
   WIDGET: OFFENE POSITIONEN
   ========================================================================== */
.pos-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  padding: 16px;
  border-radius: var(--border-radius-md);
  margin-bottom: 12px;
  transition: var(--transition-smooth);
}

body.light-mode .pos-item {
  background: rgba(0, 0, 0, 0.02);
}

.pos-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-color);
}

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

.pos-title {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-side-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pos-side-badge.long {
  background: var(--success-glow);
  color: var(--success-color);
}

.pos-side-badge.short {
  background: var(--danger-glow);
  color: var(--danger-color);
}

.pos-pnl {
  font-size: 1.1rem;
  font-weight: 800;
}

.pos-pnl.profit {
  color: var(--success-color);
}

.pos-pnl.loss {
  color: var(--danger-color);
}

.pos-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--card-border);
}

@media (max-width: 480px) {
  .pos-details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pos-det-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.pos-det-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.pos-det-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.pos-det-subvalue {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

/* Backtest Stats Summary Grid */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .stats-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  padding: 14px 10px;
  border-radius: var(--border-radius-md);
  text-align: center;
  transition: var(--transition-smooth);
}

body.light-mode .stat-card {
  background: rgba(0, 0, 0, 0.02);
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--box-shadow-glow);
}

body.light-mode .stat-card:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.08);
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  font-family: var(--font-display);
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state i {
  font-size: 2.2rem;
  margin-bottom: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   WIDGET: CHART CARD
   ========================================================================== */
.chart-card {
  min-height: 480px;
}

.chart-card .card-body {
  padding: 0;
  height: 480px;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   WIDGET: BOT-AKTIVITÄTSPROTOKOLL (LOGS)
   ========================================================================== */
.log-container {
  height: 250px;
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 8px;
}

.log-item {
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--accent-color);
  line-height: 1.4;
  color: #e2e8f0;
}

body.light-mode .log-item {
  background: rgba(0, 0, 0, 0.03);
  color: #0f172a;
}

.log-item.log-success {
  border-left-color: var(--success-color);
  background: rgba(16, 185, 129, 0.05);
}

.log-item.log-warning {
  border-left-color: var(--warning-color);
  background: rgba(251, 191, 36, 0.05);
}

.log-item.log-error {
  border-left-color: var(--danger-color);
  background: rgba(244, 63, 94, 0.05);
}

/* ==========================================================================
   SYSTEM MODALS (FROSTED GLASS DIALOGS)
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
}

.hidden {
  display: none !important;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  padding: 32px;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.light-mode .modal-content {
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header h2 i {
  color: var(--accent-color);
  text-shadow: 0 0 8px var(--accent-glow);
}

.modal-close {
  cursor: pointer;
  font-size: 2rem;
  color: var(--text-muted);
  line-height: 1;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--card-border);
  padding: 20px;
  border-radius: var(--border-radius-md);
}

body.light-mode .settings-section {
  background: rgba(0, 0, 0, 0.01);
  border-color: rgba(15, 23, 42, 0.08);
}

.settings-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-color);
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.system-buttons button {
  width: 100%;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row-full {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px;
  grid-column: span 2 !important;
  width: 100% !important;
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Inputs, Selects, Textareas */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="password"],
select,
textarea {
  background: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  color: var(--input-color) !important;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Checkbox container override */
.checkbox-group {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.checkbox-group input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Modern Switch Toggle styling */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.25);
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--card-border);
  transition: var(--transition-smooth);
}

body.light-mode .switch-container {
  background: rgba(15, 23, 42, 0.03);
}

.switch-container:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(6, 182, 212, 0.2);
}

body.light-mode .switch-container:hover {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(37, 99, 235, 0.2);
}

.switch-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.switch-label .desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* The switch itself */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-muted);
  transition: .3s ease;
  border-radius: 22px;
}

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

.switch input:checked + .slider {
  background-color: var(--accent-color);
}

.switch input#set-dry-run:checked + .slider {
  background-color: var(--warning-color);
}

.switch input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-color);
}

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

.modal-footer {
  border-top: 1px solid var(--card-border);
  padding-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   BUTTONS (MODERN NEON GRADIENTS)
   ========================================================================== */
.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4), 0 0 15px var(--accent-glow);
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--input-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.light-mode .btn-secondary {
  background: #cbd5e1 !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
}

body.light-mode .btn-secondary:hover {
  background: #94a3b8 !important;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color), #be123c);
  color: white;
  box-shadow: 0 4px 15px rgba(244, 63, 94, 0.25);
}

.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4), 0 0 15px var(--danger-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-color), #047857);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4), 0 0 15px var(--success-glow);
}

.btn-icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50% !important;
}

.btn-small {
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
}

/* ==========================================================================
   WIDGET: TOAST NOTIFICATIONS
   ========================================================================== */
#toast-container, .toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-notification {
  background: rgba(13, 16, 27, 0.80);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 14px 18px;
  border-radius: var(--border-radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 480px;
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: #ffffff;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-notification.hide {
  opacity: 0;
  transform: translateX(50px) scale(0.95);
}

body.light-mode .toast-notification {
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
  border-color: rgba(15, 23, 42, 0.08);
}

.toast-notification.success {
  border-left: 4px solid var(--success-color);
}

.toast-notification.error {
  border-left: 4px solid var(--danger-color);
}

.toast-notification.warning {
  border-left: 4px solid var(--warning-color);
}

.toast-notification.info {
  border-left: 4px solid var(--accent-color);
}

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast-notification.success .toast-icon {
  color: var(--success-color);
}

.toast-notification.error .toast-icon {
  color: var(--danger-color);
}

.toast-notification.warning .toast-icon {
  color: var(--warning-color);
}

.toast-notification.info .toast-icon {
  color: var(--accent-color);
}

.toast-message {
  flex: 1;
  font-size: 0.85rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
}

body.light-mode .toast-message {
  color: #0f172a;
}

.toast-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

.toast-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

body.light-mode .toast-close-btn {
  color: rgba(15, 23, 42, 0.4);
}

body.light-mode .toast-close-btn:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.1);
}

@media (max-width: 576px) {
  #toast-container, .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }
  
  .toast-notification {
    min-width: 0;
    width: 100%;
    padding: 12px 16px;
  }
}

/* ==========================================================================
   ANIMATIONS & EFFECTS
   ========================================================================== */
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
}

body.light-mode .loading-overlay {
  background: rgba(255, 255, 255, 0.8);
}

.loading-content {
  text-align: center;
}

.loading-icon {
  font-size: 3rem;
  color: var(--accent-color);
  margin-bottom: 16px;
  text-shadow: 0 0 10px var(--accent-glow);
}

/* ==========================================================================
   AI DETAIL MODAL SPECIALS
   ========================================================================== */
.ai-modal-content {
  width: 90% !important;
  max-width: 900px !important;
}

.ai-modal-body {
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 8px;
}

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

.ai-modal-body::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

/* Copy feedback indicator */
.copy-feedback {
  font-size: 0.85rem;
  color: var(--success-color);
  margin-left: 12px;
  display: inline-block;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.copy-feedback.show {
  opacity: 1;
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVENESS)
   ========================================================================== */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .main-header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    padding: 16px 20px;
  }
  
  .header-controls {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .modal-content {
    padding: 20px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
}

@media (min-width: 992px) {
  .modal-content {
    width: 950px !important; /* Wider on Desktop */
  }
  
  .ai-modal-content {
    width: 980px !important; /* Even wider for AI Analysis text */
  }

  /* Settings multi-column layout enhancement */
  #settings-form .settings-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  
  #settings-form .settings-section h3 {
    grid-column: span 2;
  }
  
  #settings-form .form-row {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0;
  }
}

/* ==========================================================================
   LOGIN SCREEN (PREMIUM GLASSMORPHISM & AI BACKGROUND)
   ========================================================================== */
.login-screen-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.9) 100%),
              url('login_bg.png') no-repeat center center fixed;
  background-size: cover;
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
}

.login-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
              0 0 40px rgba(37, 99, 235, 0.15);
  text-align: center;
  animation: modalFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent-color), #4f46e5);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 24px auto;
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

.logo-icon-large {
  font-size: 36px;
  color: white;
  animation: pulse 2s infinite ease-in-out;
}

.login-card h2 {
  font-size: 1.85rem;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group-custom {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group-custom .input-icon {
  position: absolute;
  left: 16px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 18px;
}

.input-group-custom input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-md);
  color: white;
  font-size: 1rem;
  outline: none;
  transition: var(--transition-smooth);
}

.input-group-custom input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.25);
  background: rgba(15, 23, 42, 0.95);
}

.login-error-msg {
  color: var(--danger-color);
  font-size: 0.85rem;
  text-align: left;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 10px 14px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-block {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
}

.login-footer {
  margin-top: 36px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
}

body.light-mode .login-screen-container {
  background: radial-gradient(circle at center, rgba(241, 245, 249, 0.3) 0%, rgba(241, 245, 249, 0.95) 100%),
              url('login_bg.png') no-repeat center center fixed;
  background-size: cover;
}

body.light-mode .login-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15),
              0 0 30px rgba(37, 99, 235, 0.08);
}

body.light-mode .login-card h2 {
  color: #0f172a;
}

body.light-mode .login-subtitle {
  color: #64748b;
}

body.light-mode .input-group-custom input {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

body.light-mode .input-group-custom input:focus {
  background: #ffffff;
  border-color: var(--accent-color);
}

body.light-mode .input-group-custom .input-icon {
  color: #64748b;
}

body.light-mode .login-footer {
  color: #64748b;
}

/* Custom Password Toggle & Login UI additions */
.input-group-custom input {
  padding-right: 48px !important;
}

.password-toggle-btn {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: var(--transition-smooth);
  z-index: 10;
  height: 100%;
}

.password-toggle-btn:hover {
  color: white;
}

body.light-mode .password-toggle-btn {
  color: #64748b;
}

body.light-mode .password-toggle-btn:hover {
  color: #0f172a;
}

.login-options {
  display: flex;
  justify-content: flex-end;
  margin-top: -12px;
  margin-bottom: 4px;
}

.login-link {
  color: var(--accent-color);
  font-size: 0.85rem;
  text-decoration: none;
  transition: var(--transition-smooth);
  cursor: pointer;
  font-weight: 500;
}

.login-link:hover {
  text-decoration: underline;
  color: #60a5fa;
}

body.light-mode .login-link:hover {
  color: #1d4ed8;
}

.auth-toggle-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 18px;
}

body.light-mode .auth-toggle-text {
  color: #64748b;
}

/* Custom form fields with labels styling */
.form-field {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 8px;
}

.field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
}

body.light-mode .field-label {
  color: #475569;
}

/* Custom Confirm Modal Styling */
.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.confirm-modal-overlay.show {
  opacity: 1;
}

.confirm-modal-overlay.hide {
  opacity: 0;
}

.confirm-modal-card {
  width: 90%;
  max-width: 440px;
  background: rgba(13, 16, 27, 0.85);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  text-align: left;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 0 24px rgba(255, 255, 255, 0.02);
  transform: scale(0.9) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal-overlay.show .confirm-modal-card {
  transform: scale(1) translateY(0);
}

.confirm-modal-card.danger-glow {
  box-shadow: 0 0 30px rgba(244, 63, 94, 0.1), 0 20px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(244, 63, 94, 0.2);
}

.confirm-modal-header {
  margin-bottom: 16px;
}

.confirm-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-danger {
  color: var(--danger-color);
}

.text-accent {
  color: var(--accent-color);
}

.confirm-modal-body {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.confirm-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.confirm-modal-footer .btn {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

body.light-mode .confirm-modal-card {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.1);
}

/* Quick Select Pair Pills */
.pair-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

body.light-mode .pair-pill {
  background: rgba(15, 23, 42, 0.02);
  color: var(--text-secondary);
}

.pair-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

body.light-mode .pair-pill:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
}

.pair-pill.selected {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

body.light-mode .pair-pill.selected {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

