/**
 * Xenon Engine - Shared Styles
 * Content Security Policy Compliant - No inline styles required
 */

/* === CORE VARIABLES === */
:root {
  --void-bg: #030712;
  --panel-bg: rgba(11, 20, 39, 0.7);
  --panel-bg-solid: rgba(11, 20, 39, 0.85);
  --cyan-dim: rgba(6, 182, 212, 0.15);
  --cyan-mid: rgba(6, 182, 212, 0.4);
  --cyan-bright: #06b6d4;
  --border-color: rgba(6, 182, 212, 0.15);
}

/* === BASE BODY STYLES === */
body {
  background-color: var(--void-bg);
  color: #94a3b8;
  font-family: var(--font-sans);
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
  height: 100vh;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, .tech-header {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: white;
}

.data-font {
  font-family: var(--font-mono);
}

/* === GRID BACKGROUND EFFECT === */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: -1;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, #030712 90%);
  z-index: -1;
  pointer-events: none;
}

/* === ANIMATIONS === */
@keyframes breathe-border {
  0%, 100% {
    border-color: var(--cyan-dim);
    box-shadow: 0 0 0 transparent;
  }
  50% {
    border-color: var(--cyan-mid);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.05);
  }
}

@keyframes breathe-corner {
  0%, 100% {
    border-color: var(--cyan-bright);
    opacity: 0.3;
  }
  50% {
    border-color: #22d3ee;
    opacity: 1;
    box-shadow: 0 0 5px #22d3ee;
  }
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* === TECH PANELS === */
.tech-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  position: relative;
  animation: breathe-border 4s infinite ease-in-out;
}

.tech-panel-static {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  position: relative;
}

.tech-panel-animated {
  animation: breathe-border 4s infinite ease-in-out;
}

/* Corner Brackets */
.tech-panel::before,
.tech-panel::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  transition: all 0.3s ease;
  border-color: var(--cyan-bright);
  animation: breathe-corner 4s infinite ease-in-out;
}

.tech-panel::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.tech-panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid;
  border-right: 1px solid;
}

/* === BUTTONS === */
.btn-cyber {
  position: relative;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #22d3ee;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: all 0.2s;
  overflow: hidden;
}

.btn-cyber:hover:not(:disabled) {
  background: rgba(6, 182, 212, 0.2);
  border-color: #22d3ee;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
  color: white;
}

.btn-cyber:active {
  transform: scale(0.98);
}

.btn-cyber:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-action {
  width: 100%;
  padding: 12px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid var(--cyan-mid);
  color: var(--cyan-bright);
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.btn-action:hover {
  background: var(--cyan-bright);
  color: #000;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}

.btn-danger {
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.btn-danger:hover {
  background: #ef4444;
  color: white;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* === FORM ELEMENTS === */
.tech-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px;
  width: 100%;
  transition: all 0.3s;
}

.tech-input:focus {
  border-color: var(--cyan-bright);
  outline: none;
  background: rgba(6, 182, 212, 0.05);
}

.tech-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--cyan-bright);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  display: block;
  opacity: 0.8;
}

.checkbox-cyber {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.05);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.checkbox-cyber:checked {
  background: rgba(6, 182, 212, 0.2);
  border-color: #22d3ee;
}

.checkbox-cyber:checked::after {
  content: '\2713';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #22d3ee;
  font-size: 14px;
  font-weight: bold;
}

/* === NAVIGATION DECK === */
#command-deck {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(3, 7, 18, 0.95);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}

#command-deck.hidden {
  display: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 2px;
  color: #475569;
  transition: all 0.3s;
  border-top: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  margin-bottom: 3px;
}

.nav-item span {
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-family: var(--font-mono);
}

.nav-item:hover {
  color: #94a3b8;
}

.nav-item.active {
  color: #22d3ee;
  border-top: 2px solid #22d3ee;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.05) 0%, transparent 100%);
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

.nav-item.active svg {
  filter: drop-shadow(0 0 5px rgba(34,211,238,0.5));
}

/* === AVATAR FRAME === */
.avatar-frame {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
  border-radius: 50%;
  border: 2px solid var(--cyan-dim);
  padding: 4px;
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(100%) sepia(20%) hue-rotate(170deg);
}

.avatar-frame::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border-top: 2px solid var(--cyan-bright);
  border-bottom: 2px solid var(--cyan-bright);
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  animation: spin 10s linear infinite;
}

.avatar-frame-small {
  width: 70px;
  height: 70px;
}

/* === INFO BOX === */
.info-box {
  background: rgba(6, 182, 212, 0.05);
  border-left: 2px solid var(--cyan-bright);
  padding: 12px;
  margin-bottom: 20px;
}

/* === BADGE SLOTS === */
.badge-slot {
  background: rgba(0,0,0,0.3);
  border: 1px dashed rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  transition: all 0.3s ease;
}

.badge-slot:hover {
  border-color: rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.05);
}

/* === STAT ROWS (Fingerprint page) === */
.stat-row {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: #94a3b8;
  margin-bottom: 6px;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.stat-label {
  font-weight: 700;
  color: #e2e8f0;
  text-transform: uppercase;
  font-size: 10px;
}

.stat-val {
  color: var(--cyan-bright);
  font-weight: bold;
}

.stat-track {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  height: 4px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  background: var(--cyan-bright);
}

/* === UTILITY CLASSES === */
.hidden {
  display: none !important;
}

.text-error {
  color: #ef4444;
}

.text-success {
  color: #10b981;
}

.border-error {
  border-color: #ef4444 !important;
}

.border-success {
  border-color: #10b981 !important;
}

/* === BADGE GALLERY === */
.badge-cell {
  width: 100%;
  max-width: 80px;
  aspect-ratio: 1;
}

.badge-cell svg,
.badge-cell .badge-svg {
  width: 100%;
  height: 100%;
  max-width: 80px;
  max-height: 80px;
}

/* Super badge cells in grid */
.super-badge-cell {
  width: 100%;
  max-width: 100px;
  aspect-ratio: 1;
}

/* Container for stacked badge composite view (grid thumbnail) */
.super-badge-stack-container {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  background: #0f172a;
  border: 1px solid #334155;
  overflow: hidden;
}

/* Each badge layer in the composite stack */
.super-badge-stack-layer {
  position: absolute;
  inset: 0;
}

.super-badge-stack-layer svg {
  width: 100%;
  height: 100%;
}

/* Stacked badge container - layers on top of each other (modal viewer) */
.badge-stack-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.badge-stack-layer svg {
  width: 100%;
  height: 100%;
}

/* Super badge stack viewer - side angle view */
.stack-viewer {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

/* The angled stack view showing all layers */
.stack-side-view {
  position: relative;
  width: 200px;
  height: 300px;
  perspective: 800px;
}

.stack-layer {
  position: absolute;
  width: 60px;
  height: 60px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-style: preserve-3d;
}

.stack-layer:hover {
  transform: translateX(10px) !important;
  opacity: 1 !important;
}

.stack-layer.selected {
  transform: translateX(20px) !important;
  opacity: 1 !important;
  z-index: 200 !important;
}

.stack-layer svg {
  width: 100%;
  height: 100%;
}

/* Right panel containing front view and controls */
.stack-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* The front-facing selected badge view */
.stack-front-view {
  width: 200px;
  height: 200px;
  background: #0f172a;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stack-front-view svg {
  width: 100%;
  height: 100%;
}

/* Responsive adjustments for stack viewer */
@media (max-width: 640px) {
  .stack-viewer {
    flex-direction: column;
    gap: 1.5rem;
  }

  .stack-side-view {
    width: 100%;
    height: 250px;
  }

  .stack-front-view {
    width: 150px;
    height: 150px;
  }
}

/* === PANEL TOGGLE BUTTONS === */
.panel-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.panel-toggle-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: #64748b;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-toggle-btn:hover {
  border-color: var(--cyan-mid);
  color: #94a3b8;
}

.panel-toggle-btn.active {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #a855f7;
}

/* Color variants for different panels */
.panel-toggle-btn[data-panel="quests"].active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #f59e0b;
}

.panel-toggle-btn[data-panel="logs"].active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan-bright);
  color: var(--cyan-bright);
}

/* Logout button in toggle row */
.panel-toggle-btn.logout-btn {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  padding: 10px 20px;
  font-size: 11px;
}

.panel-toggle-btn.logout-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

/* === FLOATING PANEL SYSTEM === */
.floating-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.floating-panel-backdrop.visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.floating-panel {
  background: var(--panel-bg-solid);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s ease;
}

.floating-panel-backdrop.visible .floating-panel {
  transform: scale(1) translateY(0);
}

.floating-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.floating-panel-header h3 {
  font-size: 12px;
  color: #a855f7;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}

/* Panel header color variants */
.floating-panel-amber .floating-panel-header h3 {
  color: #f59e0b;
}

.floating-panel-cyan .floating-panel-header h3 {
  color: var(--cyan-bright);
}

.floating-panel-purple .floating-panel-header h3 {
  color: #a855f7;
}

.panel-close {
  background: none;
  border: none;
  color: #475569;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.panel-close:hover {
  color: #ef4444;
}

.floating-panel-content {
  padding: 16px;
  max-height: calc(80vh - 60px);
  overflow-y: auto;
}

/* Fullscreen variant for DNA panel */
.floating-panel-fullscreen {
  width: 95%;
  max-width: 900px;
  max-height: 90vh;
}

.floating-panel-fullscreen .floating-panel-content {
  max-height: calc(90vh - 60px);
  padding: 0;
}

/* DNA canvas container */
.dna-canvas-container {
  position: relative;
  width: 100%;
  height: 500px;
  background: #030712;
  overflow: hidden;
}

.dna-canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* DNA Tooltip */
.dna-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(var(--tip-x, 0), var(--tip-y, 0));
  background: rgba(3, 7, 18, 0.95);
  border: 1px solid var(--cyan-mid);
  padding: 16px;
  width: 280px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  color: #cbd5e1;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.dna-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
}

/* DNA button active state */
.panel-toggle-btn[data-panel="dna"].active,
.panel-toggle-btn[data-panel="attributes"].active,
.panel-toggle-btn[data-panel="resonance"].active,
.panel-toggle-btn[data-panel="gallery"].active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan-bright);
  color: var(--cyan-bright);
}

/* === GALLERY PANEL === */
.gallery-container {
  padding: 16px;
  max-height: calc(90vh - 60px);
  overflow-y: auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 16px;
}

.super-badge-cell {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.super-badge-cell:hover {
  transform: scale(1.05);
}

.super-badge-stack-container {
  width: 100%;
  aspect-ratio: 1;
}

/* === STACK VIEWER MODAL === */
.stack-viewer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.stack-viewer-backdrop.visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 640px) {
  .dna-canvas-container {
    height: 400px;
  }

  .floating-panel-fullscreen {
    width: 100%;
    max-height: 95vh;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
  }
}

/* === BADGES PANEL === */
.panel-toggle-btn[data-panel="badges"].active {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #a855f7;
}

.badge-slot {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: all 0.2s ease;
}

.badge-slot:hover {
  border-color: rgba(168, 85, 247, 0.5);
  background: rgba(168, 85, 247, 0.1);
}

/* === PROFILE PANEL === */
.panel-toggle-btn[data-panel="profile"].active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan-bright);
  color: var(--cyan-bright);
}

/* === VINZRIK QR CODE SPINNER === */
.vinzrik-qr-spinner {
  position: absolute;
  inset: -8px;
  border: 2px solid transparent;
  border-top-color: var(--cyan-bright);
  border-radius: 8px;
  animation: qr-spin 1.5s linear infinite;
  z-index: 5;
}

.vinzrik-qr-spinner::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid transparent;
  border-right-color: rgba(6, 182, 212, 0.3);
  border-radius: 6px;
  animation: qr-spin 2s linear reverse infinite;
}

@keyframes qr-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Vinzrik status pulse */
#vinzrik-qr-status {
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}
