/* os/css/system.css — WebOS base system styles */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Rajdhani:wght@300;400;500;600;700&display=swap');

:root {
  /* Color palette — dark terminal OS with neon accents */
  --bg-deep:       #080c10;
  --bg-base:       #0d1117;
  --bg-panel:      #111820;
  --bg-glass:      rgba(13, 20, 30, 0.85);
  --bg-elevated:   #161e2a;
  --bg-hover:      #1c2838;

  --border:        rgba(0, 200, 255, 0.12);
  --border-bright: rgba(0, 200, 255, 0.35);

  --accent:        #00c8ff;
  --accent-dim:    rgba(0, 200, 255, 0.5);
  --accent-glow:   rgba(0, 200, 255, 0.15);
  --accent2:       #ff2d55;
  --accent3:       #39ff14;
  --accent-warn:   #ffbb00;

  --text-primary:   #d4e8f0;
  --text-secondary: #7a9ab0;
  --text-dim:       #3a5566;
  --text-accent:    #00c8ff;

  /* System fonts */
  --font-mono:    'Share Tech Mono', 'Courier New', monospace;
  --font-ui:      'Rajdhani', 'Segoe UI', sans-serif;

  /* Sizing */
  --radius:        4px;
  --radius-lg:     8px;
  --taskbar-h:     42px;
  --titlebar-h:    32px;
  --transition:    150ms ease;
  --transition-md: 250ms ease;

  /* Scanline effect intensity */
  --scanline-opacity: 0.025;
}

/* ── RESET ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  user-select: none;
  -webkit-user-select: none;
}

/* ── SCROLLBARS ──────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 99px; }

/* ── SCANLINE OVERLAY ────────────────────────────────── */
#scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0, var(--scanline-opacity)) 2px,
    rgba(0,0,0, var(--scanline-opacity)) 4px
  );
}

/* ── BOOT SCREEN ─────────────────────────────────────── */
#boot-screen {
  position: fixed; inset: 0;
  background: var(--bg-deep);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 10000;
  transition: opacity 0.6s ease;
}
#boot-screen.fade-out {
  opacity: 0; pointer-events: none;
}
.boot-logo {
  font-family: var(--font-mono);
  font-size: clamp(20px, 4vw, 36px);
  color: var(--accent);
  letter-spacing: 0.4em;
  text-shadow: 0 0 20px var(--accent), 0 0 60px var(--accent-dim);
  margin-bottom: 40px;
  animation: bootPulse 1s ease infinite alternate;
}
.boot-log {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  width: min(500px, 80vw);
  height: 120px;
  overflow: hidden;
  line-height: 1.6;
}
.boot-log p { animation: bootLine 0.2s ease both; }
.boot-bar {
  width: min(300px, 70vw); height: 2px;
  background: var(--bg-elevated);
  margin-top: 24px; overflow: hidden;
  border-radius: 99px;
}
.boot-bar-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.15s ease;
}
@keyframes bootPulse {
  from { text-shadow: 0 0 10px var(--accent); }
  to   { text-shadow: 0 0 30px var(--accent), 0 0 80px var(--accent-dim); }
}
@keyframes bootLine {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── GLITCH EFFECT ───────────────────────────────────── */
.glitch {
  animation: glitch 0.3s steps(2) 1;
}
@keyframes glitch {
  0%   { filter: none; transform: none; }
  20%  { filter: hue-rotate(90deg) saturate(3); transform: translateX(2px); }
  40%  { filter: invert(0.15); transform: translateX(-2px) skewX(2deg); }
  60%  { filter: none; transform: skewX(-1deg); }
  80%  { filter: hue-rotate(-30deg); transform: none; }
  100% { filter: none; transform: none; }
}

/* ── NOTIFICATION TOASTS ─────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--taskbar-h) + 12px);
  right: 12px;
  z-index: 8000;
  display: flex; flex-direction: column;
  gap: 6px; align-items: flex-end;
}
.toast {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  background: var(--bg-panel);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  max-width: 300px;
  animation: toastIn 0.25s ease both;
  transition: opacity 0.3s;
}
.toast.bug-destructive { border-color: var(--accent2); color: var(--accent2); }
.toast.bug-logical     { border-color: var(--accent-warn); color: var(--accent-warn); }
.toast.bug-phantom     { border-color: var(--text-dim); opacity: 0.7; }
.toast.bug-recursive   { border-color: var(--accent3); color: var(--accent3); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── CONTEXT MENU ────────────────────────────────────── */
#context-menu {
  position: fixed;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 9000;
  min-width: 160px;
  padding: 4px 0;
  font-size: 13px;
  display: none;
}
#context-menu.visible { display: block; }
.ctx-item {
  padding: 7px 16px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.ctx-item:hover { background: var(--bg-hover); color: var(--accent); }
.ctx-item.danger { color: var(--accent2); }
.ctx-item.danger:hover { background: rgba(255, 45, 85, 0.1); }
.ctx-separator {
  height: 1px; background: var(--border);
  margin: 4px 0;
}

/* ── DESKTOP UPLOAD DROP OVERLAY ─────────────────────── */
/* Shown when user drags local files over the desktop */
#desktop.dd-over::after {
  content: '⬆  Drop to upload to /home';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent);
  background: rgba(0, 200, 255, 0.04);
  border: 2px dashed var(--accent-dim);
  border-radius: var(--radius-lg);
  pointer-events: none;
  z-index: 500;
  letter-spacing: 0.05em;
  text-shadow: 0 0 16px var(--accent);
  animation: dropPulse 1s ease infinite alternate;
}
@keyframes dropPulse {
  from { border-color: var(--accent-dim); }
  to   { border-color: var(--accent); box-shadow: inset 0 0 40px rgba(0,200,255,0.04); }
}
