/* ================================================
   ENGDESK - ESTILOS GLOBAIS
   ================================================ */

:root {
    /* --- CORES DO SISTEMA --- */
    --bg-wallpaper: url('https://images.unsplash.com/photo-1497366754035-f200968a6e72?q=80&w=2069&auto=format&fit=crop');
    --sys-overlay: rgba(0, 0, 0, 0.4);
    
    /* Glass System */
    --glass-base: rgba(18, 18, 18, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    --glass-blur: 20px;
    --win-shadow: 0 20px 50px rgba(0,0,0,0.5);

    /* Container Background (RGB para usar com opacity) */
    --container-bg-rgb: 18, 18, 18;

    /* Cores de App */
    --accent-blue: #2563eb;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-orange: #f59e0b;
    --accent-pink: #ec4899;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;
    
    /* Tipografia */
    --txt-primary: #ffffff;
    --txt-secondary: #a1a1aa;
    
    --z-dock: 1000;
    --z-window-base: 100;
    --z-modal: 2000;
}

/* TEMA LIGHT */
body.light-mode {
    --glass-base: rgba(255, 255, 255, 0.90);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-highlight: rgba(0, 0, 0, 0.05);
    --txt-primary: #1e293b;
    --txt-secondary: #64748b;
    --win-shadow: 0 20px 50px rgba(0,0,0,0.15);
    --container-bg-rgb: 255, 255, 255;
}

body.light-mode .card,
body.light-mode .kpi-box {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body.light-mode .project-card {
    background: rgba(255, 255, 255, 0.80);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

body.light-mode .project-card:hover {
    background: rgba(255, 255, 255, 0.90);
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

body.light-mode h1, 
body.light-mode h2, 
body.light-mode h3, 
body.light-mode h4, 
body.light-mode h5, 
body.light-mode h6 {
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.8);
}

body.light-mode p, 
body.light-mode span, 
body.light-mode div {
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.6);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Inter', sans-serif; 
    user-select: none; 
}

body {
    height: 100vh; 
    width: 100vw; 
    overflow: hidden;
    background-image: var(--bg-wallpaper);
    background-size: cover; 
    background-position: center;
    color: var(--txt-primary);
    position: relative;
}

/* Text-shadow sutil para melhor legibilidade sobre wallpapers */
h1, h2, h3, h4, h5, h6 {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

p, span, div {
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.desktop-overlay { 
    position: absolute; 
    inset: 0; 
    background: var(--sys-overlay); 
    z-index: 0; 
    pointer-events: none; 
}

/* --- BOOT SCREEN --- */
#bootScreen {
    position: fixed; 
    inset: 0; 
    background: #000; 
    z-index: 9999;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    transition: opacity 0.8s ease;
}

.boot-logo { 
    font-size: 3rem; 
    font-weight: 800; 
    background: linear-gradient(45deg, #2563eb, #1e40af); 
    -webkit-background-clip: text; 
    color: transparent; 
    margin-bottom: 20px; 
}

.loader { 
    width: 200px; 
    height: 4px; 
    background: #333; 
    border-radius: 2px; 
    overflow: hidden; 
}

.loader-bar { 
    width: 0%; 
    height: 100%; 
    background: #2563eb; 
    transition: width 1.5s ease-in-out; 
}

/* --- TOP BAR --- */
.top-bar {
    position: absolute; 
    top: 0; 
    left: 80px; 
    right: 0; 
    height: 32px;
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0 20px; 
    z-index: 50;
    background: rgba(0,0,0,0.2); 
    backdrop-filter: blur(4px);
    font-size: 13px; 
    font-weight: 500; 
    color: rgba(255,255,255,0.9);
}

.light-mode .top-bar { 
    background: rgba(255,255,255,0.2); 
    color: #000; 
}

/* --- DOCK --- */
.dock {
    position: absolute; 
    left: 16px; 
    top: 50%; 
    transform: translateY(-50%);
    width: 64px; 
    padding: 16px 0;
    background: var(--glass-base); 
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border); 
    border-radius: 20px;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 16px;
    box-shadow: var(--win-shadow); 
    z-index: var(--z-dock);
    transition: all 0.3s ease;
}

.dock-divider { 
    width: 30px; 
    height: 1px; 
    background: var(--glass-border); 
    margin: 4px 0; 
}

.dock-icon {
    width: 44px; 
    height: 44px; 
    border-radius: 12px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 24px; 
    color: var(--txt-secondary);
    cursor: pointer; 
    position: relative; 
    transition: 0.2s;
}

.dock-icon:hover { 
    background: var(--glass-highlight); 
    color: var(--txt-primary); 
    transform: scale(1.1); 
}

.dock-icon.active { 
    background: rgba(59, 130, 246, 0.15); 
    color: var(--accent-blue); 
    border: 1px solid rgba(59, 130, 246, 0.3); 
}

.dock-dot {
    position: absolute; 
    left: -8px; 
    width: 4px; 
    height: 4px; 
    border-radius: 50%; 
    background: var(--txt-primary);
    opacity: 0; 
    transition: 0.2s;
}

.dock-icon.open .dock-dot { 
    opacity: 1; 
    height: 20px; 
    border-radius: 4px; 
    left: -10px; 
    background: var(--accent-blue); 
}

.tooltip {
    position: absolute; 
    left: 60px; 
    background: #000; 
    color: #fff; 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 12px; 
    opacity: 0; 
    pointer-events: none; 
    transition: 0.2s; 
    white-space: nowrap;
}

.dock-icon:hover .tooltip { 
    opacity: 1; 
    left: 55px; 
}

/* --- APP CONTAINER --- */
#app-container {
    position: absolute; 
    top: 32px; 
    left: 80px; 
    right: 0; 
    bottom: 0;
    z-index: 10; 
    padding: 40px; 
    overflow-y: auto;
}

#app-container::-webkit-scrollbar { width: 8px; }
#app-container::-webkit-scrollbar-track { background: transparent; }
#app-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
#app-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* --- SPOTLIGHT --- */
#spotlight {
    position: fixed; 
    inset: 0; 
    z-index: 2500; 
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px); 
    display: none; 
    align-items: flex-start; 
    justify-content: center;
    padding-top: 100px;
}

#spotlight.active { display: flex; }

.spotlight-content {
    background: var(--glass-base); 
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); 
    border-radius: 16px;
    width: 90%; 
    max-width: 600px; 
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.spotlight-input {
    width: 100%; 
    padding: 15px; 
    background: transparent;
    border: none; 
    color: var(--txt-primary);
    font-size: 1.2rem; 
    outline: none;
}

#spotlightResults {
    margin-top: 15px; 
    display: flex; 
    flex-direction: column; 
    gap: 8px;
}

.spotlight-item {
    padding: 12px; 
    border-radius: 8px; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    gap: 12px;
    transition: 0.2s; 
    background: rgba(255,255,255,0.03);
}

.spotlight-item:hover { background: rgba(255,255,255,0.08); }

/* --- COMPONENTS --- */
.app-container {
    max-width: 100%;
}

.btn {
    padding: 10px 20px; 
    border-radius: 8px; 
    border: none;
    cursor: pointer; 
    font-weight: 600; 
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary { 
    background: var(--accent-blue); 
    color: white; 
}

.btn-primary:hover { 
    background: #1e40af; 
}

.btn-secondary { 
    background: rgba(255,255,255,0.1); 
    color: var(--txt-primary); 
}

.btn-secondary:hover { 
    background: rgba(255,255,255,0.15); 
}

.card {
    background: rgba(18, 18, 18, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.kpi-box {
    background: rgba(18, 18, 18, 0.85); 
    padding: 20px; 
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.project-card {
    background: rgba(18, 18, 18, 0.80);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.project-card:hover {
    background: rgba(18, 18, 18, 0.90);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-em-andamento {
    background: rgba(37, 99, 235, 0.15);
    color: var(--accent-blue);
}

.status-badge.status-planejamento {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.status-badge.status-concluído,
.status-badge.status-aprovado,
.status-badge.status-ativo {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--txt-secondary);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--txt-primary);
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block; 
    margin-bottom: 8px; 
    color: var(--txt-secondary);
    font-size: 0.875rem; 
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: var(--txt-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255,255,255,0.08);
}

/* Modal System */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-content {
    background: var(--glass-base);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--txt-secondary);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

/* Utility Classes */
.flex-between { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

table {
    width: 100%; 
    border-collapse: collapse;
}

th {
    text-align: left; 
    padding: 12px; 
    border-bottom: 1px solid var(--glass-border);
    color: var(--txt-secondary); 
    font-size: 0.85rem; 
    font-weight: 600;
}

td {
    padding: 12px; 
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

/* ================================================
   WINDOW MODE - Sistema de Janelas Flutuantes
   ================================================ */

.app-window {
    position: fixed;
    display: flex;
    flex-direction: column;
    width: 900px;
    height: 600px;
    min-width: 400px;
    min-height: 300px;
    background: var(--glass-base);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--win-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
}

.app-window.window-focused {
    border-color: rgba(37, 99, 235, 0.3);
}

.app-window.maximized {
    left: 80px !important;
    top: 32px !important;
    right: 0 !important;
    bottom: 0 !important;
    width: calc(100vw - 80px) !important;
    height: calc(100vh - 32px) !important;
    border-radius: 0;
}

/* Window Header */
.window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--glass-border);
    cursor: move;
    user-select: none;
}

.window-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--txt-primary);
}

/* Window Controls */
.window-control-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--txt-secondary);
    font-size: 14px;
}

.window-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--txt-primary);
}

.window-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

/* Window Body */
.window-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
}

.window-body::-webkit-scrollbar {
    width: 8px;
}

.window-body::-webkit-scrollbar-track {
    background: transparent;
}

.window-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.window-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Animação de abertura de janela */
@keyframes windowOpen {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.app-window {
    animation: windowOpen 0.3s ease-out;
}
