/* ===== WebOS 2 - Core Styles ===== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0d0d0f;
  --bg-secondary: #131316;
  --bg-tertiary: #1a1a1f;
  --bg-elevated: #22222a;
  --bg-glass: rgba(20, 20, 28, 0.72);
  --bg-glass-light: rgba(255, 255, 255, 0.05);

  --accent-purple: #7c3aed;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-gradient: linear-gradient(135deg, #7c3aed, #06b6d4);
  --accent-gradient-soft: linear-gradient(135deg, rgba(124, 58, 237, 0.4), rgba(6, 182, 212, 0.4));

  --text-primary: #f0f0f5;
  --text-secondary: #9090a8;
  --text-muted: #55556a;
  --text-accent: #a78bfa;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-normal: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --border-accent: rgba(124, 58, 237, 0.5);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  --transition-fast: 120ms ease;
  --transition-normal: 220ms ease;
  --transition-slow: 380ms cubic-bezier(0.34, 1.56, 0.64, 1);

  --topbar-height: 38px;
  --dock-height: 72px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-sm { font-size: 11px; }
.text-xs { font-size: 10px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Boot Screen ===== */
#boot-screen {
  position: fixed;
  inset: 0;
  background: #080810;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
}

.boot-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.boot-icon {
  width: 72px;
  height: 72px;
  animation: bootPulse 1.5s ease-in-out infinite;
}

.boot-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.6));
}

.boot-title {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.boot-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.boot-progress {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.boot-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

@keyframes bootPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
}

/* ===== Lock Screen ===== */
#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lock-wallpaper {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #080810;
  filter: blur(20px) brightness(0.4);
  transform: scale(1.05);
}

.lock-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.lock-time {
  font-size: 72px;
  font-weight: 200;
  letter-spacing: -3px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.lock-date {
  font-size: 18px;
  font-weight: 300;
  color: rgba(255,255,255,0.75);
  margin-bottom: 24px;
}

.lock-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-2xl);
  min-width: 280px;
}

.lock-avatar {
  width: 56px;
  height: 56px;
  background: rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(124, 58, 237, 0.5);
}

.lock-avatar svg {
  width: 36px;
  height: 36px;
}

.lock-username {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.lock-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.lock-input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
  text-align: center;
  user-select: text;
}

.lock-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.lock-input::placeholder {
  color: var(--text-muted);
}

.lock-btn {
  width: 38px;
  height: 38px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
}

.lock-btn:hover { opacity: 0.9; transform: scale(1.05); }
.lock-btn svg { width: 18px; height: 18px; }

/* ===== Topbar ===== */
#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: rgba(13, 13, 15, 0.85);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 800;
  gap: 16px;
}

.topbar-left { flex: 1; display: flex; align-items: center; }
.topbar-center { flex: 0 0 auto; display: flex; align-items: center; }
.topbar-right { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-logo:hover {
  background-color: var(--bg-glass-light);
}

.topbar-workspace { display: flex; align-items: center; gap: 6px; }

.ws-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ws-dot.active {
  background: var(--accent-purple);
  box-shadow: 0 0 6px rgba(124, 58, 237, 0.6);
  width: 18px;
}

.ws-dot:hover:not(.active) { background: var(--text-secondary); }

.topbar-sys {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sys-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sys-icon:hover {
  color: var(--text-primary);
  background: var(--bg-glass-light);
}

.topbar-clock {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  cursor: default;
}

.topbar-date {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ===== App Menu ===== */
#app-menu {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  animation: fadeIn var(--transition-normal);
}

.app-menu-inner {
  background: rgba(18, 18, 24, 0.92);
  backdrop-filter: blur(40px);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-2xl);
  padding: 28px;
  width: 560px;
  max-height: 480px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-menu-search-wrap {
  position: relative;
}

.app-menu-search {
  width: 100%;
  background: var(--bg-glass-light);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast);
  user-select: text;
}

.app-menu-search:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.app-menu-search::placeholder { color: var(--text-muted); }

.app-menu-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  overflow-y: auto;
  max-height: 340px;
}

.app-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.app-menu-item:hover {
  background: var(--bg-glass-light);
  border-color: var(--border-subtle);
  transform: translateY(-2px);
}

.app-menu-item-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.app-menu-item-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

/* ===== Notification ===== */
#notification-container {
  position: fixed;
  top: calc(var(--topbar-height) + 12px);
  right: 16px;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notification {
  background: rgba(22, 22, 30, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-left: 3px solid var(--accent-purple);
}

.notification.success { border-left-color: var(--accent-green); }
.notification.warning { border-left-color: var(--accent-orange); }
.notification.error   { border-left-color: var(--accent-pink); }

.notification-icon { font-size: 18px; flex-shrink: 0; }
.notification-body { flex: 1; }
.notification-title { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.notification-text { font-size: 11px; color: var(--text-secondary); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(120px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120px); opacity: 0; }
}

/* ===== Context Menu ===== */
#context-menu {
  position: fixed;
  z-index: 900;
  background: rgba(18, 18, 26, 0.97);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 6px;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.15s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.ctx-item:hover {
  background: rgba(124, 58, 237, 0.2);
  color: var(--text-primary);
}

.ctx-icon { font-size: 14px; width: 18px; text-align: center; }

.ctx-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 6px;
}

.ctx-label {
  padding: 6px 12px 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

.ctx-item.ctx-danger { color: #f87171; }
.ctx-item.ctx-danger:hover {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

/* ===== Dock / App Context Popup ===== */
#dock-ctx-popup {
  position: fixed;
  z-index: 950;
  background: rgba(18, 18, 26, 0.97);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 6px;
  min-width: 170px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.12s ease;
}

.dcp-title {
  padding: 6px 10px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  pointer-events: none;
}

.dcp-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 6px;
}

.dcp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.dcp-item:hover { background: rgba(124, 58, 237, 0.2); }
.dcp-item.dcp-active { color: var(--accent-cyan); }
.dcp-item.dcp-danger { color: #f87171; }
.dcp-item.dcp-danger:hover { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }

/* ===== System Tray Panel ===== */
#sys-panel {
  position: fixed;
  top: calc(var(--topbar-height) + 6px);
  right: 8px;
  z-index: 850;
  background: rgba(18, 18, 26, 0.97);
  backdrop-filter: blur(28px);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.12s ease;
}

.sysp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

.sysp-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sysp-slider {
  flex: 1;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.sysp-val {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.sysp-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.sysp-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.sysp-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
  margin-top: 2px;
  transition: background var(--transition-fast);
}

.sysp-btn:hover { background: rgba(124, 58, 237, 0.2); }

.topbar-sys { cursor: pointer; }

/* ===== Topbar Active App ===== */
.topbar-active-app {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0 10px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 1px solid var(--border-subtle);
  margin-left: 6px;
  transition: color var(--transition-fast);
}

.topbar-active-app:not(:empty) { color: var(--text-secondary); }

/* ===== Notification Bell ===== */
.notif-bell-btn {
  position: relative;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  user-select: none;
  flex-shrink: 0;
}

.notif-bell-btn:hover {
  color: var(--text-primary);
  background: var(--bg-glass-light);
}

.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 14px;
  height: 14px;
  background: var(--accent-pink);
  border-radius: var(--radius-full);
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  line-height: 1;
}

/* ===== App Menu Pin Indicator ===== */
.app-menu-item { position: relative; }

.app-menu-pinned {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  opacity: 0.65;
  line-height: 1;
}
