﻿/* ===== CSS VARIABLES ===== */
:root {
  --accent: #0078d4;
  --accent-hover: #1a86d9;
  --taskbar-bg: rgba(32, 32, 32, 0.85);
  --window-bg: #f3f3f3;
  --window-title-bg: #eff4f9;
  --window-border: rgba(0,0,0,0.08);
  --start-bg: rgba(32, 32, 32, 0.92);
  --text-primary: #1a1a1a;
  --text-secondary: #606060;
  --text-white: #ffffff;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.18);
  --glass-blur: blur(20px);
  --taskbar-height: 48px;
}

/* ===== RESET ===== */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}
body {
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  width: 100vw; height: 100vh;
  user-select: none;
  -webkit-user-select: none;
}

/* ===== DESKTOP ===== */
#desktop {
  width: 100%; height: calc(100% - var(--taskbar-height));
  background: linear-gradient(135deg, #1e3a5f 0%, #0d5ca3 25%, #2980b9 50%, #1abc9c 75%, #0d5ca3 100%);
  background-size: 400% 400%;
  animation: bgShift 20s ease infinite;
  position: relative;
}
@keyframes bgShift {
  0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%}
}

/* ===== DESKTOP ICONS ===== */
.desktop-icon {
  position: absolute;
  width: 76px; display: flex; flex-direction: column; align-items: center;
  padding: 6px 4px; border-radius: 6px; cursor: pointer; gap: 4px;
  transition: background 0.15s;
}
.desktop-icon:hover { background: rgba(255,255,255,0.12); }
.desktop-icon.selected { background: rgba(255,255,255,0.2); }
.desktop-icon .icon-img {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  font-size: 32px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
}
.desktop-icon .icon-label {
  font-size: 11px; color: white; text-align: center; text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  word-wrap: break-word; max-width: 72px; line-height: 1.2;
}

/* ===== CONTEXT MENU ===== */
.context-menu {
  position: fixed; min-width: 200px; background: rgba(44,44,44,0.94);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius); border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow); z-index: 10000; padding: 4px 0; display: none;
  color: var(--text-white); font-size: 13px;
}
.context-menu.show { display: block; }
.context-menu-item {
  padding: 8px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  transition: background 0.12s;
}
.context-menu-item:hover { background: rgba(255,255,255,0.1); }
.context-menu-separator { height: 1px; background: rgba(255,255,255,0.1); margin: 4px 0; }

/* ===== TASKBAR ===== */
#taskbar {
  width: 100%; height: var(--taskbar-height); position: fixed; bottom: 0; left: 0;
  background: var(--taskbar-bg);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  display: flex; align-items: center; justify-content: center;
  border-top: 1px solid rgba(255,255,255,0.06);
  z-index: 9000;
}
.taskbar-center {
  display: flex; align-items: center; gap: 2px; height: 100%;
}
.taskbar-btn {
  width: 44px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; cursor: pointer; position: relative;
  transition: background 0.15s; font-size: 20px; border: none; background: transparent; color: white;
}
.taskbar-btn:hover { background: rgba(255,255,255,0.1); }
.taskbar-btn.active::after {
  content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 3px; border-radius: 2px; background: var(--accent);
}
.taskbar-btn.active { background: rgba(255,255,255,0.06); }
.taskbar-btn.start-btn { width: 46px; }
.taskbar-btn.start-btn:hover { background: rgba(255,255,255,0.08); }

/* Taskbar tray */
.taskbar-tray {
  position: fixed; right: 0; top: 0; height: var(--taskbar-height); display: flex;
  align-items: center; gap: 2px; padding-right: 12px;
}
.tray-btn {
  height: 40px; display: flex; align-items: center; justify-content: center;
  padding: 0 8px; border-radius: 6px; cursor: pointer; color: white;
  font-size: 13px; background: transparent; border: none; gap: 6px;
  transition: background 0.15s;
}
.tray-btn:hover { background: rgba(255,255,255,0.1); }
.tray-icon { font-size: 16px; }
#clock { font-size: 12px; text-align: center; line-height: 1.3; }

/* Taskbar left */
.taskbar-left {
  position: fixed; left: 0; top: 0; height: var(--taskbar-height); display: flex;
  align-items: center; padding-left: 12px;
}

/* ===== START MENU ===== */
#start-menu {
  position: fixed; bottom: calc(var(--taskbar-height) + 12px);
  left: 50%; transform: translateX(-50%) scale(0.92); transform-origin: bottom center;
  width: 600px; max-width: 95vw; height: 580px; max-height: 70vh;
  background: rgba(44, 44, 44, 0.94);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 16px 64px rgba(0,0,0,0.35); z-index: 9500;
  display: flex; flex-direction: column; color: white;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#start-menu.show {
  opacity: 1; pointer-events: all; transform: translateX(-50%) scale(1);
}
.start-search {
  margin: 20px 24px 12px; position: relative;
}
.start-search input {
  width: 100%; padding: 8px 14px 8px 36px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.08);
  color: white; font-size: 13px; outline: none;
}
.start-search input::placeholder { color: rgba(255,255,255,0.5); }
.start-search input:focus { border-color: var(--accent); }
.start-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; }
.start-section-title {
  font-size: 13px; font-weight: 600; padding: 4px 28px; color: rgba(255,255,255,0.9);
}
.start-pinned {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  padding: 8px 20px; flex-shrink: 0;
}
.start-pinned-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px; border-radius: var(--radius); cursor: pointer;
  transition: background 0.15s;
}
.start-pinned-item:hover { background: rgba(255,255,255,0.1); }
.start-pinned-item .pin-icon { font-size: 28px; }
.start-pinned-item .pin-label { font-size: 11px; text-align: center; }
.start-separator { height: 1px; background: rgba(255,255,255,0.08); margin: 6px 24px; }
.start-recommended {
  flex: 1; overflow-y: auto; padding: 4px 20px 12px;
}
.start-rec-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.15s;
}
.start-rec-item:hover { background: rgba(255,255,255,0.1); }
.start-rec-item .rec-icon { font-size: 24px; width: 36px; text-align: center; }
.start-rec-item .rec-info { font-size: 12px; }
.start-rec-item .rec-name { font-weight: 500; }
.start-rec-item .rec-detail { color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 1px; }
.start-empty {
  display: none; padding: 14px 10px; border-radius: var(--radius);
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.72);
  font-size: 12px; text-align: center;
}
.start-empty.show { display: block; }
.start-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-top: 1px solid rgba(255,255,255,0.06);
}
.start-user {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  border-radius: var(--radius); cursor: pointer; transition: background 0.15s;
}
.start-user:hover { background: rgba(255,255,255,0.1); }
.start-user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.start-user-name { font-size: 13px; }
.start-power {
  width: 32px; height: 32px; border-radius: var(--radius); display: flex;
  align-items: center; justify-content: center; cursor: pointer;
  background: transparent; border: none; color: white; font-size: 16px;
  transition: background 0.15s;
}
.start-power:hover { background: rgba(255,255,255,0.1); }

/* ===== WINDOW SYSTEM ===== */
.app-window {
  position: absolute; min-width: 320px; min-height: 200px;
  background: var(--window-bg); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 0 0 1px var(--window-border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: box-shadow 0.15s;
  animation: windowOpen 0.22s ease forwards;
}
@keyframes windowOpen {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
.app-window.closing {
  animation: windowClose 0.18s ease forwards;
}
@keyframes windowClose {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.94); }
}
.app-window.minimized {
  animation: windowMinimize 0.2s ease forwards;
  pointer-events: none;
}
@keyframes windowMinimize {
  to { opacity: 0; transform: scale(0.6) translateY(100px); }
}
.app-window.restoring {
  animation: windowRestore 0.22s ease forwards;
}
@keyframes windowRestore {
  from { opacity: 0; transform: scale(0.6) translateY(100px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.app-window.focused { box-shadow: 0 12px 48px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,120,212,0.3); }
.app-window.maximized { border-radius: 0; }
.window-header {
  height: 32px; display: flex; align-items: center; justify-content: space-between;
  background: var(--window-title-bg); flex-shrink: 0;
  cursor: default; position: relative;
}
.window-title-area {
  display: flex; align-items: center; gap: 8px; padding-left: 12px; flex: 1;
  cursor: default; height: 100%;
}
.window-title-icon { font-size: 14px; }
.window-title-text { font-size: 12px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.window-controls { display: flex; height: 100%; }
.window-ctrl-btn {
  width: 46px; height: 32px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; background: transparent; font-size: 11px;
  color: var(--text-primary); transition: background 0.12s;
}
.window-ctrl-btn:hover { background: rgba(0,0,0,0.05); }
.window-ctrl-btn.close-btn:hover { background: #e81123; color: white; }
.window-body { flex: 1; overflow: auto; position: relative; }

/* ===== RESIZE HANDLES ===== */
.resize-handle { position: absolute; z-index: 1; }
.resize-n { top: -3px; left: 8px; right: 8px; height: 6px; cursor: n-resize; }
.resize-s { bottom: -3px; left: 8px; right: 8px; height: 6px; cursor: s-resize; }
.resize-e { right: -3px; top: 8px; bottom: 8px; width: 6px; cursor: e-resize; }
.resize-w { left: -3px; top: 8px; bottom: 8px; width: 6px; cursor: w-resize; }
.resize-ne { top: -3px; right: -3px; width: 12px; height: 12px; cursor: ne-resize; }
.resize-nw { top: -3px; left: -3px; width: 12px; height: 12px; cursor: nw-resize; }
.resize-se { bottom: -3px; right: -3px; width: 12px; height: 12px; cursor: se-resize; }
.resize-sw { bottom: -3px; left: -3px; width: 12px; height: 12px; cursor: sw-resize; }

/* ===== FILE EXPLORER ===== */
.explorer-toolbar {
  display: flex; align-items: center; gap: 4px; padding: 6px 10px;
  border-bottom: 1px solid #e5e5e5; background: #f9f9f9;
}
.explorer-toolbar button {
  padding: 4px 8px; border: none; background: transparent; cursor: pointer;
  border-radius: 4px; font-size: 13px; transition: background 0.12s;
}
.explorer-toolbar button:hover { background: rgba(0,0,0,0.06); }
.explorer-toolbar button:disabled { opacity: 0.4; cursor: default; }
.explorer-address {
  flex: 1; padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px;
  font-size: 12px; background: white; outline: none; margin-left: 6px;
}
.explorer-address:focus { border-color: var(--accent); }
.explorer-content { display: flex; flex: 1; }
.explorer-sidebar {
  width: 180px; border-right: 1px solid #e5e5e5; padding: 8px 0;
  background: #f9f9f9; overflow-y: auto; flex-shrink: 0;
}
.sidebar-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 14px; font-size: 12px;
  cursor: pointer; transition: background 0.12s;
}
.sidebar-item:hover { background: rgba(0,0,0,0.04); }
.sidebar-item.active { background: rgba(0,120,212,0.08); color: var(--accent); }
.explorer-files { flex: 1; padding: 8px; overflow-y: auto; }
.file-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 4px;
  cursor: pointer; font-size: 13px; transition: background 0.12s;
}
.file-item:hover { background: rgba(0,0,0,0.04); }
.file-item .file-icon { font-size: 20px; width: 28px; text-align: center; }
.file-item .file-name { flex: 1; }
.file-item .file-date { font-size: 11px; color: var(--text-secondary); }
.file-item .file-size { font-size: 11px; color: var(--text-secondary); width: 70px; text-align: right; }

/* ===== NOTEPAD ===== */
.notepad-menu {
  display: flex; gap: 0; border-bottom: 1px solid #e5e5e5; background: #f9f9f9;
}
.notepad-menu-item {
  padding: 5px 14px; font-size: 12px; cursor: pointer; border: none;
  background: transparent; transition: background 0.12s;
}
.notepad-menu-item:hover { background: rgba(0,0,0,0.06); }
.notepad-textarea {
  width: 100%; flex: 1; border: none; resize: none; padding: 10px 14px;
  font-family: Consolas, 'Courier New', monospace; font-size: 14px;
  outline: none; line-height: 1.5; background: white;
}
.notepad-menu-dropdown {
  position: absolute; top: 100%; left: 0; min-width: 180px;
  background: white; border: 1px solid #ddd; border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 10; display: none; padding: 4px 0;
}
.notepad-menu-dropdown.show { display: block; }
.notepad-menu-dropdown-item {
  padding: 6px 16px; font-size: 12px; cursor: pointer; display: flex;
  justify-content: space-between; transition: background 0.12s;
}
.notepad-menu-dropdown-item:hover { background: rgba(0,120,212,0.08); }

/* ===== CALCULATOR ===== */
.calc-display {
  text-align: right; padding: 20px 16px 10px; font-size: 36px; font-weight: 300;
  color: var(--text-primary); min-height: 70px; background: white;
  overflow: hidden; word-break: break-all;
}
.calc-expr { text-align: right; padding: 0 16px; font-size: 13px; color: var(--text-secondary); min-height: 20px; background: white; }
.calc-buttons {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 8px;
}
.calc-btn {
  padding: 14px 0; border: none; border-radius: 4px; font-size: 16px;
  cursor: pointer; transition: background 0.12s; background: #f9f9f9;
  color: var(--text-primary);
}
.calc-btn:hover { background: #e9e9e9; }
.calc-btn.operator { background: #f0f0f0; }
.calc-btn.operator:hover { background: #e0e0e0; }
.calc-btn.equals { background: var(--accent); color: white; }
.calc-btn.equals:hover { background: var(--accent-hover); }
.calc-btn.clear { color: var(--text-primary); }

/* ===== BROWSER ===== */
.browser-toolbar {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-bottom: 1px solid #e5e5e5; background: #f9f9f9;
}
.browser-toolbar button {
  padding: 4px 8px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; border-radius: 4px; transition: background 0.12s;
}
.browser-toolbar button:hover { background: rgba(0,0,0,0.06); }
.browser-url-bar {
  flex: 1; padding: 6px 12px; border: 1px solid #ddd; border-radius: 20px;
  font-size: 13px; background: white; outline: none;
}
.browser-url-bar:focus { border-color: var(--accent); }
.browser-content {
  flex: 1; background: white; display: flex; align-items: center;
  justify-content: center; flex-direction: column; gap: 16px;
}
.browser-content iframe { width: 100%; height: 100%; border: none; }

/* ===== TRAY PANELS ===== */
.tray-panel {
  position: fixed; bottom: calc(var(--taskbar-height) + 12px);
  background: rgba(44,44,44,0.94);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 48px rgba(0,0,0,0.35); z-index: 9400;
  color: white; padding: 16px;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.tray-panel.show { opacity: 1; pointer-events: all; transform: translateY(0); }

/* Calendar */
#calendar-panel { right: 12px; width: 300px; }
.calendar-header { font-size: 14px; font-weight: 600; margin-bottom: 12px; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 12px; }
.cal-day-name { color: rgba(255,255,255,0.5); padding: 4px 0; font-size: 11px; }
.cal-day { padding: 6px 0; border-radius: 50%; cursor: pointer; transition: background 0.12s; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; margin: auto; }
.cal-day:hover { background: rgba(255,255,255,0.1); }
.cal-day.today { background: var(--accent); font-weight: 600; }
.cal-day.other-month { color: rgba(255,255,255,0.25); }

/* Volume */
#volume-panel { right: 120px; width: 280px; }
.volume-control { display: flex; align-items: center; gap: 12px; }
.volume-control .vol-icon { font-size: 18px; }
.volume-slider { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.2); outline: none; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.volume-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; }
.volume-value { font-size: 12px; min-width: 30px; text-align: right; }

/* Notification center */
#notification-panel { right: 12px; width: 340px; max-height: 400px; overflow-y: auto; }
.notif-header { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.notif-clear { font-size: 12px; color: var(--accent); cursor: pointer; background: none; border: none; }
.notif-clear:hover { text-decoration: underline; }
.notif-item { padding: 10px; border-radius: var(--radius); background: rgba(255,255,255,0.06); margin-bottom: 6px; }
.notif-item-title { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.notif-item-body { font-size: 11px; color: rgba(255,255,255,0.7); }
.notif-item-time { font-size: 10px; color: rgba(255,255,255,0.4); margin-top: 4px; }

/* Quick Settings */
.quick-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.qs-tile {
  padding: 10px; border-radius: var(--radius); background: rgba(255,255,255,0.06);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; transition: background 0.12s;
}
.qs-tile:hover { background: rgba(255,255,255,0.12); }
.qs-tile.active { background: var(--accent); }
.qs-tile .qs-icon { font-size: 18px; }

/* WiFi panel */
#wifi-panel { right: 70px; width: 280px; }
.wifi-status { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.wifi-status .wifi-icon-large { font-size: 28px; }
.wifi-networks { margin-top: 12px; }
.wifi-network {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.15s;
}
.wifi-network:hover { background: rgba(255,255,255,0.1); }
.wifi-network .wifi-strength { font-size: 16px; }
.wifi-network .wifi-name { flex: 1; font-size: 12px; }
.wifi-network .wifi-lock { font-size: 10px; }

/* ===== WELCOME DIALOG ===== */
.welcome-body {
  padding: 32px; text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 16px;
}
.welcome-body h2 { font-weight: 400; font-size: 22px; }
.welcome-body p { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.welcome-btn {
  padding: 8px 24px; border: none; background: var(--accent); color: white;
  border-radius: 4px; font-size: 13px; cursor: pointer; transition: background 0.15s;
}
.welcome-btn:hover { background: var(--accent-hover); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

