/* ==========================================================================
   Quant Scalper Modern Design System & CSS Tokens
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(28, 36, 56, 0.95);
  --bg-input: #121827;
  --border: #1e293b;
  --border-focus: #38bdf8;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --accent-purple: #8b5cf6;

  --gradient-card: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
  --gradient-btn: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --gradient-danger: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 15px rgba(56, 189, 248, 0.25);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header & Navigation */
header {
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--gradient-btn);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.5);
  padding: 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.nav-tab {
  padding: 0.5rem 1rem;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  background: var(--accent-cyan);
  color: #0b0f19;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Header Status Indicators */
.header-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
}

.status-dot.active {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.warning {
  background: var(--accent-yellow, #f59e0b);
  box-shadow: 0 0 8px var(--accent-yellow, #f59e0b);
}

/* Layout Container */
main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card Styles */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.75rem; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: 1fr; }
}

/* Metric Display Boxes */
.metric-box {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-val {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.metric-val.pos { color: var(--accent-green); }
.metric-val.neg { color: var(--accent-red); }
.metric-val.neutral { color: var(--accent-cyan); }

/* Buttons & Controls */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--gradient-btn);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-glow);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
}

.btn-danger {
  background: var(--gradient-danger);
  color: white;
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
}

.btn-warning {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  color: white;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

.btn-warning:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

button:disabled, .btn:disabled {
  opacity: 0.42 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(0.55) !important;
  box-shadow: none !important;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

/* Inputs & Form Elements */
input[type="text"], input[type="number"], input[type="date"], select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

input:focus, select:focus {
  border-color: var(--border-focus);
}

input:disabled, select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Checkbox & Toggle Styling */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.form-check input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Data Tables */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

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

th {
  background: rgba(15, 23, 42, 0.9);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Config Override Ribbon */
.config-ribbon {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.param-override-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.3);
}

.param-override-row:hover {
  background: rgba(30, 41, 59, 0.5);
}

/* Progress Bars */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-btn);
  width: 0%;
  transition: width 0.3s ease;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease-out;
}

.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.info { border-left: 4px solid var(--accent-cyan); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal Overlay & Dialog */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.4);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.date-chip-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 20px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.date-chip-green:hover {
  background: var(--accent-green);
  color: #0b0f19;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

/* User-Provided Stat Grid & Modern Metric Card Styles */
.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px) {
  .md\:grid-cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .md\:grid-cols-7 {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .md\:col-span-1 {
    grid-column: span 1 / span 1;
  }
}
.stat-grid-7 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
@media (min-width: 640px) {
  .stat-grid-7 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .stat-grid-7 {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}
.stat-grid-9 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
@media (min-width: 640px) {
  .stat-grid-9 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .stat-grid-9 {
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  }
}
.stat-card-box {
  background-color: #0c1222;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 58px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.stat-card-box:hover {
  border-color: #3b82f6;
  transform: translateY(-1px);
}
.stat-card-box .stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card-box .stat-val {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.col-span-2 {
  grid-column: span 2 / span 2;
}
.gap-3 {
  gap: 0.75rem;
}
.bg-dark-900 {
  background-color: #0c1222;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.bg-dark-900:hover {
  border-color: #334155;
}
.border-dark-800 {
  border: 1px solid #1e293b;
}
.p-3 {
  padding: 0.75rem;
}
.rounded-lg {
  border-radius: 0.5rem;
}
.text-\[10px\] {
  font-size: 10px;
}
.text-gray-400 {
  color: #94a3b8;
}
.uppercase {
  text-transform: uppercase;
}
.tracking-wider {
  letter-spacing: 0.05em;
}
.block {
  display: block;
}
.text-lg {
  font-size: 1.15rem;
}
.font-bold {
  font-weight: 700;
}
.font-mono {
  font-family: var(--font-mono);
}
.text-emerald-400 {
  color: #34d399;
}
.text-rose-400 {
  color: #fb7185;
}
.text-amber-400 {
  color: #fbbf24;
}
.text-cyan-400 {
  color: #38bdf8;
}
.text-gray-100 {
  color: #f1f5f9;
}

/* ─── AI Strategy Tab Styles (OAMM-v1) ────────────────────────── */
.ai-pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ai-pillar-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  padding: 1.1rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
}

.ai-pillar-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
}

.ai-pillar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.ai-pillar-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.ai-pillar-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.ai-pillar-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.45;
  margin: 0;
}

.ai-control-panel {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ai-control-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ai-sim-status {
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ─── Other Strategies Subtabs Styles ────────────────────────── */
.other-strat-subtab-btn:hover {
  border-color: rgba(56, 189, 248, 0.4) !important;
  color: var(--text-main) !important;
}

.other-strat-subtab-btn.active {
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.18);
}

/* ─── Strategy Definitions Tab Styles ────────────────────────── */
.strat-category-pill {
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}
.strat-category-pill:hover {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.3);
}
.strat-category-pill.active {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.strat-detail-card {
  background: linear-gradient(135deg, rgba(18, 24, 38, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.25s ease;
}
.strat-detail-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.formula-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #38bdf8;
  margin: 0.75rem 0;
  line-height: 1.5;
}

.rule-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.strat-quick-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}
.strat-quick-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.3);
}
.strat-quick-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

