/* APESHITT AOS - Quantum Sovereign Design System */
/* Apple UIKit Inspired Monochromatic Excellence */

/* =====================================
   DESIGN TOKENS & CSS CUSTOM PROPERTIES
   ===================================== */

:root {
  /* === COLOR SYSTEM === */
  /* Light Mode Colors - No Filled Backgrounds (Transparent/White Only) */
  --apeshitt-bg-primary-light: transparent;
  --apeshitt-bg-secondary-light: transparent;
  --apeshitt-bg-tertiary-light: transparent;
  --apeshitt-text-primary-light: #000000;
  --apeshitt-text-secondary-light: #666666;
  --apeshitt-text-tertiary-light: #999999;
  --apeshitt-border-light: rgba(0, 0, 0, 0.2);
  --apeshitt-border-subtle-light: rgba(0, 0, 0, 0.1);
  --apeshitt-shadow-light: rgba(0, 0, 0, 0.1);
  --apeshitt-hover-light: rgba(0, 0, 0, 0.03);
  --apeshitt-active-light: rgba(0, 0, 0, 0.05);
  
  /* Dark Mode Colors - Complete Opposite (Solid Fills) */
  --apeshitt-bg-primary-dark: #333333;
  --apeshitt-bg-secondary-dark: #444444;
  --apeshitt-bg-tertiary-dark: #555555;
  --apeshitt-text-primary-dark: #ffffff;
  --apeshitt-text-secondary-dark: #cccccc;
  --apeshitt-text-tertiary-dark: #999999;
  --apeshitt-border-dark: rgba(255, 255, 255, 0.2);
  --apeshitt-border-subtle-dark: rgba(255, 255, 255, 0.1);
  --apeshitt-shadow-dark: rgba(0, 0, 0, 0.3);
  --apeshitt-hover-dark: rgba(255, 255, 255, 0.1);
  --apeshitt-active-dark: rgba(255, 255, 255, 0.15);

  /* Current Theme Variables (Default Light) */
  --apeshitt-bg-primary: var(--apeshitt-bg-primary-light);
  --apeshitt-bg-secondary: var(--apeshitt-bg-secondary-light);
  --apeshitt-bg-tertiary: var(--apeshitt-bg-tertiary-light);
  --apeshitt-text-primary: var(--apeshitt-text-primary-light);
  --apeshitt-text-secondary: var(--apeshitt-text-secondary-light);
  --apeshitt-text-tertiary: var(--apeshitt-text-tertiary-light);
  --apeshitt-border: var(--apeshitt-border-light);
  --apeshitt-border-subtle: var(--apeshitt-border-subtle-light);
  --apeshitt-shadow: var(--apeshitt-shadow-light);
  --apeshitt-hover: var(--apeshitt-hover-light);
  --apeshitt-active: var(--apeshitt-active-light);

  /* === SPACING SYSTEM (8pt Grid) === */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* === APPLE TYPOGRAPHY SCALE === */
  --text-large-title: 34px;
  --text-title1: 28px;
  --text-title2: 22px;
  --text-title3: 20px;
  --text-headline: 17px;
  --text-body: 17px;
  --text-callout: 16px;
  --text-subhead: 15px;
  --text-footnote: 13px;
  --text-caption1: 12px;
  --text-caption2: 11px;

  /* === BORDER RADIUS === */
  --radius-none: 0;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 20px;
  --radius-full: 9999px;

  /* === SHADOWS === */
  --shadow-xs: 0 1px 2px var(--apeshitt-shadow);
  --shadow-sm: 0 1px 3px var(--apeshitt-shadow);
  --shadow-md: 0 4px 6px var(--apeshitt-shadow);
  --shadow-lg: 0 10px 15px var(--apeshitt-shadow);
  --shadow-xl: 0 20px 25px var(--apeshitt-shadow);
  --shadow-quantum: 0 16px 48px var(--apeshitt-shadow);

  /* === GLASSMORPHISM === */
  --glass-light: rgba(255, 255, 255, 0.1);
  --glass-dark: rgba(68, 68, 68, 0.9);
  --glass-blur: blur(20px);
  --glass-saturate: saturate(180%);

  /* === ANIMATION CURVES === */
  --ease-apple: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-quantum: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* === TOUCH TARGETS === */
  --touch-target-min: 44px;
  --button-height-sm: 32px;
  --button-height-md: 36px;
  --button-height-lg: 44px;

  /* === COMPONENT SIZES === */
  --header-height: 60px;
  --sidebar-width: 240px;
  --dock-height: 64px;
}

/* === DARK THEME OVERRIDE === */
[data-theme="dark"], 
.theme-dark,
body.dark {
  --apeshitt-bg-primary: var(--apeshitt-bg-primary-dark);
  --apeshitt-bg-secondary: var(--apeshitt-bg-secondary-dark);
  --apeshitt-bg-tertiary: var(--apeshitt-bg-tertiary-dark);
  --apeshitt-text-primary: var(--apeshitt-text-primary-dark);
  --apeshitt-text-secondary: var(--apeshitt-text-secondary-dark);
  --apeshitt-text-tertiary: var(--apeshitt-text-tertiary-dark);
  --apeshitt-border: var(--apeshitt-border-dark);
  --apeshitt-border-subtle: var(--apeshitt-border-subtle-dark);
  --apeshitt-shadow: var(--apeshitt-shadow-dark);
  --apeshitt-hover: var(--apeshitt-hover-dark);
  --apeshitt-active: var(--apeshitt-active-dark);
  --glass-light: var(--glass-dark);
}

/* =====================================
   MONOCHROMATIC SF SYMBOLS ICONS
   ===================================== */

.apeshitt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  font-size: inherit;
  color: currentColor;
  user-select: none;
}

/* =====================================
   SF SYMBOLS - CLEAN UIKit ICONS
   ===================================== */

/* Settings Cog - Clean geometric design */
.icon-settings::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M12 8a4 4 0 1 1 0 8 4 4 0 0 1 0-8zm7.291 1.293l.708.707-1.414 1.414-.707-.707a1 1 0 0 1 0-1.414zm-14.582 0a1 1 0 0 1 1.414 0l.707.707-1.414 1.414-.707-.707a1 1 0 0 1 0-1.414zM12 2a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0V3a1 1 0 0 1 1-1zm0 16a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1zM3 12a1 1 0 0 1 1-1h2a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zm16 0a1 1 0 0 1 1-1h2a1 1 0 1 1 0 2h-2a1 1 0 0 1-1-1zM5.636 5.636l.707.707-1.414 1.414-.707-.707a1 1 0 0 1 0-1.414zm12.728 12.728l.707.707-1.414 1.414-.707-.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Menu - Clean three lines */
.icon-menu::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M3 6h18v2H3V6zm0 5h18v2H3v-2zm0 5h18v2H3v-2z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Notifications - Clean bell */
.icon-notifications::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M12 2c1.1 0 2 .9 2 2v1.17c2.32.35 4 2.39 4 4.83v3.72c0 .53.21 1.04.59 1.41l1.24 1.24c.37.37.37.98 0 1.35-.19.19-.44.28-.71.28H4.88c-.27 0-.52-.09-.71-.28-.37-.37-.37-.98 0-1.35l1.24-1.24c.38-.37.59-.88.59-1.41V10c0-2.44 1.68-4.48 4-4.83V4c0-1.1.9-2 2-2zm-2 18h4c0 1.1-.9 2-2 2s-2-.9-2-2z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Grid/Launchpad - Clean 3x3 grid */
.icon-grid::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Admin/Shield - Clean shield */
.icon-shield::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Logout - Clean power/exit */
.icon-logout::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M17 7l-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Close - Clean X */
.icon-close::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Arrow Right - Clean chevron */
.icon-arrow-right::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Arrow Left - Clean chevron */
.icon-arrow-left::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M14 7l1.41 1.41L10.83 13l4.58 4.59L14 19l-6-6z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Home - Clean house */
.icon-home::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* User - Clean person */
.icon-user::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Dock - Clean dock icon */
.icon-dock::before {
  content: "";
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M2 20h20v2H2v-2zm0-8h2v6H2v-6zm4 0h2v6H6v-6zm4 0h2v6h-2v-6zm4 0h2v6h-2v-6zm4 0h2v6h-2v-6zM2 2h20v2H2V2zm0 4h20v2H2V6z'/%3e%3c/svg%3e") no-repeat center;
  mask-size: contain;
}

/* Dark theme icon adjustments */
[data-theme="dark"] .apeshitt-icon,
.theme-dark .apeshitt-icon,
body.dark .apeshitt-icon {
  --icon-invert: 1;
}

/* =====================================
   QUANTUM GLASS EFFECTS
   ===================================== */

.quantum-glass {
  background: var(--glass-light);
  backdrop-filter: var(--glass-blur) var(--glass-saturate);
  -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
  border: 1px solid var(--apeshitt-border);
  position: relative;
  overflow: hidden;
}

.quantum-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--quantum-observer-x, 50%) var(--quantum-observer-y, 50%),
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease-quantum);
}

.quantum-glass:hover::before {
  opacity: 1;
}

/* =====================================
   SOVEREIGN COMPONENTS
   ===================================== */

/* Settings Cog - Quantum Authority */
.quantum-settings-cog {
  position: relative;
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: var(--radius-full);
  background: var(--glass-light);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--apeshitt-border);
  color: var(--apeshitt-text-primary);
  cursor: pointer;
  transition: all 0.25s var(--ease-apple);
  overflow: hidden;
}

.quantum-settings-cog:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px var(--apeshitt-shadow);
}

.quantum-settings-cog:active {
  transform: scale(0.95);
}

.quantum-settings-cog::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle, var(--apeshitt-hover) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s var(--ease-apple);
}

.quantum-settings-cog:hover::after {
  opacity: 1;
}

/* Launchpad Button */
.quantum-launchpad-trigger {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: var(--radius-xl);
  background: var(--glass-light);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--apeshitt-border);
  color: var(--apeshitt-text-primary);
  cursor: pointer;
  z-index: 9999;
  transition: all 0.3s var(--ease-spring);
}

.quantum-launchpad-trigger:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: var(--shadow-quantum);
}

/* =====================================
   CONSCIOUSNESS STREAM NAVIGATION
   ===================================== */

.consciousness-stream {
  list-style: none;
  padding: 0;
  margin: 0;
}

.thought-cell {
  padding: var(--space-3) var(--space-6);
  margin: var(--space-1) 0;
  background: transparent;
  border-left: 3px solid transparent;
  color: var(--apeshitt-text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: all 0.2s var(--ease-apple);
  cursor: pointer;
  position: relative;
  opacity: var(--thought-certainty, 1);
}

.thought-cell:hover {
  background: var(--apeshitt-hover);
  border-left-color: var(--apeshitt-text-primary);
  transform: translateX(4px);
}

.thought-cell.active {
  background: var(--apeshitt-active);
  border-left-color: var(--apeshitt-text-primary);
  font-weight: 500;
}

.thought-cell::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--apeshitt-text-primary) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.3s var(--ease-apple);
}

.thought-cell:hover::before,
.thought-cell.active::before {
  opacity: 1;
}

/* =====================================
   QUANTUM ANIMATIONS
   ===================================== */

@keyframes quantum-collapse {
  0% {
    transform: scale(0.95) rotate(0deg);
    opacity: 0;
    filter: blur(10px);
  }
  50% {
    transform: scale(1.02) rotate(180deg);
    opacity: 0.7;
    filter: blur(2px);
  }
  100% {
    transform: scale(1) rotate(360deg);
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes consciousness-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.02);
  }
}

@keyframes sovereign-glow {
  0%, 100% {
    box-shadow: 0 0 5px var(--apeshitt-shadow);
  }
  50% {
    box-shadow: 0 0 20px var(--apeshitt-shadow);
  }
}

/* Quantum Transition Classes */
.quantum-enter {
  animation: quantum-collapse 0.6s var(--ease-quantum);
}

.consciousness-pulse {
  animation: consciousness-pulse 2s infinite var(--ease-apple);
}

.sovereign-authority {
  animation: sovereign-glow 3s infinite var(--ease-apple);
}

/* =====================================
   RESPONSIVE DESIGN
   ===================================== */

@media (max-width: 768px) {
  :root {
    --touch-target-min: 48px;
    --header-height: 56px;
    --sidebar-width: 280px;
  }
  
  .quantum-launchpad-trigger {
    top: var(--space-4);
    right: var(--space-4);
  }
}

/* =====================================
   ACCESSIBILITY
   ===================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .quantum-settings-cog:hover,
  .quantum-launchpad-trigger:hover {
    transform: none;
  }
}

@media (prefers-contrast: high) {
  :root {
    --apeshitt-border-light: rgba(0, 0, 0, 0.5);
    --apeshitt-border-dark: rgba(255, 255, 255, 0.5);
  }
  
  .quantum-glass {
    border-width: 2px;
  }
}

/* Focus indicators for keyboard navigation */
.quantum-settings-cog:focus,
.quantum-launchpad-trigger:focus,
.thought-cell:focus {
  outline: 2px solid var(--apeshitt-text-primary);
  outline-offset: 2px;
}

/* =====================================
   UTILITY CLASSES
   ===================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.glass-surface {
  background: var(--glass-light);
  backdrop-filter: var(--glass-blur) var(--glass-saturate);
  -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
}

.quantum-shadow {
  box-shadow: var(--shadow-quantum);
}

.sovereign-border {
  border: 1px solid var(--apeshitt-border);
}

.apple-smooth {
  transition: all 0.2s var(--ease-apple);
}

.quantum-smooth {
  transition: all 0.3s var(--ease-quantum);
}

/* Text utilities following Apple typography */
.text-large-title { font-size: var(--text-large-title); font-weight: 700; }
.text-title1 { font-size: var(--text-title1); font-weight: 600; }
.text-title2 { font-size: var(--text-title2); font-weight: 600; }
.text-title3 { font-size: var(--text-title3); font-weight: 600; }
.text-headline { font-size: var(--text-headline); font-weight: 600; }
.text-body { font-size: var(--text-body); font-weight: 400; }
.text-callout { font-size: var(--text-callout); font-weight: 400; }
.text-subhead { font-size: var(--text-subhead); font-weight: 400; }
.text-footnote { font-size: var(--text-footnote); font-weight: 400; }
.text-caption1 { font-size: var(--text-caption1); font-weight: 400; }
.text-caption2 { font-size: var(--text-caption2); font-weight: 400; }

/* Color utilities */
.text-primary { color: var(--apeshitt-text-primary); }
.text-secondary { color: var(--apeshitt-text-secondary); }
.text-tertiary { color: var(--apeshitt-text-tertiary); }
.bg-primary { background-color: var(--apeshitt-bg-primary); }
.bg-secondary { background-color: var(--apeshitt-bg-secondary); }
.bg-tertiary { background-color: var(--apeshitt-bg-tertiary); }

/* =====================================
   QUANTUM NOTIFICATIONS
   ===================================== */

.quantum-notification {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 25000;
    background: var(--glass-light);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border: 1px solid var(--apeshitt-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-quantum);
    padding: var(--space-3) var(--space-4);
    max-width: 320px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s var(--ease-spring);
}

.quantum-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.notification-icon {
    font-size: 16px;
    filter: grayscale(1) brightness(0) invert(var(--icon-invert, 0));
    animation: consciousness-pulse 2s infinite var(--ease-apple);
}

.notification-text {
    color: var(--apeshitt-text-primary);
    font-size: var(--text-callout);
    font-weight: 500;
    line-height: 1.2;
}