/* =========================================
   BASE DO DESKTOP
   ========================================= */
#desktop {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: url('../assets/background.webp') center/cover no-repeat, radial-gradient(circle, #111, #000);
    overflow: hidden; /* Nada escapa da tela */
    bottom: 60px; /* Impede de ir para debaixo da barra de tarefas (que tem 60px) */
}

/* =========================================
   ÍCONES DA ÁREA DE TRABALHO
   ========================================= */

#desktop {
    position: relative;
    width: 100vw;
    height: calc(100vh - 60px);
    background: url('../assets/background.webp') center/contain no-repeat, #000;
    overflow: hidden;
}
.desktop-grid {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 10;
}

.desktop-icon {
    position: absolute; /* Agora eles flutuam livremente */
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    text-align: center;
    font-size: 12px;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    padding: 5px;
    border: 1px solid transparent;
    /* TRANSICAO ADICIONADA PARA O SNAP SUAVE */
    transition: top 0.2s, left 0.2s, background 0.2s, border 0.2s;
    user-select: none;
}

.desktop-icon:active {
    cursor: grabbing;
}

.desktop-icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.8));
    pointer-events: none;
}

.desktop-icon span {
    pointer-events: none;
}

.desktop-icon:hover {
    background: rgba(0, 255, 255, 0.15);
    border-color: rgba(0,255,255,0.5);
    border-radius: 5px;
}

/* =========================================
   BARRA DE TAREFAS E SYSTEM TRAY
   ========================================= */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px; /* 30% Maior */
    background: rgba(10, 10, 10, 0.95);
    border-top: 1px solid #ff003c;
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 99999; /* Escudo anti-cliques perdidos */
    box-shadow: 0 -2px 10px rgba(255, 0, 60, 0.2);
}

#taskbar-apps {
    display: flex;
    gap: 8px;
    margin-left: 15px;
    align-items: center;
    height: 100%;
}

.system-tray {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
    padding-right: 15px;
}

.tray-icon {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 0 2px #00ffff);
    cursor: help;
}

#system-clock {
    font-size: 14px;
    color: #00ffff;
    min-width: 50px;
    text-align: right;
    font-weight: bold;
}

/* Ícones dos Apps na Barra de Tarefas */
.taskbar-item {
    background: transparent;
    border: 1px solid transparent;
    padding: 5px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px; /* 30% Maior */
    height: 48px; /* 30% Maior */
    transition: all 0.2s ease-in-out;
    position: relative;
}

/* O Smart Preview (Miniatura) */
.taskbar-preview {
    position: absolute;
    bottom: 65px; /* Fica logo acima da barra */
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: rgba(15, 15, 15, 0.98);
    border: 1px solid #00ffff;
    border-radius: 6px;
    padding: 10px;
    width: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    /* Efeito "Bounce" (Mola) igual ao macOS/Windows */
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.2);
    z-index: 100000;
}

/* Quando passar o mouse, a miniatura sobe! */
.taskbar-item:hover .taskbar-preview {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.taskbar-item img {
    width: 32px; /* 30% Maior */
    height: 32px; /* 30% Maior */
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(0, 255, 255, 0.5));
}

.taskbar-item:hover {
    background: rgba(0, 255, 255, 0.15);
    border: 1px solid #00ffff;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.taskbar-item.active {
    border-bottom: 3px solid #00ffff;
    background: rgba(0, 255, 255, 0.05);
}

.taskbar-item.pinned {
    border-bottom: 3px dashed #ff003c;
}

/* =========================================
   MENU INICIAR E BOTÕES DE ENERGIA
   ========================================= */
#start-button {
    background: transparent;
    border: 1px solid #ff003c;
    border-radius: 4px;
    padding: 2px;
    height: 48px; /* 30% Maior */
    width: 48px; /* 30% Maior */
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

#start-button img { height: 100%; object-fit: contain; }

#start-button:hover {
    box-shadow: 0 0 12px #ff003c;
    background: rgba(255, 0, 60, 0.1);
}

#start-menu {
    position: fixed;
    bottom: 70px; /* Ajustado para não cobrir a barra de 60px */
    left: 10px;
    width: 300px;
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid #00ffff;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 15000;
}

.menu-header {
    color: #ff003c;
    font-weight: bold;
    text-align: center;
    border-bottom: 1px dashed #333;
    padding-bottom: 5px;
}

#search-input {
    background: #000;
    color: #00ffff;
    padding: 8px;
    border: 1px solid #333;
    font-family: monospace;
    outline: none;
}
#search-input:focus { border-color: #00ffff; }

#power-btn {
    background: #111;
    color: #fff;
    border: 1px solid #555;
    padding: 8px;
    cursor: pointer;
    font-family: monospace;
}

#power-options button {
    width: 100%;
    margin-top: 5px;
    padding: 8px;
    font-family: monospace;
    cursor: pointer;
    border: none;
}

/* =========================================
   TELA DE AUTENTICAÇÃO (LOGIN)
   ========================================= */
#auth-screen {
    position: absolute;
    width: 100vw;
    height: 100vh;
    background: #050505;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
}

.auth-box {
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid #00ffff;
    padding: 30px;
    border-radius: 5px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
    width: 300px;
}

.auth-box input {
    width: 90%;
    margin-top: 10px;
    padding: 10px;
    background: #000;
    border: 1px solid #333;
    color: #00ffff;
    font-family: monospace;
    outline: none;
}
.auth-box input:focus { border-color: #ff003c; }

/* =========================================
   ÍCONES SOLTOS E BOTÕES DE CONTROLE
   ========================================= */
#cmd-icon {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 64px;
    cursor: pointer;
    filter: drop-shadow(0 0 5px #00ffff);
    display: none; /* Escondido pois agora usamos o desktop-grid */
}

#shutdown {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px;
    background: #111;
    color: #ff003c;
    border: 1px solid #ff003c;
    font-weight: bold;
    cursor: pointer;
    font-family: monospace;
    display: none; /* Escondido para forçar uso do menu iniciar */
}
#shutdown:hover { background: #ff003c; color: #fff; }

/* =========================================
   EXPLORADOR DE ARQUIVOS E VFS
   ========================================= */
.explorer-toolbar {
    background: #111;
    padding: 8px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    font-size: 12px;
}

/* Container flexível interno das janelas dinâmicas (Evita texto vazando) */
.window-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

/* Cadeado sobreposto no ícone trancado */
.file-item-grid, .file-item-list { position: relative; }

.lock-overlay {
    position: absolute;
    top: 5px;
    right: 15px;
    width: 20px !important;
    height: 20px !important;
    filter: drop-shadow(0 0 2px #ff003c);
}

/* MODO: GRADE (Grid) */
.explorer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    align-content: start;
    gap: 15px;
    padding: 15px;
    overflow-y: auto;
    height: 300px;
}

.file-item-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    text-align: center;
    font-size: 11px;
    padding: 10px 5px;
    border: 1px solid transparent;
    transition: 0.2s;
}

.file-item-grid img { width: 45px; height: 45px; margin-bottom: 8px; }
.file-item-grid:hover { background: rgba(0, 255, 255, 0.1); border-color: #00ffff; border-radius: 5px; }

/* MODO: LISTA (List) */
.explorer-list {
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow-y: auto;
    height: 300px;
}

.file-item-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-bottom: 1px solid #222;
    transition: 0.2s;
}

.file-item-list img { width: 24px; height: 24px; margin-right: 15px; }
.file-item-list:hover { background: rgba(0, 255, 255, 0.1); border-color: #00ffff; border-radius: 4px; }
