:root {
  /* --- BACKGROUNDS (The Void) --- */
  --bg-void:    #050510;  /* Deepest layer (HTML Body) */
  --bg-panel:   #0B0C15;  /* Content cards/Panels */
  --bg-surface: #141425;  /* Interactive elements/Inputs */
  
  /* --- STABLE STATE (The Neural Flow) --- */
  --flux-cyan:  #00F0FF;  /* Primary Brand / Borders / Active States */
  --flux-blue:  #4488FF;  /* Secondary Accents / Links */
  --text-main:  #E0E6FF;  /* High readability headers */
  --text-mute:  #5C677D;  /* Meta data / Labels */

  /* --- ANOMALY STATE (Alerts & Overrides) --- */
  --alert-red:  #FF2A2A;  /* Critical Errors / Offline Agents */
  --warn-gold:  #FFD700;  /* Warnings / High Latency */
  --warn-orange:#FF8800;  /* Manual Override Active */

  /* --- GLASSMORPHISM (The HUD Layer) --- */
  --glass-border: rgba(0, 240, 255, 0.2);
  --glass-bg:     rgba(11, 12, 21, 0.7);
  --glass-blur:   blur(12px);
  
  --font-main: 'Outfit', sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-void);
    color: var(--text-main);
    overflow: hidden; /* App-style, no scroll */
}

/* Background Animations */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: blobFloat 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--flux-blue) 0%, transparent 70%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--alert-red) 0%, transparent 70%); /* Anomaly hints */
    opacity: 0.2;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--flux-cyan) 0%, transparent 70%);
    opacity: 0.2;
    animation-delay: -10s;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.2;
}

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -50px) scale(1.1); }
}

/* --- STUDIO LAYOUT --- */
.studio-container {
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    grid-template-rows: 60px 1fr;
    gap: 1rem;
    height: 100vh;
    padding: 1rem 1rem 3rem 1rem; /* Added bottom padding to clear fixed footer */
    box-sizing: border-box;
    transition: filter 0.5s ease;
}

/* Locked State (Blurred when not authenticated) */
.studio-container.locked {
    filter: blur(8px) brightness(0.4);
    pointer-events: none;
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(5, 5, 16, 0.9);
    border-bottom: 1px solid var(--flux-cyan);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--text-mute);
    color: var(--text-mute);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-badge.linked {
    color: var(--flux-cyan);
    border-color: var(--flux-cyan);
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Sidebar & Asset Lists */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-mute);
    letter-spacing: 1px;
}

.asset-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.asset-item {
    padding: 0.8rem;
    background: var(--bg-surface);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.asset-item:hover {
    border-color: var(--flux-cyan);
    color: var(--flux-cyan);
}

/* Center Stage */
.center-stage {
    position: relative;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.command-input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-main);
    border-radius: 8px;
    outline: none;
    font-family: var(--font-main);
}

.command-input:focus {
    border-color: var(--flux-cyan);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}

.visualization-area {
    flex: 1;
    border: 1px dashed rgba(255,255,255,0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mute);
}

/* Right Pane - Telemetry */
.telemetry-row {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.metric-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-mute);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--flux-cyan);
    width: 45%; /* Demo value */
    box-shadow: 0 0 8px var(--flux-cyan);
}

/* Login Overlay (Modal style sitting on top) */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.login-card {
    background: var(--bg-panel);
    border: 1px solid var(--flux-cyan);
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 240, 255, 0.2);
    min-width: 400px;
}

.login-card h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
}

.login-card .subtitle {
    color: var(--flux-cyan);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 2rem;
}

.btn-uplink {
    background: #000;
    color: #fff;
    border: 1px solid var(--text-mute);
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
    transition: all 0.2s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

/* --- Z-INDEX FIXES --- */
mforce-launchpad {
    position: fixed;
    bottom: 3.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999; /* Ensure modal pops over Login Overlay (z-100) and Footer (z-200) */
    display: block;
}

.btn-uplink:hover {
    border-color: var(--flux-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

/* --- FOOTER (Ticker Bar) --- */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 32px;
    z-index: 200; /* Above everything */
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Faded Bridge Colors Gradient */
    background: linear-gradient(90deg, 
        rgba(0, 240, 255, 0.08) 0%, 
        rgba(5, 5, 16, 0.95) 20%, 
        rgba(5, 5, 16, 0.95) 80%, 
        rgba(68, 136, 255, 0.08) 100%
    );
    border-top: 1px solid rgba(0, 240, 255, 0.15);
    box-shadow: 0 -4px 20px rgba(0, 240, 255, 0.05);
    font-family: 'Outfit', monospace; /* Tech feel */
    font-size: 0.75rem;
    padding: 0; 
    overflow: hidden;
    user-select: none;
    backdrop-filter: blur(10px);
}

.ticker-section {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
}

/* Left Section: Terminal aesthetics */
.log-section {
    gap: 1rem;
    background: linear-gradient(90deg, rgba(0,240,255,0.05) 0%, transparent 100%);
    border-right: 1px solid rgba(255,255,255,0.05);
    padding-right: 2rem;
}

.terminal-dots {
    display: flex;
    gap: 4px;
}

.terminal-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-mute);
    border-radius: 50%;
    opacity: 0.5;
}

.ticker-log {
    display: flex;
    gap: 8px;
    color: var(--text-mute);
}

.ticker-log .prompt {
    color: var(--flux-cyan);
    font-weight: bold;
}

.ticker-log .cmd {
    font-family: monospace;
    opacity: 0.8;
}

/* Right Section: Metrics */
.metrics-section {
    gap: 1.5rem;
}

.ticker-metric {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-mute);
}

.t-label {
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.t-val {
    color: var(--text-main);
    font-weight: 600;
}

.t-dot {
    width: 6px;
    height: 6px;
    background: var(--text-mute);
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.t-dot.active {
    background: var(--flux-blue);
    box-shadow: 0 0 8px var(--flux-blue);
    animation: pulse 2s infinite;
}

.t-dot.success {
    background: var(--flux-cyan);
    box-shadow: 0 0 8px var(--flux-cyan);
}

.t-dot.warning {
    background: var(--warn-gold);
    box-shadow: 0 0 8px var(--warn-gold);
}

.ticker-copyright {
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255,255,255,0.1);
    opacity: 0.4;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .studio-container {
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr 40px;
    }
    
    .left-pane, .right-pane {
        display: none; /* As per spec */
    }
}

/* --- NOTIFICATIONS --- */
.notification-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.toast {
    background: var(--bg-panel);
    border: 1px solid var(--flux-cyan);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: var(--glass-blur);
    animation: slideIn 0.3s ease-out forwards;
    pointer-events: auto;
    min-width: 300px;
}

.toast.error {
    border-color: var(--alert-red);
    box-shadow: 0 0 20px rgba(255, 42, 42, 0.2);
}

.toast.warning {
    border-color: var(--warn-gold);
}

.toast-message {
    font-size: 0.9rem;
}

.toast-action {
    background: var(--flux-cyan);
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    margin-left: auto;
    text-transform: uppercase;
    transition: all 0.2s;
}

.toast-action:hover {
    background: #fff;
    box-shadow: 0 0 10px var(--flux-cyan);
}

.toast-close {
    margin-left: 1rem;
    background: transparent;
    border: none;
    color: var(--text-mute);
    cursor: pointer;
    font-size: 1.2rem;
}

.toast-close:hover {
    color: var(--text-main);
}

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

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}
