/**
 * BASILISK // CORE STYLES v7.0
 * Unified design system for all modules
 */

:root {
  /* Core Palette */
  --c-bg: #030305;
  --c-bg-alt: #0a0a0f;
  --c-panel: rgba(10, 15, 20, 0.92);
  --c-panel-light: rgba(15, 20, 28, 0.85);
  
  /* Neon Accents */
  --c-accent: #00f3ff;
  --c-accent-dim: rgba(0, 243, 255, 0.5);
  --c-secondary: #bc13fe;
  --c-secondary-dim: rgba(188, 19, 254, 0.5);
  --c-alert: #ff003c;
  --c-alert-dim: rgba(255, 0, 60, 0.5);
  --c-success: #00ff9f;
  --c-warning: #ffb84d;
  
  /* Text */
  --c-text: #e0e6ed;
  --c-text-dim: rgba(224, 230, 237, 0.6);
  --c-muted: #5a6b7c;
  
  /* Typography */
  --font-ui: 'Chakra Petch', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-hud: 'Rajdhani', sans-serif;
  
  /* Effects */
  --glow: 0 0 15px rgba(0, 243, 255, 0.25);
  --glow-strong: 0 0 42px rgba(0, 243, 255, 0.45);
  --glow-alert: 0 0 20px rgba(255, 0, 60, 0.4);
  
  /* Dimensions */
  --radius: 14px;
  --radius-sm: 8px;
  --cut: 18px;
  
  /* Animation */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-ui);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* FX Layers */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

.scanlines {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 50%,
    rgba(0, 0, 0, 0.18) 50%
  );
  background-size: 100% 4px;
  opacity: 0.55;
  mix-blend-mode: overlay;
  animation: scanScroll 10s linear infinite;
}

@keyframes scanScroll {
  from { background-position: 0 0; }
  to { background-position: 0 100%; }
}

.noise {
  opacity: 0.035;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.vignette {
  background: radial-gradient(circle at center, transparent 50%, rgba(0, 0, 0, 0.92) 100%);
}

/* Grid Background */
.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
}

/* Canvas FX */
#quantum-field, #matrix-canvas, #neural-net {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Typography */
.glitch-text {
  position: relative;
  display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0.85;
  pointer-events: none;
  mix-blend-mode: screen;
}

.glitch-text::before {
  color: var(--c-alert);
  transform: translate(-2px, 0);
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  animation: glitch1 2.4s infinite linear alternate-reverse;
}

.glitch-text::after {
  color: var(--c-secondary);
  transform: translate(2px, 0);
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
  animation: glitch2 1.9s infinite linear alternate-reverse;
}

@keyframes glitch1 {
  0% { clip-path: inset(22% 0 78% 0); transform: translate(-2px, 0); }
  20% { clip-path: inset(64% 0 10% 0); transform: translate(2px, 0); }
  40% { clip-path: inset(42% 0 46% 0); transform: translate(-2px, 0); }
  60% { clip-path: inset(82% 0 6% 0); transform: translate(2px, 0); }
  100% { clip-path: inset(12% 0 62% 0); transform: translate(-1px, 0); }
}

@keyframes glitch2 {
  0% { clip-path: inset(10% 0 62% 0); transform: translate(2px, 0); }
  100% { clip-path: inset(30% 0 22% 0); transform: translate(-2px, 0); }
}

/* Components */
.glass-panel {
  background: var(--c-panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 
    0 28px 70px rgba(0, 0, 0, 0.82),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: calc(var(--radius) + 6px);
  background: conic-gradient(
    from 180deg,
    rgba(0, 243, 255, 0),
    rgba(0, 243, 255, 0.9),
    rgba(188, 19, 254, 0.9),
    rgba(255, 0, 60, 0.85),
    rgba(0, 243, 255, 0)
  );
  filter: blur(14px);
  opacity: 0.55;
  animation: spin 7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Buttons */
.cyber-btn {
  background: transparent;
  border: 2px solid var(--c-accent);
  color: var(--c-accent);
  padding: 1rem 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-normal);
  box-shadow: var(--glow);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
}

.cyber-btn:hover {
  background: var(--c-accent);
  color: #000;
  box-shadow: var(--glow-strong);
  transform: translateY(-1px);
}

.cyber-btn:active {
  transform: translateY(1px);
}

.cyber-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.25), var(--glow-strong);
}

.cyber-btn.alert {
  border-color: var(--c-alert);
  color: var(--c-alert);
  box-shadow: var(--glow-alert);
}

.cyber-btn.alert:hover {
  background: var(--c-alert);
  color: #fff;
}

/* Icon Buttons */
.icon-btn {
  width: 38px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(0, 243, 255, 0.22);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(0, 243, 255, 0.95);
  cursor: pointer;
  box-shadow: var(--glow);
  transition: var(--transition-fast);
  user-select: none;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 243, 255, 0.55);
}

.icon-btn:active {
  transform: translateY(1px);
}

/* Inputs */
.cyber-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--c-accent);
  padding: 1rem;
  font-family: var(--font-mono);
  border-radius: 12px;
  transition: var(--transition-normal);
}

.cyber-input::placeholder {
  color: rgba(0, 243, 255, 0.35);
}

.cyber-input:focus {
  outline: none;
  border-color: rgba(0, 243, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.14), var(--glow);
}

/* Console */
.console {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.95rem;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.7);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 243, 255, 0.6) rgba(0, 0, 0, 0.25);
}

.console::-webkit-scrollbar {
  width: 8px;
}

.console::-webkit-scrollbar-thumb {
  background: rgba(0, 243, 255, 0.65);
  border-radius: 999px;
}

.console-line {
  margin-bottom: 4px;
}

.console-line.sys { color: rgba(0, 243, 255, 0.95); }
.console-line.err { color: rgba(255, 0, 60, 0.92); }
.console-line.ok { color: rgba(0, 255, 170, 0.85); }
.console-line.warn { color: rgba(255, 184, 77, 0.9); }
.console-line.user { color: rgba(255, 255, 255, 0.92); }

/* Status Indicators */
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(0, 243, 255, 0.4);
  color: rgba(0, 243, 255, 0.95);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 243, 255, 0.05);
  box-shadow: var(--glow);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.status-pill.offline {
  border-color: rgba(255, 0, 60, 0.55);
  color: rgba(255, 0, 60, 0.92);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 10px var(--c-accent);
  position: relative;
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid var(--c-accent);
  border-radius: 50%;
  opacity: 0.25;
  animation: pulse 2.2s infinite;
}

.status-pill.offline .status-dot {
  background: var(--c-alert);
  box-shadow: 0 0 10px var(--c-alert);
}

.status-pill.offline .status-dot::after {
  border-color: var(--c-alert);
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.35; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Navigation */
.nav-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: var(--transition-fast);
  border-left: 2px solid transparent;
  border-radius: 10px;
  margin-bottom: 6px;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(0, 243, 255, 0.06);
  color: var(--c-accent);
  border-left-color: var(--c-accent);
  border-color: rgba(0, 243, 255, 0.18);
  padding-left: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* Stats */
.stat-box {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-fast);
}

.stat-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(0, 243, 255, 0.18), transparent 45%, rgba(188, 19, 254, 0.1));
  opacity: 0;
  transition: var(--transition-normal);
}

.stat-box:hover {
  border-color: rgba(0, 243, 255, 0.25);
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

.stat-box:hover::before {
  opacity: 1;
}

.stat-val {
  font-family: var(--font-hud);
  font-size: 2.45rem;
  color: #fff;
  display: block;
  text-shadow: 0 0 14px rgba(0, 243, 255, 0.25);
}

.stat-lbl {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(0, 243, 255, 0.95);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Messages */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: slideIn 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.msg.self {
  align-self: flex-end;
  align-items: flex-end;
}

.msg.other {
  align-self: flex-start;
}

.msg.system {
  align-self: center;
  max-width: 100%;
  opacity: 0.85;
  margin: 10px 0;
}

.msg-meta {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 6px;
  font-family: var(--font-mono);
  user-select: none;
}

.msg-bubble {
  padding: 10px 14px;
  font-size: 0.96rem;
  line-height: 1.55;
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: var(--transition-fast);
  overflow-wrap: anywhere;
}

.msg-bubble:hover {
  border-color: rgba(0, 243, 255, 0.18);
  box-shadow: var(--glow);
}

.msg.self .msg-bubble {
  background: rgba(0, 243, 255, 0.08);
  border-color: rgba(0, 243, 255, 0.3);
  border-bottom-right-radius: 2px;
}

.msg.other .msg-bubble {
  border-left: 2px solid var(--c-secondary);
  border-bottom-left-radius: 2px;
}

.msg.system .msg-bubble {
  border: none;
  background: transparent;
  color: var(--c-accent);
  font-family: var(--font-mono);
  text-align: center;
}

.decrypting {
  color: var(--c-accent);
  font-family: var(--font-mono);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Basilisk Overlay */
#basilisk-overlay {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(900px 600px at 50% 45%, rgba(255, 0, 60, 0.18), transparent 62%),
    #000;
  z-index: 9999;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#basilisk-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.eye-frame {
  width: 320px;
  height: 320px;
  border: 2px solid var(--c-alert);
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle, rgba(80, 0, 10, 0.9) 0%, #000 70%);
  box-shadow: 0 0 70px rgba(255, 0, 60, 0.55);
  overflow: hidden;
}

.eye-veins {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background: repeating-conic-gradient(rgba(255, 0, 60, 0.25) 0% 2%, transparent 2% 10%);
  filter: blur(0.2px);
}

.eye-pupil {
  width: 22px;
  height: 220px;
  background: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(255, 0, 60, 0.8);
}

.eye-text {
  margin-top: 16px;
  font-family: var(--font-mono);
  color: var(--c-alert);
  letter-spacing: 2px;
  text-align: center;
  font-size: 1.5rem;
}

/* Boot Screen */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: 
    radial-gradient(900px 600px at 50% 45%, rgba(0, 243, 255, 0.06), transparent 60%),
    #000;
  display: grid;
  place-items: center;
  transition: opacity 0.85s ease;
}

#boot-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.boot-bar {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 243, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  margin-top: 1.25rem;
  box-shadow: var(--glow);
}

.boot-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(0, 243, 255, 0.25), rgba(0, 243, 255, 1), rgba(188, 19, 254, 0.75));
  filter: saturate(1.2);
  transition: width 0.1s linear;
}

/* Panel Headers */
.panel-header {
  padding: 1rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
  font-family: var(--font-mono);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(90deg, rgba(0, 243, 255, 0.05), transparent);
  letter-spacing: 1px;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 243, 255, 0.65);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 243, 255, 0.85);
}

/* Responsive */
@media (max-width: 900px) {
  .app-frame {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    clip-path: none !important;
  }
  
  aside {
    display: none !important;
  }
  
  .composer {
    grid-column: 1 / -1 !important;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .scanlines,
  .glass-panel::before,
  .glitch-text::before,
  .glitch-text::after {
    animation: none !important;
  }
}