/* ============================================
   desktop.css — Cipher Linux Desktop UI
   ============================================ */

/* ── BOOT SCREEN ── */
#boot-screen {
  position: fixed;
  inset: 0;
  background: var(--cipher-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  z-index: 9999;
  transition: opacity 0.6s var(--ease-out);
}
#boot-screen.fade-out { opacity: 0; pointer-events: none; }

.boot-logo { animation: boot-pulse 2s ease-in-out infinite; }
@keyframes boot-pulse {
  0%, 100% { filter: drop-shadow(0 0 8px var(--cipher-purple)); }
  50%       { filter: drop-shadow(0 0 22px var(--cipher-purple-light)); }
}

.boot-name {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--cipher-violet);
  letter-spacing: 0.12em;
}
.boot-version {
  font-size: var(--text-sm);
  color: var(--cipher-text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}
.boot-bar {
  width: 220px;
  height: 2px;
  background: var(--cipher-surface-3);
  border-radius: var(--radius-full);
  margin-top: var(--space-4);
  overflow: hidden;
}
.boot-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cipher-purple), var(--cipher-violet));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}
.boot-log {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--cipher-text-3);
  margin-top: var(--space-2);
  height: 18px;
  text-align: center;
}

/* ── WALLPAPER CANVAS ── */
#wallpaper-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ── DESKTOP ── */
#desktop {
  position: fixed;
  inset: 0;
  z-index: var(--z-desktop);
}

/* ── DESKTOP ICONS ── */
#desktop-icons {
  position: absolute;
  top: var(--space-5);
  left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  z-index: 2;
}
.desk-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  width: 72px;
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--dur-fast);
  user-select: none;
}
.desk-icon:hover { background: rgba(124,106,247,0.12); }
.desk-icon:active { background: rgba(124,106,247,0.22); transform: scale(0.95); }
.desk-icon-img {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: var(--cipher-violet);
  filter: drop-shadow(0 2px 8px var(--cipher-purple-glow));
  transition: filter var(--dur-med);
}
.desk-icon:hover .desk-icon-img {
  filter: drop-shadow(0 4px 16px var(--cipher-purple));
}
.desk-icon span {
  font-size: var(--text-xs);
  color: var(--cipher-text);
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  white-space: nowrap;
}

/* ── CONTEXT MENU ── */
#context-menu {
  position: fixed;
  background: var(--cipher-surface);
  border: 1px solid var(--cipher-border);
  border-radius: var(--radius-md);
  padding: var(--space-1) 0;
  min-width: 200px;
  z-index: 500;
  box-shadow: var(--shadow-window);
  backdrop-filter: blur(20px);
}
.ctx-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-md);
  color: var(--cipher-text);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.ctx-item svg { width: 14px; height: 14px; color: var(--cipher-text-2); }
.ctx-item:hover { background: rgba(124,106,247,0.14); color: var(--cipher-violet); }
.ctx-divider { height: 1px; background: var(--cipher-border-2); margin: var(--space-1) 0; }

/* ── WINDOWS ── */
#windows-container {
  position: absolute;
  inset: 0;
  z-index: var(--z-window);
  pointer-events: none;
}
.window {
  position: absolute;
  min-width: 380px;
  min-height: 260px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-window);
  background: var(--cipher-surface);
  border: 1px solid var(--cipher-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: all;
  transition: box-shadow var(--dur-med), transform var(--dur-fast);
  animation: win-open var(--dur-med) var(--ease-snap);
}
@keyframes win-open {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.window.focused {
  box-shadow: var(--shadow-window), var(--shadow-glow);
  border-color: rgba(124,106,247,0.35);
}
.window.minimized { display: none; }

/* Window Titlebar */
.win-titlebar {
  height: 38px;
  display: flex; align-items: center;
  padding: 0 var(--space-3);
  gap: var(--space-2);
  background: var(--cipher-surface-2);
  border-bottom: 1px solid var(--cipher-border-2);
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}
.win-controls { display: flex; gap: 6px; }
.win-btn {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: none; cursor: pointer;
  transition: filter var(--dur-fast);
  flex-shrink: 0;
}
.win-btn:hover { filter: brightness(1.3); }
.win-btn.close   { background: #ff5f57; }
.win-btn.min     { background: #ffbd2e; }
.win-btn.max     { background: #28c840; }

.win-title {
  flex: 1;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--cipher-text-2);
  font-weight: 500;
  pointer-events: none;
}
.win-icon { font-size: 14px; color: var(--cipher-violet); margin-right: var(--space-1); }

/* Window Body */
.win-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--cipher-surface);
}

/* ── TASKBAR ── */
#taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 46px;
  display: flex; align-items: center;
  padding: 0 var(--space-3);
  gap: var(--space-3);
  background: rgba(10,10,15,0.88);
  backdrop-filter: blur(28px) saturate(1.6);
  border-top: 1px solid var(--cipher-border);
  z-index: var(--z-taskbar);
}
#taskbar-left { display: flex; align-items: center; }
#taskbar-center { flex: 1; display: flex; align-items: center; gap: var(--space-2); }
#taskbar-right { display: flex; align-items: center; gap: var(--space-3); }

#apps-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(124,106,247,0.12);
  border: 1px solid var(--cipher-border);
  border-radius: var(--radius-sm);
  color: var(--cipher-violet);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 5px 10px;
  cursor: pointer;
  transition: background var(--dur-fast), box-shadow var(--dur-fast);
}
#apps-btn:hover {
  background: rgba(124,106,247,0.22);
  box-shadow: 0 0 12px var(--cipher-purple-glow);
}

.task-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--cipher-surface-2);
  border: 1px solid var(--cipher-border-2);
  border-radius: var(--radius-sm);
  color: var(--cipher-text-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--dur-fast);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-btn:hover { background: var(--cipher-surface-3); color: var(--cipher-text); }
.task-btn.active {
  background: rgba(124,106,247,0.16);
  border-color: rgba(124,106,247,0.4);
  color: var(--cipher-violet);
}

.tray-item {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  color: var(--cipher-text-2);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.tray-item:hover { background: var(--cipher-surface-3); color: var(--cipher-text); }

#tray-clock {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 1px; padding: 0 var(--space-2);
  cursor: default;
}
#clock-time {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--cipher-text);
  font-weight: 500;
}
#clock-date {
  font-size: 9px;
  color: var(--cipher-text-3);
}

/* ── APP LAUNCHER ── */
#app-launcher {
  position: fixed;
  bottom: 56px;
  left: var(--space-3);
  width: 320px;
  background: rgba(17,17,24,0.92);
  backdrop-filter: blur(28px);
  border: 1px solid var(--cipher-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-window);
  z-index: var(--z-launcher);
  overflow: hidden;
  animation: launcher-open var(--dur-med) var(--ease-snap);
}
@keyframes launcher-open {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.launcher-header { padding: var(--space-3); border-bottom: 1px solid var(--cipher-border-2); }
#launcher-search {
  width: 100%;
  background: var(--cipher-surface-3);
  border: 1px solid var(--cipher-border);
  border-radius: var(--radius-sm);
  color: var(--cipher-text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  padding: var(--space-2) var(--space-3);
  outline: none;
  transition: border-color var(--dur-fast);
}
#launcher-search:focus { border-color: var(--cipher-purple); }
#launcher-search::placeholder { color: var(--cipher-text-3); }

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-1);
  padding: var(--space-3);
}
.launcher-app {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; padding: var(--space-2) var(--space-1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast);
  font-size: 26px;
  color: var(--cipher-violet);
}
.launcher-app span {
  font-size: 9px; color: var(--cipher-text-2);
  text-align: center; line-height: 1.2;
}
.launcher-app:hover { background: rgba(124,106,247,0.14); }

/* ── NOTIFICATIONS ── */
#notification-area {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
  z-index: var(--z-notify);
  pointer-events: none;
}
.notification {
  background: var(--cipher-surface-2);
  border: 1px solid var(--cipher-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  min-width: 260px;
  box-shadow: var(--shadow-window);
  pointer-events: all;
  animation: notif-in 0.3s var(--ease-out);
  display: flex; align-items: flex-start; gap: var(--space-3);
}
@keyframes notif-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.notif-icon { font-size: 18px; color: var(--cipher-violet); flex-shrink: 0; margin-top: 2px; }
.notif-body { flex: 1; }
.notif-title { font-size: var(--text-sm); font-weight: 500; color: var(--cipher-text); }
.notif-msg { font-size: var(--text-xs); color: var(--cipher-text-2); margin-top: 2px; }
.notif-fade { animation: notif-out 0.3s var(--ease-out) forwards; }
@keyframes notif-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* ── TERMINAL APP ── */
.terminal-body {
  background: #080c10;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #c8e6c9;
  padding: var(--space-3);
  height: 100%;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.terminal-output { flex: 1; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }
.terminal-line { margin-bottom: 2px; }
.terminal-line .prompt { color: var(--cipher-purple-light); }
.terminal-line .cmd { color: #ffffff; }
.terminal-line .out { color: #c8e6c9; }
.terminal-line .err { color: var(--cipher-red); }
.terminal-input-row {
  display: flex; align-items: center; gap: 6px;
  margin-top: var(--space-2);
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: var(--space-2);
}
.terminal-prompt-label { color: var(--cipher-purple-light); flex-shrink: 0; }
.terminal-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--font-mono); font-size: 13px; color: #fff;
  caret-color: var(--cipher-violet);
}

/* ── FILES APP ── */
.files-body {
  display: flex; flex-direction: column; height: 100%;
  background: var(--cipher-surface);
}
.files-toolbar {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--cipher-border-2);
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--cipher-text-2);
}
.files-toolbar span { color: var(--cipher-purple-light); }
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
  overflow-y: auto; flex: 1;
}
.file-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast);
  font-size: 32px; color: var(--cipher-yellow);
  text-align: center;
}
.file-item:hover { background: rgba(255,209,102,0.08); }
.file-item span { font-size: var(--text-xs); color: var(--cipher-text-2); word-break: break-word; }
.file-item.folder { color: var(--cipher-yellow); }
.file-item.file-txt { color: var(--cipher-blue); font-size: 28px; }
.file-item.file-img { color: var(--cipher-accent); font-size: 28px; }

/* ── SETTINGS APP ── */
.settings-body {
  display: flex; height: 100%; overflow: hidden;
}
.settings-sidebar {
  width: 160px; flex-shrink: 0;
  border-right: 1px solid var(--cipher-border-2);
  padding: var(--space-3) 0;
  background: var(--cipher-surface-2);
  overflow-y: auto;
}
.settings-nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm); color: var(--cipher-text-2);
  cursor: pointer; transition: all var(--dur-fast);
}
.settings-nav-item i { font-size: 16px; }
.settings-nav-item:hover { background: rgba(124,106,247,0.1); color: var(--cipher-text); }
.settings-nav-item.active { background: rgba(124,106,247,0.16); color: var(--cipher-violet); }
.settings-content { flex: 1; padding: var(--space-5); overflow-y: auto; }
.settings-section-title {
  font-size: var(--text-lg); font-weight: 600;
  color: var(--cipher-text); margin-bottom: var(--space-4);
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--cipher-border-2);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: var(--text-md); color: var(--cipher-text); }
.settings-sublabel { font-size: var(--text-sm); color: var(--cipher-text-3); margin-top: 2px; }
.settings-toggle {
  width: 38px; height: 22px;
  background: var(--cipher-surface-3); border-radius: 11px;
  position: relative; cursor: pointer; transition: background var(--dur-med);
}
.settings-toggle.on { background: var(--cipher-purple); }
.settings-toggle::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: white; top: 3px; left: 3px;
  transition: left var(--dur-med) var(--ease-snap);
}
.settings-toggle.on::after { left: 19px; }

/* ── TEXT EDITOR APP ── */
.text-editor-body {
  display: flex; flex-direction: column; height: 100%;
}
.text-toolbar {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--cipher-border-2);
  display: flex; gap: var(--space-2);
  background: var(--cipher-surface-2);
}
.text-btn {
  background: transparent; border: 1px solid var(--cipher-border);
  border-radius: var(--radius-sm);
  color: var(--cipher-text-2); font-size: var(--text-sm);
  padding: 3px 10px; cursor: pointer;
  transition: all var(--dur-fast);
}
.text-btn:hover { background: var(--cipher-surface-3); color: var(--cipher-text); }
.text-area {
  flex: 1; background: transparent; border: none; outline: none; resize: none;
  color: var(--cipher-text); font-family: var(--font-mono); font-size: 13px;
  padding: var(--space-4); line-height: 1.7;
}

/* ── CALCULATOR APP ── */
.calc-body {
  display: flex; flex-direction: column;
  height: 100%; background: var(--cipher-surface);
  padding: var(--space-3); gap: var(--space-2);
}
.calc-display {
  background: var(--cipher-surface-2);
  border: 1px solid var(--cipher-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  text-align: right;
}
.calc-expr { font-size: var(--text-sm); color: var(--cipher-text-3); font-family: var(--font-mono); min-height: 18px; }
.calc-val  { font-size: var(--text-2xl); color: var(--cipher-text); font-family: var(--font-mono); font-weight: 500; }
.calc-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: 1;
}
.calc-btn {
  background: var(--cipher-surface-2);
  border: 1px solid var(--cipher-border-2);
  border-radius: var(--radius-md);
  color: var(--cipher-text);
  font-size: var(--text-md); font-family: var(--font-mono);
  cursor: pointer; transition: all var(--dur-fast);
}
.calc-btn:hover { background: var(--cipher-surface-3); }
.calc-btn:active { transform: scale(0.95); }
.calc-btn.op { color: var(--cipher-purple-light); background: rgba(124,106,247,0.08); }
.calc-btn.eq { background: var(--cipher-purple); color: white; border-color: transparent; }
.calc-btn.eq:hover { background: var(--cipher-purple-light); }
.calc-btn.clr { color: var(--cipher-red); }

/* ── ABOUT APP ── */
.about-body {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-4);
  height: 100%; padding: var(--space-6);
  text-align: center;
}
.about-logo svg { filter: drop-shadow(0 0 20px var(--cipher-purple)); }
.about-name { font-size: var(--text-xl); font-weight: 600; color: var(--cipher-violet); }
.about-version { font-size: var(--text-sm); color: var(--cipher-text-3); font-family: var(--font-mono); }
.about-desc { font-size: var(--text-md); color: var(--cipher-text-2); max-width: 300px; line-height: 1.6; }
.about-specs { width: 100%; background: var(--cipher-surface-2); border: 1px solid var(--cipher-border); border-radius: var(--radius-md); overflow: hidden; }
.about-spec-row { display: flex; justify-content: space-between; padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--cipher-border-2); font-size: var(--text-sm); }
.about-spec-row:last-child { border-bottom: none; }
.about-spec-key { color: var(--cipher-text-3); }
.about-spec-val { color: var(--cipher-text); font-family: var(--font-mono); }

/* ── MUSIC APP ── */
.music-body {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-5);
  height: 100%; padding: var(--space-6);
}
.music-art {
  width: 120px; height: 120px; border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--cipher-purple), var(--cipher-blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: white;
  box-shadow: 0 8px 32px var(--cipher-purple-glow);
  animation: spin-art 8s linear infinite paused;
}
.music-art.playing { animation-play-state: running; }
@keyframes spin-art { to { transform: rotate(360deg); } }
.music-title { font-size: var(--text-lg); font-weight: 600; color: var(--cipher-text); }
.music-artist { font-size: var(--text-sm); color: var(--cipher-text-3); }
.music-controls { display: flex; align-items: center; gap: var(--space-4); }
.music-ctrl-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--cipher-text-2); font-size: 22px;
  transition: color var(--dur-fast), transform var(--dur-fast);
}
.music-ctrl-btn:hover { color: var(--cipher-violet); transform: scale(1.1); }
.music-ctrl-btn.play-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--cipher-purple);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 20px;
}
.music-ctrl-btn.play-btn:hover { background: var(--cipher-purple-light); transform: scale(1.05); }
.music-progress { width: 100%; }
.music-bar {
  width: 100%; height: 3px;
  background: var(--cipher-surface-3); border-radius: var(--radius-full);
  position: relative; cursor: pointer;
}
.music-bar-fill {
  height: 100%; border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--cipher-purple), var(--cipher-violet));
  width: 35%; transition: width 1s linear;
}
.music-times { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--cipher-text-3); margin-top: 4px; font-family: var(--font-mono); }

/* ── BROWSER APP ── */
.browser-body { display: flex; flex-direction: column; height: 100%; }
.browser-bar {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--cipher-surface-2);
  border-bottom: 1px solid var(--cipher-border-2);
}
.browser-nav-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--cipher-text-2); padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast);
}
.browser-nav-btn:hover { background: var(--cipher-surface-3); color: var(--cipher-text); }
.browser-url {
  flex: 1; background: var(--cipher-surface-3);
  border: 1px solid var(--cipher-border);
  border-radius: var(--radius-sm);
  color: var(--cipher-text);
  font-family: var(--font-mono); font-size: var(--text-sm);
  padding: 4px var(--space-3); outline: none;
  transition: border-color var(--dur-fast);
}
.browser-url:focus { border-color: var(--cipher-purple); }
.browser-content {
  flex: 1; background: var(--cipher-surface);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: var(--space-3);
  color: var(--cipher-text-3); font-size: var(--text-md);
}
.browser-home-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3);
  width: 100%; padding: var(--space-5);
}
.browser-bookmark {
  background: var(--cipher-surface-2); border: 1px solid var(--cipher-border);
  border-radius: var(--radius-md); padding: var(--space-3);
  text-align: center; cursor: pointer;
  transition: all var(--dur-fast);
  font-size: var(--text-sm); color: var(--cipher-text-2);
}
.browser-bookmark:hover { background: var(--cipher-surface-3); border-color: var(--cipher-purple); color: var(--cipher-text); }
.browser-bookmark i { font-size: 24px; color: var(--cipher-violet); display: block; margin-bottom: 6px; }
