:root {
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.4);
    --secondary: #8b5cf6;
    --accent: #a855f7;
    --bg-deep: #020617;
    --glass: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-bright: #f8fafc;
    --text-muted: #94a3b8;
    --neon-blue: #38bdf8;
    --neon-purple: #a855f7;
}

/* --- BIA ELITE HEADER --- */
#bia-elite-header {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    min-height: 42px;
    background: rgba(10, 15, 29, 0.75);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 20px;
    z-index: 99;
    font-family: 'Outfit', sans-serif;
}

.header-section { display: flex; align-items: center; gap: 20px; }
.brand-glow {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}
.v-tag {
    font-size: 10px;
    background: var(--primary);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 5px;
    vertical-align: middle;
    color: #000;
    font-weight: 900;
}
.ai-status { display: flex; align-items: center; gap: 8px; margin-left: 15px; }
.pulse-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: pulse-ai 2s infinite;
}
.status-label { font-size: 10px; font-weight: 600; opacity: 0.8; color: #10b981; }
.status-label.starting { color: #f59e0b; }

.status-indicator.status-starting {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    animation: pulse-orange-dot 2s infinite;
}

.status-indicator.status-error {
    background: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
    animation: pulse-red-dot 1s infinite;
}

@keyframes pulse-red-dot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; box-shadow: 0 0 20px rgba(239, 68, 68, 0.8); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse-orange-dot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}
.clock-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
}
.telemetry-badge {
    background: rgba(255,255,255,0.05);
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.neon-blue { color: #38bdf8; }
.neon-purple { color: #a855f7; }
.neon-green { color: #22c55e; }

@keyframes pulse-ai {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: radial-gradient(circle at top right, #1e1b4b, #020617 60%);
    font-family: 'Outfit', sans-serif;
    color: var(--text-bright);
    height: 100vh;
}

/* --- DESKTOP AREA --- */
#desktop {
    position: relative;
    width: 100vw;
    height: calc(100vh - 60px);
    overflow: hidden;
    padding: 20px;
    background-image: 
        radial-gradient(var(--glass-border) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* --- TASKBAR --- */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 15px;
    z-index: 9999;
}

.taskbar-item {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.taskbar-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: var(--primary);
}

.taskbar-item.active {
    background: var(--primary-glow);
    border-color: var(--primary);
}

/* --- WINDOW SYSTEM --- */
.window {
    position: absolute;
    min-width: 300px;
    min-height: 200px;
    background: var(--glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
}

/* --- BIA CORE HUD & TELEMETRY --- */
.bia-glass {
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(12px) saturate(180%) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(56, 189, 248, 0.1) !important;
}

.bia-glass .window-header {
    background: rgba(56, 189, 248, 0.1);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.bia-glass .window-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.window.focused {
    z-index: 500;
    border-color: var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
}

.window-header {
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    cursor: grab;
    flex-shrink: 0;
}

.window-header:active { cursor: grabbing; }

.window-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}

.control-close { background: #ff5f57; }
.control-min { background: #ffbd2e; }
.control-max { background: #28c940; }

.window-content {
    flex-grow: 1;
    overflow: auto;
    padding: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

/* --- WINDOW SHADING (LINUX STYLE) --- */
.window.shaded {
    height: 40px !important;
    min-height: 40px !important;
    overflow: hidden !important;
}

.window.shaded .window-content,
.window.shaded .window-resizer {
    display: none !important;
}

.window-resizer {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--glass-border) 50%);
    z-index: 1000;
}

.window-header {
    height: 40px;
}

.console-window .window-content {
    background: rgba(0, 0, 0, 0.4);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* --- GLASS CARD (INTERNAL) --- */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    padding: 15px;
    margin-bottom: 15px;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
    background: var(--glass-border); 
    border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* --- MOBILE RESPONSIVENESS (MASTER SYSTEM) --- */
@media (max-width: 768px) {
    body {
        overflow: hidden !important; /* Mantém a "página única" */
        height: 100vh !important;
        position: fixed;
        width: 100%;
    }

    #desktop {
        height: calc(100vh - 110px) !important; /* Desconta Header e Taskbar */
        overflow-y: auto !important; /* Scroll interno apenas no desktop */
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 15px;
        padding-bottom: 30px;
        background-attachment: fixed;
    }

    .window {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important; /* CORREÇÃO CRÍTICA: Ignora o min-width: 600px do desktop */
        height: auto !important;
        min-height: 120px !important;
        transform: none !important;
        left: 0 !important;
        top: 0 !important;
        margin-bottom: 10px;
        flex-shrink: 0;
        box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    }

    .window.shaded {
        height: 40px !important;
        min-height: 40px !important;
        overflow: hidden !important;
    }

    /* Forçar Console responsivo */
    #window-console {
        order: 999 !important;
        min-width: 0 !important;
    }

    #log-container {
        height: 300px !important; /* Altura fixa no mobile para não explodir */
    }

    .window-header {
        cursor: default;
        height: 45px;
    }

    .window-content {
        max-height: none !important;
        overflow: visible !important;
    }

    .window-resizer {
        display: none !important;
    }

    #taskbar {
        height: 70px;
        padding: 0 10px;
        justify-content: space-around;
        background: rgba(15, 23, 42, 0.95);
        z-index: 10000; /* Acima de tudo */
        border-top: 1px solid rgba(56, 189, 248, 0.3);
        box-shadow: 0 -10px 20px rgba(0,0,0,0.5);
    }

    .taskbar-item {
        width: 55px;
        height: 55px;
    }
}

/* --- TOAST NOTIFICATIONS (MODERN BIA OS STYLE) --- */
#toast-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast-notification {
    min-width: 320px;
    max-width: 450px;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    animation: toast-slide-in 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.toast-notification::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255,255,255,0.1);
}

.toast-notification.hide {
    opacity: 0;
    transform: translateX(50px) scale(0.95);
}

.toast-icon {
    font-size: 22px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 5px currentColor);
}

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toast-message {
    font-size: 13px;
    color: rgba(248, 250, 252, 0.8);
    line-height: 1.4;
}

/* Toast Color Variants */
.toast-success { 
    border-left-color: #10b981; 
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
}
.toast-success .toast-icon { color: #10b981; }
.toast-success .toast-title { color: #10b981; }

.toast-error { 
    border-left-color: #ef4444; 
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.15);
}
.toast-error .toast-icon { color: #ef4444; }
.toast-error .toast-title { color: #ef4444; }

.toast-warning { 
    border-left-color: #f59e0b; 
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.15);
}
.toast-warning .toast-icon { color: #f59e0b; }
.toast-warning .toast-title { color: #f59e0b; }

.toast-info { 
    border-left-color: #3b82f6; 
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
}
.toast-info .toast-icon { color: #3b82f6; }
.toast-info .toast-title { color: #3b82f6; }

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateX(100px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@media (max-width: 768px) {
    #toast-container {
        left: 20px;
        right: 20px;
        bottom: 90px;
    }
    .toast-notification {
        min-width: 0;
        width: 100%;
    }
}

/* --- BIA STATE-OF-THE-ART MODAL SYSTEM --- */
.bia-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 18, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 20px;
}

.bia-modal-overlay.active {
    opacity: 1;
}

.bia-modal-card {
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    padding: 26px;
    box-shadow: 
      0 20px 50px -10px rgba(0, 0, 0, 0.85),
      0 0 30px rgba(99, 102, 241, 0.2);
    transform: scale(0.92) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    color: #f8fafc;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

.bia-modal-overlay.active .bia-modal-card {
    transform: scale(1) translateY(0);
}

.bia-modal-card.bia-modal-danger {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 
      0 20px 50px -10px rgba(0, 0, 0, 0.85),
      0 0 35px rgba(239, 68, 68, 0.25);
}

.bia-modal-card.bia-modal-warning {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 
      0 20px 50px -10px rgba(0, 0, 0, 0.85),
      0 0 35px rgba(245, 158, 11, 0.2);
}

.bia-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.bia-modal-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.bia-modal-icon-badge.info {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.35);
}

.bia-modal-icon-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.bia-modal-icon-badge.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.bia-modal-icon-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.bia-modal-title {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.3;
}

.bia-modal-body p {
    margin: 0 0 16px 0;
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.6;
}

.bia-modal-input-group {
    margin-top: 12px;
}

.bia-modal-textarea {
    width: 100%;
    background: rgba(10, 15, 29, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 14px;
    padding: 14px 16px;
    color: #f8fafc;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

.bia-modal-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: rgba(10, 15, 29, 0.98);
}

.bia-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
}

.bia-modal-btn {
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-modal-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-modal-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.btn-modal-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-modal-primary:hover {
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.6);
    transform: translateY(-1px);
}

.btn-modal-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.btn-modal-danger:hover {
    box-shadow: 0 6px 22px rgba(239, 68, 68, 0.6);
    transform: translateY(-1px);
}

/* --- UNIFIED STATE-OF-THE-ART GLOBAL NAVIGATION BAR --- */
.bia-global-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: rgba(10, 15, 29, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.25);
    position: sticky;
    top: 0;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(139, 92, 246, 0.15);
    margin-bottom: 20px;
    font-family: 'Outfit', sans-serif;
    width: 100%;
    box-sizing: border-box;
}

.bia-global-nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bia-global-nav .brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.5px;
}

.bia-global-nav .brand-badge {
    font-size: 0.7rem;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 800;
}

.bia-global-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bia-global-nav .nav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.bia-global-nav .nav-item:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.bia-global-nav .nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.2));
    border-color: #8b5cf6;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

@media (max-width: 960px) {
    .bia-global-nav {
        flex-direction: column;
        gap: 10px;
        padding: 12px 14px;
    }
    .bia-global-nav .nav-links {
        justify-content: center;
        width: 100%;
        overflow-x: auto;
    }
}

