/* =============================================
   OmniD3sk — Design System
   ============================================= */

:root {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

:root {
  /* Core Palette */
  --color-bg: #08090f;
  --color-surface: rgba(16, 18, 28, 0.7);
  --color-surface-solid: #10121c;
  --color-surface-raised: rgba(22, 25, 38, 0.85);
  --color-text-main: #e8e4e0;
  --color-text-sub: #8b8fa4;

  /* Dual Personality Accents */
  --color-olivia: #e8a73e;
  --color-olivia-glow: rgba(232, 167, 62, 0.15);
  --color-omni: #00d4aa;
  --color-omni-glow: rgba(0, 212, 170, 0.12);

  /* Primary (defaults to olivia in session, omni in shield) */
  --color-accent-primary: #4d9ff7;
  --color-accent-secondary: #e8a73e;
  --color-accent-glow: rgba(77, 159, 247, 0.12);

  /* Functional */
  --color-danger: #f06050;
  --color-success: #5ced73;
  --color-warning: #ffb74d;

  /* Typography */
  --font-heading: 'Syne', system-ui, sans-serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 64px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Effects */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px var(--color-accent-glow);
  --glass-border: 1px solid rgba(255, 255, 255, 0.06);
  --backdrop-blur: blur(16px);
  --texture-opacity: 0.02;
}

/* Light Mode */
.light-mode {
  --color-bg: #f0ede8;
  --color-surface: rgba(255, 255, 255, 0.85);
  --color-surface-solid: #ffffff;
  --color-surface-raised: rgba(255, 255, 255, 0.95);
  --color-text-main: #1a1c24;
  --color-text-sub: #5a5e70;
  --color-accent-glow: rgba(77, 159, 247, 0.15);
  --color-olivia-glow: rgba(232, 167, 62, 0.1);
  --color-omni-glow: rgba(0, 180, 150, 0.1);
  --texture-opacity: 0.06;
  --glass-border: 1px solid rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Background */
body {
  background-color: var(--color-bg);
  color: var(--color-text-main);
  font-family: var(--font-body);
  font-weight: 400;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Subtle noise texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: var(--texture-opacity);
  z-index: -1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  margin: 0 0 var(--spacing-md) 0;
  color: var(--color-text-main);
  letter-spacing: -0.02em;
}

p {
  line-height: 1.65;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-sub);
}

a {
  color: var(--color-accent-primary);
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

/* ─── Utilities ─── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.glass-panel {
  background: var(--color-surface);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: var(--glass-border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
}

.text-center { text-align: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }

/* ─── Card ─── */
.card {
  background: var(--color-surface);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), var(--shadow-glow);
  border-color: rgba(255, 255, 255, 0.12);
  z-index: 10;
}

/* ─── CTA Button ─── */
.mystic-btn {
  position: relative;
  background: var(--color-accent-primary);
  color: #ffffff;
  padding: 20px 56px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  box-shadow: 0 8px 32px rgba(77, 159, 247, 0.25),
              0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  overflow: hidden;
  z-index: 20;
  letter-spacing: 0.03em;
  font-family: var(--font-heading);
}

.mystic-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 48px rgba(77, 159, 247, 0.35),
              0 0 0 2px rgba(255, 255, 255, 0.15) inset;
  filter: brightness(1.1);
}

.mystic-btn::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 200%; height: 100%;
  background: linear-gradient(115deg, transparent 0%, transparent 42%, rgba(255, 255, 255, 0.25) 50%, transparent 58%, transparent 100%);
  transform: translateX(-150%) skewX(-15deg);
  transition: transform 0.7s;
}

.mystic-btn:hover::after {
  transform: translateX(150%) skewX(-15deg);
}

.mystic-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.mystic-btn.active {
  background: var(--color-danger) !important;
  box-shadow: 0 8px 32px rgba(240, 96, 80, 0.3);
  flex-direction: row !important;
  gap: 12px;
}

/* ─── Session CTA ─── */
.session-cta-btn {
  background: var(--color-accent-primary);
  color: white;
  padding: 24px 48px;
  border-radius: var(--radius-lg);
  width: auto;
  min-width: 280px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(77, 159, 247, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  position: relative;
  overflow: hidden;
  font-family: var(--font-body);
}

.session-cta-btn:hover {
  transform: translateY(-4px) scale(1.02);
  filter: brightness(1.1);
  box-shadow: 0 16px 48px rgba(77, 159, 247, 0.35);
}

.session-cta-btn:active {
  transform: translateY(-2px) scale(0.98);
}

.session-cta-btn::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 200%; height: 100%;
  background: linear-gradient(115deg, transparent 0%, transparent 42%, rgba(255, 255, 255, 0.2) 50%, transparent 58%, transparent 100%);
  transform: translateX(-150%) skewX(-15deg);
  transition: transform 0.7s;
}

.session-cta-btn:hover::after {
  transform: translateX(150%) skewX(-15deg);
}

.session-cta-btn.active {
  background: var(--color-danger) !important;
  box-shadow: 0 8px 32px rgba(240, 96, 80, 0.3);
  flex-direction: row !important;
  gap: 12px;
}

/* ─── Status ─── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.connected {
  background: var(--color-success);
  box-shadow: 0 0 8px rgba(92, 237, 115, 0.4);
}

.status-dot.disconnected { background: var(--color-text-sub); }

.status-dot.connecting {
  background: var(--color-warning);
  animation: pulse 1.5s ease infinite;
}

/* ─── Screen Preview ─── */
.screen-preview-container {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border: var(--glass-border);
}

.screen-preview-container video {
  width: 100%; height: 100%; object-fit: contain;
}

/* Annotation */
.annotation-overlay {
  position: absolute; inset: 0;
  cursor: crosshair; z-index: 5;
}

.annotation-toolbar {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-surface);
  border-radius: var(--radius-full);
  border: var(--glass-border);
  backdrop-filter: var(--backdrop-blur);
}

.annotation-toolbar button {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--color-text-sub);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.annotation-toolbar button:hover,
.annotation-toolbar button.active {
  background: var(--color-accent-glow);
  color: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
}

/* ─── Issue Panel ─── */
.issue-panel {
  padding: var(--spacing-md);
  max-height: 300px;
  overflow-y: auto;
}

.issue-item {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: var(--glass-border);
  margin-bottom: var(--spacing-sm);
  transition: all 0.3s ease;
}

.issue-item:hover {
  border-color: var(--color-accent-primary);
  box-shadow: var(--shadow-glow);
}

.issue-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  font-family: var(--font-mono);
}

.issue-badge.critical { background: rgba(240, 96, 80, 0.15); color: var(--color-danger); }
.issue-badge.high { background: rgba(255, 183, 77, 0.15); color: var(--color-warning); }
.issue-badge.medium { background: rgba(77, 159, 247, 0.15); color: var(--color-accent-primary); }
.issue-badge.low { background: rgba(92, 237, 115, 0.15); color: var(--color-success); }

/* ─── Powered by ─── */
.powered-by-link {
  color: var(--color-accent-primary);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.powered-by-link:hover {
  border-bottom-color: var(--color-accent-primary);
}

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fade-in {
  animation: fadeIn 0.6s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .container { padding: var(--spacing-md); }
  .mystic-btn { padding: 16px 36px; font-size: 1rem; }
  .session-cta-btn { padding: 18px 32px; min-width: 240px; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}
