/* ==========================================================================
   AEGIS QUANTUM - STYLING SHEET (VANILLA CSS)
   Aesthetic Concept: Space Dark Mode, Glassmorphic Panels, Glowing Neon accents.
   ========================================================================== */

:root {
    --bg-primary: #080b11;
    --bg-secondary: #0d121f;
    --glass-bg: rgba(13, 18, 31, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-glow: rgba(59, 130, 246, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Neon Accent Colors */
    --neon-green: #00f5c4;
    --neon-green-glow: rgba(0, 245, 196, 0.35);
    --neon-red: #ff3b69;
    --neon-red-glow: rgba(255, 59, 105, 0.35);
    --neon-cyan: #00d2ff;
    --neon-purple: #bd00ff;
    --neon-amber: #ffaa00;
    
    /* Fonts */
    --font-header: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #080b11;
}
::-webkit-scrollbar-thumb {
    background: #1f2937;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #374151;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Dynamic Background Glow Spheres */
.glow-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.22;
}

.glow-purple {
    top: -10%;
    right: 15%;
    width: 450px;
    height: 450px;
    background: var(--neon-purple);
    animation: floatGlow 15s infinite alternate ease-in-out;
}

.glow-cyan {
    bottom: 10%;
    left: 5%;
    width: 500px;
    height: 500px;
    background: var(--neon-cyan);
    animation: floatGlow 18s infinite alternate-reverse ease-in-out;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 40px) scale(1.15); }
}

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

/* Header styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-radius: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    flex-wrap: wrap;
    gap: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    position: relative;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

.logo-pulse {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid var(--neon-cyan);
    border-radius: 12px;
    opacity: 0.6;
    animation: logoPulse 2.5s infinite ease-out;
}

@keyframes logoPulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.25); opacity: 0; }
}

.logo-text h1 {
    font-family: var(--font-header);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.logo-text h1 span {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.logo-text p {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-top: 1px;
}

/* Stock selector buttons */
.stock-selector-container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.selector-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-chips {
    display: flex;
    gap: 8px;
}

.chip {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-family: var(--font-header);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.chip.active {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.15), rgba(189, 0, 255, 0.15));
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
}

.custom-input-group {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.custom-input-group:focus-within {
    border-color: var(--neon-purple);
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.15);
}

.custom-input-group input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    padding: 8px 14px;
    font-size: 12px;
    width: 140px;
    font-weight: 500;
}

.custom-input-group button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0 12px;
    cursor: pointer;
    transition: color 0.3s;
}

.custom-input-group button:hover {
    color: var(--neon-cyan);
}

/* Glassmorphism Card Core */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px 0 rgba(0, 0, 0, 0.35);
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: 100%;
}

/* ROW 1: METRICS Grid */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.metric-card {
    padding: 20px;
    min-height: 165px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

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

.metric-title {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.icon-metric {
    font-size: 15px;
    color: var(--text-muted);
}

/* 1. Decision Card */
.decision-card {
    border-top: 3px solid var(--neon-green);
    background: linear-gradient(180deg, rgba(0, 245, 196, 0.03) 0%, rgba(13, 18, 31, 0.45) 100%);
}

.decision-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.decision-signal {
    font-family: var(--font-header);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.text-gradient-green {
    background: linear-gradient(135deg, #05f2c7, #00ab8d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 245, 196, 0.15);
}

.text-gradient-red {
    background: linear-gradient(135deg, #ff4a70, #c4002b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-amber {
    background: linear-gradient(135deg, #ffb629, #c78000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.pulse-ring::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    animation: ringPulse 1.8s infinite ease-out;
}

.pointer-green { background-color: var(--neon-green); box-shadow: 0 0 10px var(--neon-green); }
.pointer-green::after { border: 1.5px solid var(--neon-green); }

.pointer-red { background-color: var(--neon-red); box-shadow: 0 0 10px var(--neon-red); }
.pointer-red::after { border: 1.5px solid var(--neon-red); }

.pointer-amber { background-color: var(--neon-amber); box-shadow: 0 0 10px var(--neon-amber); }
.pointer-amber::after { border: 1.5px solid var(--neon-amber); }

@keyframes ringPulse {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

.decision-reason {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 2. Confidence Card */
.confidence-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.confidence-circle-container {
    margin: 8px 0;
}

/* Circular Progress Bar */
.circular-progress {
    position: relative;
    height: 90px;
    width: 90px;
    border-radius: 50%;
    background: conic-gradient(var(--neon-cyan) 0deg, rgba(255,255,255,0.05) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.8s ease;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.circular-progress::before {
    content: "";
    position: absolute;
    height: 76px;
    width: 76px;
    border-radius: 50%;
    background-color: #0e1322;
}

.value-container {
    position: relative;
    font-family: var(--font-header);
    font-size: 21px;
    font-weight: 700;
    color: var(--text-primary);
}

.confidence-desc {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
}

/* 3. Volatility Card */
.volatility-card {
    border-top: 3px solid var(--neon-purple);
}

.volatility-risk {
    font-family: var(--font-header);
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 2px 0;
}

.volatility-stats {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
}

.stat-val {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.risk-badge-container {
    margin-top: 8px;
}

.risk-badge {
    padding: 2px 8px;
    background: rgba(189, 0, 255, 0.12);
    border: 1px solid rgba(189, 0, 255, 0.25);
    border-radius: 4px;
    font-size: 10px;
    color: #df8eff;
    font-weight: 500;
}

/* 4. Target Card */
.price-value {
    font-family: var(--font-header);
    font-size: 28px;
    font-weight: 700;
}

.return-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: -2px;
}

.indicator-up { color: var(--neon-green); }
.indicator-down { color: var(--neon-red); }

.target-boundaries {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

.boundary-item {
    display: flex;
    flex-direction: column;
}

.boundary-item .lbl {
    font-size: 9px;
    color: var(--text-muted);
}

.boundary-item .val {
    font-size: 12px;
    font-weight: 700;
}

.text-green { color: var(--neon-green); }
.text-red { color: var(--neon-red); }

/* ROW 2: CHART & WEIGHT SECTION */
.chart-and-weight-row {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 16px;
}

@media (max-width: 992px) {
    .chart-and-weight-row {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

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

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-title h3 {
    font-family: var(--font-header);
    font-size: 16px;
    font-weight: 600;
}

.header-title p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.badge {
    font-size: 9px;
    background: rgba(0, 210, 255, 0.12);
    border: 1px solid rgba(0, 210, 255, 0.25);
    color: var(--neon-cyan);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.chart-legends {
    display: flex;
    gap: 14px;
    font-size: 11px;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.line-main { background-color: var(--neon-cyan); }
.line-pred { background-color: var(--neon-purple); }
.marker-buy { background-color: var(--neon-green); }

.chart-container {
    flex-grow: 1;
    padding: 10px;
    position: relative;
}

/* Weight Card & Sliders */
.weight-card {
    display: flex;
    flex-direction: column;
}

.weight-mode-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    padding: 2px;
}

.toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.weight-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.weight-chart-container {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sliders-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.weight-slider-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slider-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
}

.model-name {
    color: var(--text-secondary);
}

.model-w-val {
    color: var(--neon-cyan);
}

.w-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    transition: opacity .2s;
}

.w-slider:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.w-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--neon-cyan);
    box-shadow: 0 0 6px var(--neon-cyan);
    cursor: pointer;
}

.w-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--neon-cyan);
    box-shadow: 0 0 6px var(--neon-cyan);
    cursor: pointer;
}

/* SECTION TIMINGS & INTERFACES */
.section-title {
    font-family: var(--font-header);
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--neon-cyan);
}

.models-grid-section {
    margin-top: 8px;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.model-subcard {
    padding: 16px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.model-subcard.active-model {
    border-top-color: var(--neon-cyan);
}

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

.model-subcard-header h4 {
    font-family: var(--font-header);
    font-size: 13px;
    font-weight: 600;
}

.subcard-weight {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.subcard-body {
    margin: 8px 0;
}

.subcard-price {
    font-family: var(--font-header);
    font-size: 18px;
    font-weight: 700;
}

.subcard-sig {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

.model-accuracy-bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    height: 4px;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.accuracy-fill {
    height: 100%;
    background: var(--neon-cyan);
    border-radius: 2px;
}

.subcard-accuracy-lbl {
    font-size: 9px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

/* BACKTEST SECTION */
.backtest-section {
    margin-top: 8px;
}

.backtest-card {
    padding: 0;
}

.backtest-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
}

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

.backtest-info-panel {
    padding: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

@media (max-width: 992px) {
    .backtest-info-panel {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
}

.backtest-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.bt-stat-card {
    background: rgba(0, 0, 0, 0.15);
    border-left: 3px solid #fff;
    padding: 10px 14px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.border-cyan { border-left-color: var(--neon-cyan); }
.border-purple { border-left-color: var(--neon-purple); }
.border-red { border-left-color: var(--neon-red); }
.border-gray { border-left-color: var(--text-muted); }

.bt-lbl {
    font-size: 10px;
    color: var(--text-secondary);
}

.bt-val {
    font-family: var(--font-header);
    font-size: 18px;
    font-weight: 700;
    margin-top: 2px;
}

.bt-disclaimer {
    font-size: 9.5px;
    color: var(--text-muted);
    line-height: 1.5;
    display: flex;
    gap: 6px;
}

.bt-disclaimer i {
    margin-top: 3px;
}

.backtest-chart-container {
    padding: 16px;
    align-self: center;
}

/* Footer elements */
.app-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* ==========================================================================
   PREMIUM GLASS NAV TABS SECTION
   ========================================================================== */
.app-nav-tabs {
    display: flex;
    justify-content: space-around;
    padding: 6px;
    margin-bottom: 20px;
    border-radius: 12px;
    background: rgba(22, 28, 45, 0.5) !important;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    width: 100%;
    position: sticky;
    top: 16px;
    z-index: 100;
}

.nav-tab-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-family: 'Outfit', 'Microsoft JhengHei', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.nav-tab-btn i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.nav-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.nav-tab-btn:hover i {
    transform: scale(1.1);
}

.nav-tab-btn.active {
    color: #fff;
    background: rgba(0, 210, 255, 0.12) !important;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.15) !important;
    border: 1px solid rgba(0, 210, 255, 0.35) !important;
}

.nav-tab-btn.active i {
    filter: drop-shadow(0 0 5px var(--neon-cyan));
    transform: scale(1.1);
}

.tab-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    scroll-margin-top: 90px;
    margin-bottom: 12px;
    animation: tabFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Responsive Sticky Bottom Nav for Mobile Screens */
@media (max-width: 768px) {
    .app-nav-tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin-bottom: 0;
        border-radius: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        border-left: none;
        border-right: none;
        border-bottom: none;
        z-index: 1000;
        padding: 8px 4px;
        background: rgba(14, 19, 34, 0.92) !important;
        backdrop-filter: blur(20px);
    }
    
    .nav-tab-btn {
        flex-direction: column;
        gap: 4px;
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    
    .nav-tab-btn i {
        font-size: 1.2rem;
    }
    
    /* Extra padding for main container so content is not blocked by sticky bottom nav */
    .app-container {
        padding-bottom: 80px;
    }
}
