/* CruxOS - Main Stylesheet */
/* Inspired by Crux Interactive's glass morphism design */

:root {
  /* Base Colors */
  --bg: #0b0e16;
  --bg-secondary: #0f131d;
  --text: #f9fbff;
  --text-muted: #c0c8d9;
  --text-dim: #8892a8;
  
  /* Glass Effects */
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.10);
  --glass-intense: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.18);
  --inner: rgba(255, 255, 255, 0.22);
  
  /* Accents */
  --accent: #7f8cff;
  --accent-light: #93a2ff;
  --accent-dark: #6b7aff;
  --accent-glow: rgba(127, 140, 255, 0.4);
  --success: #19b27b;
  --danger: #ef476f;
  --warning: #ffb703;
  --info: #3498db;
  
  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl: 32px;
  
  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(127, 140, 255, 0.15);
  
  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  
  /* Z-Index Layers */
  --z-desktop: 1;
  --z-icons: 10;
  --z-window: 100;
  --z-taskbar: 500;
  --z-menu: 600;
  --z-notification: 700;
  --z-context: 800;
  --z-modal: 900;
  --z-boot: 1000;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* ========================================
   BOOT SCREEN
======================================== */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-boot);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bootFadeIn 0.5s ease;
}

@keyframes bootFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.boot-content {
  text-align: center;
}

.boot-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.boot-icon {
  width: 80px;
  height: 80px;
  animation: bootPulse 2s ease-in-out infinite;
}

@keyframes bootPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.boot-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.boot-loader {
  width: 200px;
  height: 4px;
  background: var(--glass);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto 20px;
}

.boot-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 2px;
  animation: bootProgress 2.5s ease forwards;
}

@keyframes bootProgress {
  0% { width: 0%; }
  20% { width: 20%; }
  50% { width: 60%; }
  80% { width: 85%; }
  100% { width: 100%; }
}

.boot-status {
  color: var(--text-muted);
  font-size: 0.9rem;
  animation: bootTextPulse 1s ease-in-out infinite;
}

@keyframes bootTextPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ========================================
   LOCK SCREEN
======================================== */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-boot);
  background: linear-gradient(135deg, #0b0e16 0%, #151a2a 50%, #0b0e16 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.lock-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 30% 20%, rgba(127, 140, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(107, 122, 255, 0.06) 0%, transparent 40%);
  pointer-events: none;
}

.lock-time {
  font-size: 6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 60px rgba(255, 255, 255, 0.1);
}

.lock-date {
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: 500;
}

.lock-unlock-btn {
  margin-top: 60px;
  padding: 16px 32px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lock-unlock-btn:hover {
  background: var(--glass-strong);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.lock-unlock-btn svg {
  transition: transform var(--transition-fast);
}

.lock-unlock-btn:hover svg {
  transform: translateX(4px);
}

/* ========================================
   DESKTOP
======================================== */
.desktop {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0b0e16 0%, #12162a 50%, #0b0e16 100%);
  overflow: hidden;
}

.desktop::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(127, 140, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(107, 122, 255, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(99, 102, 241, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: var(--z-desktop);
}

/* Desktop Icons */
.desktop-icons {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  bottom: 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, 90px);
  grid-template-rows: repeat(auto-fill, 100px);
  gap: 8px;
  align-content: start;
  z-index: var(--z-icons);
}

.desktop-icon {
  width: 90px;
  height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.desktop-icon:hover {
  background: var(--glass);
}

.desktop-icon.selected {
  background: rgba(127, 140, 255, 0.2);
  border: 1px solid rgba(127, 140, 255, 0.3);
}

.desktop-icon-img {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.desktop-icon:hover .desktop-icon-img {
  transform: scale(1.05);
}

.desktop-icon-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  word-wrap: break-word;
  max-width: 100%;
  line-height: 1.3;
}

/* Selection Rectangle */
.selection-rect {
  position: absolute;
  border: 1px solid var(--accent);
  background: rgba(127, 140, 255, 0.1);
  pointer-events: none;
  z-index: var(--z-icons);
  display: none;
}

/* ========================================
   TASKBAR
======================================== */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: linear-gradient(180deg, rgba(15, 19, 29, 0.85), rgba(11, 14, 22, 0.95));
  border-top: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: var(--z-taskbar);
}

.taskbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.start-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.start-btn:hover {
  background: var(--glass);
}

.start-btn:active {
  transform: scale(0.95);
}

.taskbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 200px;
  transition: all var(--transition-fast);
}

.taskbar-search:focus-within {
  background: var(--glass-strong);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.taskbar-search svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.taskbar-search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.taskbar-search input::placeholder {
  color: var(--text-dim);
}

.taskbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.taskbar-apps {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.taskbar-app {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all var(--transition-fast);
}

.taskbar-app:hover {
  background: var(--glass-strong);
}

.taskbar-app.active {
  background: rgba(127, 140, 255, 0.2);
}

.taskbar-app.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.taskbar-app img,
.taskbar-app svg {
  width: 24px;
  height: 24px;
}

.taskbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-tray {
  display: flex;
  gap: 4px;
}

.tray-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.tray-btn:hover {
  background: var(--glass);
  color: var(--text);
}

.taskbar-clock {
  padding: 8px 14px;
  background: var(--glass);
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.taskbar-clock:hover {
  background: var(--glass-strong);
}

/* ========================================
   START MENU
======================================== */
.start-menu {
  position: fixed;
  bottom: 60px;
  left: 12px;
  width: 520px;
  max-height: calc(100vh - 80px);
  background: linear-gradient(180deg, rgba(20, 25, 40, 0.95), rgba(15, 19, 30, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: startMenuIn var(--transition-normal) forwards;
}

@keyframes startMenuIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.start-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.start-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.start-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass-strong);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.start-user span {
  font-weight: 600;
}

.start-search {
  flex: 1;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.start-search:focus {
  background: var(--glass-strong);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.start-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.start-section {
  margin-bottom: 20px;
}

.start-section h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.start-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.start-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.start-app:hover {
  background: var(--glass-strong);
}

.start-app-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-app-name {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  color: var(--text);
}

.start-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.start-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.start-list-item:hover {
  background: var(--glass-strong);
}

.start-list-item .start-app-icon {
  width: 32px;
  height: 32px;
}

.start-list-item span {
  font-size: 0.9rem;
  font-weight: 500;
}

.start-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

.start-footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.start-footer-btn:hover {
  background: var(--glass);
  color: var(--text);
}

/* ========================================
   NOTIFICATION CENTER
======================================== */
.notification-center {
  position: fixed;
  bottom: 60px;
  right: 12px;
  width: 380px;
  max-height: calc(100vh - 80px);
  background: linear-gradient(180deg, rgba(20, 25, 40, 0.95), rgba(15, 19, 30, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  z-index: var(--z-notification);
  overflow: hidden;
  animation: notifIn var(--transition-normal) forwards;
}

@keyframes notifIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.notif-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.notif-header button {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.notif-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 12px;
}

.notif-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 24px;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--glass);
  border-radius: var(--r-md);
  margin-bottom: 8px;
}

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.notif-text {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.notif-time {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 4px;
}

.quick-settings {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.quick-settings h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-btn:hover {
  background: var(--glass-strong);
  color: var(--text);
}

.quick-btn.active {
  background: rgba(127, 140, 255, 0.2);
  border-color: rgba(127, 140, 255, 0.3);
  color: var(--accent-light);
}

/* ========================================
   CONTEXT MENU
======================================== */
.context-menu {
  position: fixed;
  min-width: 200px;
  background: linear-gradient(180deg, rgba(25, 30, 45, 0.98), rgba(18, 22, 35, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-context);
  padding: 6px;
  animation: contextIn var(--transition-fast) forwards;
}

@keyframes contextIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-xs);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.context-item:hover {
  background: var(--glass-strong);
}

.context-item svg {
  color: var(--text-muted);
}

.context-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* ========================================
   SCROLLBAR
======================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--glass-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--glass-intense);
}

/* ========================================
   UTILITIES
======================================== */
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

.bg-accent { background: var(--accent); }
.bg-success { background: var(--success); }
.bg-danger { background: var(--danger); }
.bg-warning { background: var(--warning); }

/* Focus styles */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
