/* os/css/desktop.css — Desktop and icons */

/* ── DESKTOP ─────────────────────────────────────────── */
#desktop {
  position: fixed;
  inset: 0 0 var(--taskbar-h) 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(0, 200, 255, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(57, 255, 20, 0.03) 0%, transparent 60%),
    var(--bg-base);
}

/* Subtle grid pattern */
#desktop::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.4;
  pointer-events: none;
}

/* ── DESKTOP ICONS ───────────────────────────────────── */
#icon-grid {
  position: absolute;
  top: 16px; left: 16px;
  display: flex; flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.desktop-icon {
  display: flex; flex-direction: column;
  align-items: center;
  width: 72px;
  padding: 8px 4px 6px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  position: relative;
  border: 1px solid transparent;
}
.desktop-icon:hover {
  background: rgba(0, 200, 255, 0.08);
  border-color: var(--border);
}
.desktop-icon.selected {
  background: rgba(0, 200, 255, 0.12);
  border-color: var(--border-bright);
}
.desktop-icon .icon-img {
  font-size: 28px; line-height: 1;
  margin-bottom: 5px;
  filter: drop-shadow(0 0 6px var(--accent-dim));
}
.desktop-icon .icon-label {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-primary);
  text-align: center;
  word-break: break-word;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  line-height: 1.2;
}

/* Corrupted file icon effect */
.desktop-icon.corrupted .icon-img {
  filter: drop-shadow(0 0 6px rgba(255, 45, 85, 0.6)) hue-rotate(150deg);
  animation: corruptPulse 2s ease infinite;
}
.desktop-icon.corrupted .icon-label {
  color: var(--accent2);
}
@keyframes corruptPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; filter: drop-shadow(0 0 8px rgba(255,45,85,0.9)) hue-rotate(180deg); }
}

/* ── TASKBAR ─────────────────────────────────────────── */
#taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--taskbar-h);
  background: rgba(8, 12, 16, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 8px;
  gap: 4px;
  z-index: 1000;
}

/* Start button */
#taskbar-start {
  width: 36px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 18px;
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid var(--border);
  transition: all var(--transition);
  margin-right: 4px;
  flex-shrink: 0;
}
#taskbar-start:hover {
  background: rgba(0, 200, 255, 0.18);
  border-color: var(--border-bright);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Running app buttons */
#taskbar-apps {
  display: flex; gap: 3px; flex: 1; overflow: hidden;
}
.taskbar-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  transition: all var(--transition);
}
.taskbar-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.taskbar-btn.active {
  background: rgba(0, 200, 255, 0.1);
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* System tray */
#taskbar-tray {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto; flex-shrink: 0;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.tray-metric {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 4px;
}
.tray-metric .val { color: var(--text-primary); }
.tray-metric.warn .val { color: var(--accent-warn); }
.tray-metric.danger .val { color: var(--accent2); }
#health-bar {
  width: 40px; height: 3px;
  background: var(--bg-elevated);
  border-radius: 99px; overflow: hidden;
}
#health-bar-fill {
  height: 100%; width: 100%;
  background: var(--accent3);
  transition: width 0.5s ease, background 0.5s ease;
  border-radius: 99px;
}
#clock {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 52px;
  text-align: right;
}

/* ── WINDOWS ─────────────────────────────────────────── */
.os-window {
  position: absolute;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 1px rgba(0,200,255,0.05),
    0 20px 60px rgba(0,0,0,0.6),
    0 0 30px rgba(0,0,0,0.3);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 240px; min-height: 160px;
  transition: box-shadow var(--transition-md);
  will-change: transform;
}
.os-window.focused {
  border-color: var(--border-bright);
  box-shadow:
    0 0 0 1px rgba(0,200,255,0.15),
    0 24px 80px rgba(0,0,0,0.7),
    0 0 40px rgba(0,200,255,0.06);
}
.os-window.minimized {
  transform: scale(0.7) translateY(100px);
  opacity: 0; pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.os-window.opening {
  animation: windowOpen 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes windowOpen {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Titlebar */
.window-titlebar {
  height: var(--titlebar-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 8px;
  cursor: move;
  flex-shrink: 0;
  gap: 8px;
}
.window-titlebar-icon { font-size: 14px; }
.window-titlebar-title {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.os-window.focused .window-titlebar-title { color: var(--text-primary); }

/* Window controls */
.window-controls {
  display: flex; gap: 5px; flex-shrink: 0;
}
.wctrl {
  width: 13px; height: 13px;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  transition: filter var(--transition);
}
.wctrl:hover { filter: brightness(1.3); }
.wctrl-close    { background: #ff5f57; }
.wctrl-minimize { background: #febc2e; }
.wctrl-maximize { background: #28c840; }
.wctrl span { opacity: 0; font-size: 8px; color: rgba(0,0,0,0.5); }
.wctrl:hover span { opacity: 1; }

/* Window body */
.window-body {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* Resize handle */
.window-resize-handle {
  position: absolute;
  right: 0; bottom: 0;
  width: 16px; height: 16px;
  cursor: se-resize;
  z-index: 10;
}
.window-resize-handle::after {
  content: '';
  position: absolute;
  right: 4px; bottom: 4px;
  width: 6px; height: 6px;
  border-right: 2px solid var(--border-bright);
  border-bottom: 2px solid var(--border-bright);
  border-radius: 1px;
}
