/* ==========================================================================
   CipherVision: The Image Hacker - Main Global Stylesheet
   Global variables, theme tokens, resets, typography & CRT visual FX
   ========================================================================== */

:root {
  /* Default Cyber Cyan Theme */
  --bg-primary: #080b10;
  --bg-secondary: #0d121a;
  --bg-panel: rgba(14, 20, 30, 0.88);
  --bg-card: #121924;
  --bg-input: #0a0e16;
  
  --accent-cyan: #00f0ff;
  --accent-green: #00ff7f;
  --accent-amber: #ffb800;
  --accent-red: #ff3344;
  --accent-blue: #2a68ff;
  --accent-primary: #00f0ff;
  
  --text-main: #dce4ef;
  --text-dim: #70849e;
  --text-highlight: #ffffff;
  
  --border-cyan: rgba(0, 240, 255, 0.25);
  --border-glow: 0 0 12px rgba(0, 240, 255, 0.25);
  --panel-shadow: 0 8px 32px rgba(0, 0, 0, 0.75);
  
  --font-mono: 'Fira Code', 'Courier New', monospace;
  --font-title: 'Orbitron', -apple-system, sans-serif;
  --font-body: 'Rajdhani', -apple-system, sans-serif;
}

/* Theme Variant: Matrix Green */
body.theme-matrix {
  --bg-primary: #030a04;
  --bg-secondary: #061408;
  --bg-panel: rgba(8, 24, 12, 0.9);
  --bg-card: #0c2010;
  --accent-cyan: #00ff7f;
  --accent-green: #39ff14;
  --accent-primary: #39ff14;
  --border-cyan: rgba(0, 255, 127, 0.25);
  --border-glow: 0 0 12px rgba(57, 255, 20, 0.3);
}

/* Theme Variant: Amber CRT */
body.theme-amber {
  --bg-primary: #0d0902;
  --bg-secondary: #181104;
  --bg-panel: rgba(24, 17, 6, 0.92);
  --bg-card: #201708;
  --accent-cyan: #ffb800;
  --accent-green: #ffa000;
  --accent-amber: #ffcc00;
  --accent-primary: #ffb800;
  --border-cyan: rgba(255, 184, 0, 0.28);
  --border-glow: 0 0 12px rgba(255, 184, 0, 0.3);
}

/* Theme Variant: Neon Synthwave */
body.theme-synthwave {
  --bg-primary: #0a0414;
  --bg-secondary: #140824;
  --bg-panel: rgba(26, 12, 44, 0.9);
  --bg-card: #221038;
  --accent-cyan: #ff007f;
  --accent-green: #00f0ff;
  --accent-amber: #ffe600;
  --accent-primary: #ff007f;
  --border-cyan: rgba(255, 0, 127, 0.3);
  --border-glow: 0 0 14px rgba(255, 0, 127, 0.35);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: all 0.2s ease;
}
a:hover {
  text-shadow: 0 0 8px var(--accent-cyan);
}

/* Global Cyber Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(10, 15, 22, 0.85);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.35);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   CRT Scanline & Post-Processing Visual FX
   -------------------------------------------------------------------------- */
.cyber-scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 3px, 6px 100%;
  opacity: 0.8;
}

.vignette-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.85);
}

body:not(.crt-enabled) .cyber-scanlines,
body:not(.crt-enabled) .vignette-layer {
  display: none;
}

/* --------------------------------------------------------------------------
   Interactive Cyber Background Grid
   -------------------------------------------------------------------------- */
.cyber-grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  transform: rotateX(60deg) translateY(-20%);
  animation: grid-scroll 25s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes grid-scroll {
  0% { transform: rotateX(60deg) translateY(0); }
  100% { transform: rotateX(60deg) translateY(50px); }
}

/* Master Layout Shells */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 50%, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.page-container {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 32px;
  max-width: 1300px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Top System Navigation Header
   -------------------------------------------------------------------------- */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  min-height: 56px;
  box-sizing: border-box;
  background: rgba(10, 15, 22, 0.95);
  border-bottom: 1px solid var(--border-cyan);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  z-index: 100;
  backdrop-filter: blur(10px);
  gap: 16px;
  flex-wrap: nowrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.cyber-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.logo-link:hover .cyber-logo-icon {
  transform: rotate(20deg) scale(1.1);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.8), 0 0 20px rgba(255, 170, 0, 0.5);
  border-color: var(--accent-amber);
}

.hero-logo-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
}

.hero-logo-img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 2px solid var(--border-cyan);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.5), 0 0 60px rgba(0, 240, 255, 0.2);
  object-fit: cover;
  animation: logo-glow-pulse 4s infinite ease-in-out;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hero-logo-img:hover {
  transform: scale(1.08) rotate(6deg);
  box-shadow: 0 0 45px rgba(0, 240, 255, 0.8), 0 0 75px rgba(255, 170, 0, 0.5);
  border-color: var(--accent-amber);
}

.splash-emblem {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.6), 0 0 60px rgba(255, 170, 0, 0.3);
  margin-bottom: 14px;
  object-fit: cover;
  animation: logo-rotate-float 5s infinite ease-in-out;
}

@keyframes logo-glow-pulse {
  0%, 100% {
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.45), 0 0 50px rgba(0, 240, 255, 0.2);
    border-color: var(--accent-cyan);
  }
  50% {
    box-shadow: 0 0 35px rgba(255, 170, 0, 0.6), 0 0 70px rgba(0, 240, 255, 0.4);
    border-color: var(--accent-amber);
  }
}

@keyframes logo-rotate-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.04); }
}

.status-indicator.online {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse-dot 2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1.0; transform: scale(1.1); }
}

.logo-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  letter-spacing: 2px;
  color: var(--text-highlight);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
  white-space: nowrap;
}

.version-tag {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  vertical-align: super;
  font-weight: 700;
}

.sub-brand {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  white-space: nowrap;
}

.header-readouts {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  white-space: nowrap;
}

.readout-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.2;
}

.readout-label {
  font-size: 0.62rem;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  font-weight: 700;
  white-space: nowrap;
}

.readout-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.readout-val.highlight {
  color: var(--accent-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.alert-text {
  color: var(--accent-red) !important;
}

.alert-pulse {
  color: var(--accent-red) !important;
  text-shadow: 0 0 10px var(--accent-red);
  animation: pulse-dot 1s infinite alternate;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-controls .util-btn {
  white-space: nowrap;
  padding: 4px 10px;
  font-size: 0.72rem;
  flex-shrink: 0;
}

/* Cyber Navigation Bar */
.cyber-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  max-width: 600px;
  min-width: 0;
  flex-wrap: nowrap;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 7px;
  border-radius: 4px;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-cyan);
  border-color: var(--border-cyan);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

@media (max-width: 1400px) {
  .sub-brand {
    display: none !important;
  }
}

@media (max-width: 1200px) {
  .nav-link {
    padding: 3px 5px;
    font-size: 0.68rem;
  }
  .cyber-nav {
    gap: 2px;
  }
  .header-readouts {
    gap: 6px;
  }
}

/* Animations */
@keyframes cyber-glitch {
  0%, 94%, 100% {
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.8), 0 0 40px rgba(0, 240, 255, 0.4);
    transform: none;
  }
  95% {
    text-shadow: -2px 0 red, 2px 0 blue;
    transform: translate(-2px, 1px);
  }
  96% {
    text-shadow: 2px 0 red, -2px 0 cyan;
    transform: translate(2px, -1px);
  }
  97% {
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.8);
    transform: none;
  }
}

@keyframes shine-sweep {
  0% { left: -100%; }
  30%, 100% { left: 200%; }
}
