/* ==========================================================================
     Q-EDGE QUANTITATIVE ENGINE DESIGN SYSTEM - PRODUCTION BUILD v6.2
   ========================================================================== */

/* ---------------------------------------------------------
   1. ROOT VARIABLES & GLOBAL THEME RESETS
   --------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #0f1115;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    padding: 15px;
    overflow-x: hidden;
    line-height: 1.4;
}

.inputs-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2x2 grid on mobile */
  gap: 16px;
  width: 100%;
}

/* If you prefer them all in a row on larger mobile viewports */
@media (min-width: 480px) {
  .inputs-container {
    grid-template-columns: repeat(4, 1fr); /* 4 inline */
  }
}


.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* Allows tabs to drop down cleanly if space runs out */
  gap: 12px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------------------------------------------------------
   2. MONOLITHIC SLAB LAYOUT & CONTROL PARAMETERS
   --------------------------------------------------------- */
.control-panel-slab {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #121212;
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.input-group label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #888888;
    margin-bottom: 8px;
    font-weight: 600;
}

.input-group input {
    background: transparent;
    border: none;
    border-bottom: 1px solid #333333;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 500;
    padding: 4px 0;
    outline: none;
    transition: border-color 0.3s ease, color 0.3s ease;
}

.input-group input:focus {
    border-bottom: 1px solid #ffffff; 
    color: #4da6ff;
}

.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-group input[type=number] {
    -moz-appearance: textfield;
}

/* ---------------------------------------------------------
   3. TYPOGRAPHY & INTERFACES
   --------------------------------------------------------- */
h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ffffff;
}

h2 {
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 700;
    color: #e6edf3;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

label {
    display: block;
    font-size: 12px;
    color: #8aa0b4;
    margin: 10px 0 4px;
}

/* Card Foundations */
.card {
    background: #1a1d24;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* Form Modifiers */
input, select {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #111a24;
    color: #e6edf3;
    outline: none;
    font-size: 14px;
    margin-bottom: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus {
    border-color: #3aa0ff;
    box-shadow: 0 0 0 2px rgba(58, 160, 255, 0.15);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.controls button {
    flex: 1;
    min-width: 120px;
    padding: 10px;
    font-size: 13px;
}

button {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #3aa0ff, #1f6feb);
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

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

#connectBtn { background: #19c37d; }
#disconnectBtn { background: #c0392b; }
#refreshBtn { background: #f39c12; }
#downloadBtn { background: #3498db; }
#autoTradeBtn { background: linear-gradient(135deg, #ff7a18, #af002d); }

/* ---------------------------------------------------------
   4. PERSISTENT ACCOUNT BANNER
   --------------------------------------------------------- */
.mp-wallet-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, #161b22, #0d1117);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wallet-left-meta { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.wallet-status-dot { 
    width: 6px; 
    height: 6px; 
    background-color: #19c37d; 
    border-radius: 50%; 
    box-shadow: 0 0 6px #19c37d; 
}

.wallet-lbl { 
    font-size: 11px; 
    font-weight: 700; 
    color: #8b949e; 
    letter-spacing: 0.5px; 
}

.wallet-right-value { 
    display: flex; 
    align-items: baseline; 
    gap: 5px; 
}

.wallet-currency { 
    font-size: 10px; 
    color: #58a6ff; 
    font-weight: bold; 
}

.wallet-amount { 
    font-family: monospace; 
    font-size: 16px; 
    font-weight: 800; 
    color: #ffffff; 
}

/* ---------------------------------------------------------
   5. REGIME DETECTOR TRACKS
   --------------------------------------------------------- */
.regime-dot.BALANCED { background: #58a6ff; box-shadow: 0 0 8px #58a6ff; }
.regime-dot.TRANSITION { background: #d29922; box-shadow: 0 0 8px #d29922; }
.regime-dot.STRUCTURE { background: #bc8cff; box-shadow: 0 0 8px #bc8cff; }
.regime-dot.STABLE { background: #22c55e; }
.regime-dot.TREND { background: #facc15; }
.regime-dot.CHAOTIC { background: #ef4444; }

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: #21262d;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.25s ease-out;
}
.fill-cyan { background: #58a6ff; }
.fill-orange { background: #f0883e; }
.fill-purple { background: #bc8cff; }
.fill-red { background: #ff7b72; }

/* ---------------------------------------------------------
   6. MONOSPACE VIEWPORT PIPELINES (MONEY PRINTER)
   --------------------------------------------------------- */
#moneyPrinterPanel {
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mp-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.01);
}

.mp-tabs-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.mp-tab {
    background: transparent;
    border: none;
    color: #9ca3af;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mp-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.mp-viewport {
    padding: 16px;
    min-height: 240px;
    max-height: 340px;
    overflow-y: auto;
}

.mp-content { display: none; }
.mp-content.active { display: block; }

/* Active Monitors */
.active-contract-container {
    background: linear-gradient(135deg, rgba(25, 195, 125, 0.04), rgba(0, 0, 0, 0.4));
    border: 1px solid rgba(25, 195, 125, 0.15);
    border-radius: 8px;
    padding: 14px;
}

.active-contract-container.non-active {
    background: rgba(0,0,0,0.15);
    border-color: rgba(255,255,255,0.05);
    opacity: 0.6;
}

.contract-meta-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 700;
    border-bottom: 1px dashed rgba(255,255,255,0.08);
    padding-bottom: 6px;
}

.contract-realtime-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.c-box { display: flex; flex-direction: column; }
.c-lbl { font-size: 11px; color: #9ca3af; margin-bottom: 2px;}
.c-box strong { font-size: 13px; font-family: monospace;}

.pulse-tick-node { display: inline-flex; align-items: center; gap: 6px; }
.tick-dot-pulse {
    width: 8px;
    height: 8px;
    background: #3aa0ff;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 8px #3aa0ff; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.contract-footer-notice {
    font-size: 11px;
    color: #6b7280;
    margin-top: 10px;
    text-align: center;
}

/* Ledgers & Terminals */
.deriv-table-wrapper { max-height: 220px; overflow-y: auto; }
.deriv-history-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.deriv-history-table th { color: #6b7280; padding: 8px; font-size: 11px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.deriv-history-table td { padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,0.03); font-family: monospace; }

.journal-terminal-wrapper {
    background: #090b0e;
    border-radius: 6px;
    padding: 12px;
    height: 180px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(255,255,255,0.02);
}

.journal-log-node { padding: 4px; border-left: 2px solid #4b5563; padding-left: 8px; color: #d1d5db;}
.journal-log-node.bought { border-color: #3b82f6; color: #93c5fd; }
.journal-log-node.won { border-color: #10b981; color: #6ee7b7; background: rgba(16,185,129,0.03); }
.journal-log-node.lost { border-color: #ef4444; color: #fca5a5; background: rgba(239,68,68,0.03); }

/* Persistent Stats Panel */
.mp-persistent-footer {
    background: #11141a;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px;
}

.footer-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 8px;
    margin-bottom: 16px;
}

.f-stat { display: flex; flex-direction: column; }
.f-stat span { font-size: 11px; color: #6b7280; margin-bottom: 2px; }
.f-stat strong { font-size: 13px; font-family: monospace; color: #fff; }

.win-green { color: #10b981 !important; }
.loss-red { color: #ef4444 !important; }
.neutral-text { color: #e5e7eb !important; }

.footer-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.04);
    padding: 12px 16px 16px;
}

.status-indicator-badge { display: flex; align-items: center; gap: 6px; }
.status-dot-node { width: 8px; height: 8px; border-radius: 50%; background: #e74c3c; }
.status-label-node { font-size: 11px; font-weight: 800; color: #9ca3af; }
.footer-btn-group { display: flex; gap: 8px; }

.deriv-secondary-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.deriv-primary-action-btn {
    background: linear-gradient(135deg, #00b060, #008f4c);
    border: none;
    color: white;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

/* ---------------------------------------------------------
   7. PREDICTIVE MATRIX CORE ENGINE (CHASSIS)
   --------------------------------------------------------- */
.engine-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.engine-layout-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
}

.engine-cell {
    background: #11141a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    border-radius: 8px;
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.engine-cell.bias-cell-3 {
    grid-column: span 1;
    padding: 8px;
    text-align: center;
    background: rgba(255,255,255,0.01);
}

.engine-label {
    font-size: 10px;
    color: #8b949e;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.engine-value {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    font-family: monospace;
}

.engine-value.bias-value { font-size: 12px; }

/* High-Contrast Gate Flag */
.decision-container-box {
    grid-column: 1 / -1;
    width: 100%;
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 14px 20px;
    margin-top: 6px;
    position: relative;
}

.decision-display-value {
    font-size: 22px;
    font-weight: 900;
    text-transform: uppercase;
    font-family: monospace;
    display: block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

.decision-container-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #58a6ff, transparent);
}

.decision-display-value.CALL { color: #19c37d; text-shadow: 0 0 12px rgba(25, 195, 125, 0.3); }
.decision-display-value.PUT  { color: #ef4444; text-shadow: 0 0 12px rgba(239, 68, 68, 0.3); }
.decision-display-value.HOLD { color: #8b949e; }

/* ---------------------------------------------------------
   8. TELEMETRY FEEDS & TABLES
   --------------------------------------------------------- */
.metric { margin-bottom: 14px; }
.metric-label { color: #aaaaaa; font-size: 12px; margin-bottom: 4px; }
.metric-value { font-size: 24px; font-weight: bold; font-family: monospace; }

#frequencyTable table, #probabilityTable table { width: 100%; border-collapse: collapse; font-size: 13px; }
#frequencyTable th, #probabilityTable th, #frequencyTable td, #probabilityTable td { padding: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
#frequencyTable th, #probabilityTable th { color: #6b7280; font-size: 11px; text-transform: uppercase; }

.highlight-row { background: rgba(25, 195, 125, 0.15); }
.highlight-row td:last-child { color: #19c37d; font-weight: bold; }

/* ---------------------------------------------------------
   9. TRANSITION MODULES & BAYESIAN SYSTEM BLOCKS
   --------------------------------------------------------- */
.transition-container-grid { display: flex; flex-direction: column; gap: 15px; width: 100%; }
.current-digit-banner { background: #262b35; border-radius: 12px; padding: 16px; text-align: center; }
.prediction-engine-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }

.engine-prediction-card {
    background: #1f2430;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 105px;
}

.analysis-title { color: #a5a5a5; font-size: 10px; text-transform: uppercase; font-weight: 600; }
.analysis-value { font-size: 24px; font-weight: 800; color: #ffffff; font-family: monospace; }
.confidence-sub-label { font-size: 11px; color: #8aa0b4; }

.prediction-status {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    width: fit-content;
    margin: 12px auto 0;
}

.status-tag { font-size: 11px; color: #aaa; display: inline-flex; align-items: center; }
.hit-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; background: #6b7280; }
.hit-dot.hit { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.7); }
.hit-dot.miss { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.7); }

/* ---------------------------------------------------------
   10. STATUS NODES & SERIAL LOGGERS
   --------------------------------------------------------- */
#statusContainer { display: flex; align-items: center; gap: 8px; font-size: 12px; }
#statusDot { width: 10px; height: 10px; border-radius: 50%; }
#statusDot.connected { background: #19c37d; }
#statusDot.disconnected { background: #808080; }

#recentDigits {
    max-height: 200px;
    overflow-y: auto;
    line-height: 2;
    word-break: break-all;
    font-size: 16px;
    background: #12151b;
    padding: 12px;
    border-radius: 8px;
    font-family: monospace;
    letter-spacing: 2px;
}

/* ---------------------------------------------------------
   11. HARDWARE BREAKPOINTS (MOBILE SCALING ADAPTERS)
   --------------------------------------------------------- */
@media (max-width: 600px) {
    h1 { font-size: 20px; }
    .footer-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .prediction-engine-grid { grid-template-columns: 1fr; gap: 10px; }
    .engine-prediction-card { min-height: auto; padding: 12px; }
    .control-panel-slab { flex-direction: column; gap: 14px; padding: 16px; }
    .input-group { width: 100%; }
}

@media (max-width: 480px) {
    .engine-layout-grid { grid-template-columns: repeat(2, 1fr); }
    .engine-cell { grid-column: span 2; }
    .engine-cell.bias-cell-3 { grid-column: span 1; }
}


