/* ═══════════════════════════════════════════
   Windows 11 桌面模拟器 — Style
   ═══════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI Variable', 'Segoe UI', 'Microsoft YaHei', sans-serif;
  font-size: 12px;
  color: #fff;
}

/* ─── Desktop ─── */
#desktop {
  position: fixed;
  inset: 0;
  bottom: 48px;
  background: #0d1117;
  overflow: hidden;
}

#desktop-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* ─── Desktop Icons ─── */
.desktop-icon {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 74px;
  padding: 6px 4px;
  cursor: default;
  text-align: center;
  border-radius: 6px;
  transition: background 0.1s;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.06);
}

.desktop-icon .icon-img {
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  object-fit: contain;
  pointer-events: none;
}

.desktop-icon .icon-label {
  color: #f0f0f0;
  font-size: 11px;
  line-height: 1.3;
  word-break: break-all;
  padding: 2px 6px;
  border-radius: 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  max-width: 72px;
}

.desktop-icon.selected .icon-label {
  background: rgba(0, 103, 192, 0.6);
  color: #fff;
  text-shadow: none;
}

.desktop-icon.selected {
  background: rgba(0, 103, 192, 0.25);
  outline: 1px solid rgba(0, 103, 192, 0.5);
}

/* ─── Win11 Window ─── */
.win11-window {
  position: absolute;
  min-width: 300px;
  min-height: 200px;
  background: rgba(32, 32, 32, 0.92);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.win11-window.active {
  z-index: 100;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.win11-window .titlebar {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  background: rgba(32, 32, 32, 0.4);
  flex-shrink: 0;
}

.win11-window .titlebar .title-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
  object-fit: contain;
}

.win11-window .titlebar .title-text {
  flex: 1;
  font-size: 12px;
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.win11-window .titlebar .win-controls {
  display: flex;
  gap: 0;
  margin-left: auto;
  flex-shrink: 0;
}

.win11-window .titlebar .win-btn {
  width: 46px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  cursor: default;
  font-size: 10px;
  color: #f0f0f0;
  border: none;
  transition: background 0.1s;
}

.win11-window .titlebar .win-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.win11-window .titlebar .close-btn:hover {
  background: #e81123;
  color: #fff;
}

.win11-window .titlebar .win-btn svg {
  display: block;
}

.win11-window .window-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.3);
  overflow: auto;
  position: relative;
  min-height: 0;
}

/* ─── Window content: File Explorer ─── */
.explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.explorer-toolbar .nav-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: default;
  color: #f0f0f0;
  background: transparent;
  border: none;
  font-size: 14px;
}

.explorer-toolbar .nav-btn:hover { background: rgba(255,255,255,0.08); }
.explorer-toolbar .nav-btn:active { background: rgba(255,255,255,0.04); }

.explorer-toolbar .addr-bar {
  flex: 1;
  height: 26px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.3);
  color: #f0f0f0;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

.explorer-content {
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
}

.explorer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 70px;
  padding: 6px 4px;
  border-radius: 4px;
  cursor: default;
  text-align: center;
}

.explorer-item:hover { background: rgba(255,255,255,0.06); }
.explorer-item .ei-icon { width: 32px; height: 32px; object-fit: contain; margin-bottom: 2px; }
.explorer-item .ei-label { font-size: 11px; color: #f0f0f0; word-break: break-all; max-width: 66px; }

.explorer-sidebar {
  width: 200px;
  background: rgba(0,0,0,0.15);
  border-right: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  padding: 4px 0;
  overflow-y: auto;
}

.explorer-sidebar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  color: #c0c0c0;
  cursor: default;
}

.explorer-sidebar-item:hover { background: rgba(255,255,255,0.06); color: #f0f0f0; }
.explorer-sidebar-item .esi-icon { width: 16px; height: 16px; object-fit: contain; }

.explorer-layout {
  display: flex;
  height: 100%;
}

/* ─── Terminal ─── */
.win11-terminal {
  background: rgba(0, 0, 0, 0.8);
  color: #c0c0c0;
  font-family: 'Cascadia Code', 'Consolas', 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 8px;
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  cursor: text;
  outline: none;
}

.win11-terminal .term-line { line-height: 1.5; }
.win11-terminal .term-prompt { color: #4ec9b0; }
.win11-terminal .term-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: #c0c0c0;
  animation: blink 0.6s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes blink { 50% { background: transparent; } }
.win11-terminal .term-error { color: #f44747; }
.win11-terminal .term-info { color: #4ec9b0; }
.win11-terminal .term-warn { color: #cca700; }

.win11-terminal .term-hidden-input {
  position: fixed; left: 0; top: 0; width: 1px; height: 1px;
  opacity: 0.01; font-size: 16px; border: none; outline: none; padding: 0; margin: 0;
  background: transparent; color: transparent; caret-color: transparent;
}

/* ─── About / info windows ─── */
.about-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 32px;
  text-align: center;
}

.about-content .about-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  object-fit: contain;
}

.about-content .about-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.about-content .about-desc {
  color: #808080;
  font-size: 12px;
  margin-bottom: 20px;
}

.about-content .about-btn {
  padding: 6px 20px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #f0f0f0;
  font-size: 12px;
  cursor: default;
  font-family: inherit;
}

.about-content .about-btn:hover { background: rgba(255,255,255,0.1); }

/* ─── Taskbar ─── */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 0 12px;
}

#taskbar-center {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}

#taskbar-left {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: auto;
  height: 100%;
}

#taskbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  height: 100%;
}

.tb-btn {
  width: 40px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: default;
  background: transparent;
  border: none;
  color: #f0f0f0;
  transition: background 0.1s;
  position: relative;
  font-size: 14px;
}

.tb-btn:hover { background: rgba(255, 255, 255, 0.08); }
.tb-btn:active { background: rgba(255, 255, 255, 0.04); }

.tb-btn img, .tb-btn svg {
  width: 20px;
  height: 20px;
  object-fit: contain;
  pointer-events: none;
}

#start-btn {
  width: 40px;
  height: 36px;
}

#start-btn img, #start-btn svg {
  width: 18px;
  height: 18px;
}

/* Taskbar app buttons container */
#taskbar-apps {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}

/* Taskbar app buttons for open windows */
.tb-app-btn {
  height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  cursor: default;
  background: transparent;
  border: none;
  color: #f0f0f0;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.1s;
  max-width: 150px;
  position: relative;
}

.tb-app-btn:hover { background: rgba(255, 255, 255, 0.08); }

.tb-app-btn.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: #60cdff;
}

.tb-app-btn img, .tb-app-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  object-fit: contain;
}

.tb-app-btn .tb-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#taskbar-tray {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
}

.tray-btn {
  width: 28px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  border-radius: 4px;
}

.tray-btn:hover { background: rgba(255,255,255,0.08); }
.tray-btn svg { width: 16px; height: 16px; fill: #f0f0f0; }

#clock {
  padding: 0 8px;
  font-size: 11px;
  color: #f0f0f0;
  cursor: default;
  text-align: center;
  line-height: 1.3;
}

/* ─── Start Menu ─── */
#start-menu {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 540px;
  max-height: 440px;
  background: rgba(32, 32, 32, 0.92);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 10000;
  padding: 20px;
  flex-direction: column;
}

#start-menu.open { display: flex; }

.start-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.start-header .sh-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.start-header .sh-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.start-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  margin-bottom: 12px;
  cursor: default;
}

.start-search svg { width: 14px; height: 14px; fill: #808080; flex-shrink: 0; }
.start-search span { color: #808080; font-size: 12px; }

.start-apps {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  overflow-y: auto;
  padding: 2px 0;
}

.start-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border-radius: 4px;
  cursor: default;
  gap: 4px;
}

.start-app:hover { background: rgba(255,255,255,0.06); }

.start-app .sa-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.start-app .sa-name {
  font-size: 11px;
  color: #c0c0c0;
  text-align: center;
  line-height: 1.2;
}

.start-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.start-bottom .sb-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.start-bottom .sb-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: default;
  font-size: 12px;
  color: #c0c0c0;
}

.start-bottom .sb-btn:hover { background: rgba(255,255,255,0.06); color: #f0f0f0; }

.start-bottom .sb-btn svg {
  width: 16px;
  height: 16px;
  fill: #c0c0c0;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.win11-window.animating {
  animation: fadeIn 0.2s ease-out;
}

#start-menu.animating {
  animation: fadeIn 0.15s ease-out;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  #start-menu { width: 96vw; left: 2vw; transform: translateX(0); }
  .start-apps { grid-template-columns: repeat(4, 1fr); }
  .desktop-icon { width: 64px; }
  .desktop-icon .icon-img { width: 32px; height: 32px; }
}

/* ─── Context Menu (Win11 dark) ─── */
#context-menu {
  position: fixed;
  z-index: 20000;
  display: none;
  background: rgba(40, 40, 40, 0.96);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  padding: 4px;
  min-width: 180px;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  cursor: default;
  font-size: 12px;
  color: #e0e0e0;
  border-radius: 4px;
  position: relative;
  white-space: nowrap;
}
.ctx-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.ctx-item .ctx-arrow { margin-left: auto; font-size: 9px; color: #808080; }

.ctx-sep {
  height: 1px;
  margin: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
}

.ctx-submenu {
  position: absolute;
  left: 100%;
  top: -4px;
  min-width: 150px;
  background: rgba(40, 40, 40, 0.96);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  display: none;
  padding: 4px;
  z-index: 20001;
}

/* ─── Folder drop target highlight ─── */
.desktop-icon.drop-target {
  background: rgba(0, 103, 192, 0.3) !important;
  outline: 2px solid #60cdff !important;
}
.folder-item.drop-target {
  background: rgba(0, 103, 192, 0.3) !important;
}

/* ─── Recycle bin drop target ─── */
.desktop-icon.drop-recycle {
  background: rgba(232, 17, 35, 0.25) !important;
  outline: 2px solid #e81123 !important;
}

/* ─── Notepad ─── */
.notepad-body {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  padding: 8px;
}

/* ─── Folder content window ─── */
.folder-content {
  padding: 8px;
  height: 100%;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
}
.folder-empty {
  text-align: center;
  padding: 40px 20px;
  color: #808080;
  font-size: 12px;
}
.folder-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: #e0e0e0;
  cursor: default;
  border-radius: 4px;
}
.folder-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.folder-item .fi-icon { width: 20px; height: 20px; flex-shrink: 0; object-fit: contain; }
.folder-item .fi-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Desktop icon drag ghost ─── */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  background: rgba(40, 40, 40, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px 10px;
  font: 12px 'Segoe UI', sans-serif;
  color: #e0e0e0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.drag-ghost img { width: 16px; height: 16px; object-fit: contain; }

/* ─── Recycle Bin ─── */
.recycle-content {
  padding: 8px;
  height: 100%;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
}
.recycle-empty {
  text-align: center;
  padding: 40px 20px;
  color: #808080;
  font-size: 12px;
}
.recycle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 12px;
  color: #e0e0e0;
  cursor: grab;
  border-radius: 4px;
}
.recycle-item:active { cursor: grabbing; }
.recycle-item:hover { background: rgba(255, 255, 255, 0.06); }
.recycle-item-name { color: #e0e0e0; }
.recycle-item-date { color: #808080; font-size: 11px; }

/* ─── VS Code ─── */
.vscode-layout {
  display: flex;
  height: 100%;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Cascadia Code', 'Consolas', 'JetBrains Mono', monospace;
  font-size: 13px;
}
.vscode-sidebar {
  width: 180px;
  background: #252526;
  border-right: 1px solid #1e1e1e;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.vscode-sidebar-header {
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #808080;
  background: #252526;
  border-bottom: 1px solid #1e1e1e;
}
.vscode-tree {
  padding: 4px 0;
}
.vscode-tree-item {
  padding: 3px 12px;
  font-size: 13px;
  color: #a0a0a0;
  cursor: default;
  white-space: nowrap;
}
.vscode-tree-item:hover { background: rgba(255,255,255,0.04); }
.vscode-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.vscode-tabs {
  display: flex;
  background: #252526;
  border-bottom: 1px solid #1e1e1e;
  height: 35px;
  align-items: stretch;
  flex-shrink: 0;
}
.vscode-tab {
  padding: 0 16px;
  font-size: 13px;
  color: #808080;
  background: #2d2d2d;
  display: flex;
  align-items: center;
  cursor: default;
  border-right: 1px solid #1e1e1e;
  border-top: 1px solid transparent;
  white-space: nowrap;
}
.vscode-tab.active {
  color: #f0f0f0;
  background: #1e1e1e;
  border-top: 1px solid #007acc;
}
.vscode-editor {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Cascadia Code', 'Consolas', 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 12px 16px;
  line-height: 1.6;
  tab-size: 4;
}
.vscode-editor::placeholder {
  color: #505050;
  font-style: italic;
}
.vscode-statusbar {
  height: 22px;
  background: #007acc;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}
.vscode-statusbar .vsb-left { margin-right: auto; }
.vscode-statusbar .vsb-right { color: rgba(255,255,255,0.7); font-size: 11px; }

/* ─── Edge Browser ─── */
.edge-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.edge-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.edge-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 4px;
  cursor: default; font-size: 14px;
  color: #f0f0f0;
  background: transparent; border: none;
  flex-shrink: 0; transition: background .1s;
}
.edge-nav-btn:hover { background: rgba(255,255,255,0.08); }
.edge-nav-btn:active { background: rgba(255,255,255,0.04); }

.edge-urlbar {
  flex: 1; height: 28px; padding: 0 10px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.3);
  color: #f0f0f0; font-size: 13px;
  font-family: inherit; outline: none;
  user-select: text; -webkit-user-select: text; cursor: text;
}
.edge-urlbar:focus {
  border-color: rgba(96,205,255,0.5);
  background: rgba(0,0,0,0.5);
}
.edge-urlbar::placeholder { color: #606060; }

.edge-frame {
  flex: 1;
  width: 100%; border: none;
  background: #fff;
  min-height: 0;
}
