/**
 * error.css
 * Styles for error pages with retro terminal aesthetics
 * Supports both Bitcoin and DeepSea themes
 */

/* ----- ROOT VARIABLES ----- */
:root {
  --bg-color: #0a0a0a;
  --bg-gradient: linear-gradient(135deg, #0a0a0a, #1a1a1a);
  --primary-color: #f7931a;
  --primary-color-rgb: 247, 147, 26;
  --text-color: white;
  --error-text: #ff5555;
  --code-text: #00dfff;
  --terminal-font: "VT323", monospace;
  --header-font: "Orbitron", sans-serif;
}

/* DeepSea theme variables - applied to html element */
html.deepsea-theme {
  --primary-color: #0088cc;
  --primary-color-rgb: 0, 136, 204;
  --bg-gradient: linear-gradient(135deg, #0a0a0a, #0d1a20);
  --code-text: #39ff14;
  --error-text: #ff7777;
}

/* ----- BASE STYLES ----- */
body {
  background: var(--bg-gradient);
  color: var(--text-color);
  padding-top: 50px;
  font-family: var(--terminal-font);
  margin: 0;
  min-height: 100vh;
}

/* CRT Screen Effect */
body::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
    linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.03),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.03)
    );
  background-size:
    100% 2px,
    3px 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.15;
}

/* DeepSea underwater effects */
html.deepsea-theme body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: transparent;
  opacity: 0.1;
  z-index: 10;
  animation: oceanRipple 8s infinite linear;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(var(--primary-color-rgb), 0.1),
    rgba(var(--primary-color-rgb), 0.1) 1px,
    transparent 1px,
    transparent 6px
  );
  background-size: 100% 6px;
}

html.deepsea-theme body::before {
  opacity: 0.15;
  background-image:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 73, 109, 0.1) 50%),
    linear-gradient(
      90deg,
      rgba(0, 81, 122, 0.03),
      rgba(0, 136, 204, 0.08),
      rgba(0, 191, 255, 0.03)
    );
  animation: glitchEffect 2s infinite;
}

/* ----- ERROR CONTAINER ----- */
.error-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem;
  border: 1px solid var(--primary-color);
  border-radius: 0;
  background-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.3);
  position: relative;
  overflow: hidden;
  animation: flicker 4s infinite;
}

/* Scanline effect for error container */
.error-container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1),
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1;
}

/* ----- TYPOGRAPHY ----- */
h1 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-family: var(--header-font);
  font-weight: bold;
  position: relative;
  z-index: 2;
  letter-spacing: 2px;
  text-shadow: 0 0 5px rgba(var(--primary-color-rgb), 0.5);
}

p {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  position: relative;
  z-index: 2;
  color: var(--error-text);
}

/* Error code styling */
.error-code {
  font-family: var(--terminal-font);
  font-size: 1.2rem;
  color: var(--code-text);
  margin-bottom: 1rem;
  position: relative;
  z-index: 2;
  letter-spacing: 1px;
}

/* ----- INTERACTIVE ELEMENTS ----- */
a.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: black;
  margin-top: 20px;
  font-family: var(--header-font);
  text-shadow: none;
  box-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.5);
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 1px;
}

a.btn-primary:hover {
  background-color: #ffa64d; /* Default hover for Bitcoin theme */
  box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.7);
  transform: translateY(-2px);
}

html.deepsea-theme a.btn-primary:hover {
  background-color: #00b3ff; /* DeepSea theme hover */
}

a.btn-primary:active {
  transform: translateY(0);
}

/* Terminal cursor */
.terminal-cursor {
  display: inline-block;
  width: 10px;
  height: 20px;
  background-color: var(--primary-color);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  box-shadow: 0 0 5px rgba(var(--primary-color-rgb), 0.8);
}

/* ----- ANIMATIONS ----- */
@keyframes flicker {
  0% {
    opacity: 0.97;
  }

  5% {
    opacity: 0.95;
  }

  10% {
    opacity: 0.97;
  }

  15% {
    opacity: 0.94;
  }

  20% {
    opacity: 0.98;
  }

  50% {
    opacity: 0.95;
  }

  80% {
    opacity: 0.96;
  }

  90% {
    opacity: 0.94;
  }

  100% {
    opacity: 0.98;
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

@keyframes oceanRipple {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(6px);
  }
}

@keyframes glitchEffect {
  0% {
    opacity: 0.15;
    background-position: 0 0;
  }

  20% {
    opacity: 0.17;
  }

  40% {
    opacity: 0.14;
    background-position: -1px 0;
  }

  60% {
    opacity: 0.15;
    background-position: 1px 0;
  }

  80% {
    opacity: 0.16;
    background-position: -2px 0;
  }

  100% {
    opacity: 0.15;
    background-position: 0 0;
  }
}

/* Deep Sea underwater light rays */
html.deepsea-theme .underwater-rays {
  position: fixed;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  width: 200%;
  height: 200%;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  z-index: -1;
  background-image:
    radial-gradient(
      ellipse at top,
      rgba(var(--primary-color-rgb), 0.1) 0%,
      rgba(var(--primary-color-rgb), 0) 70%
    ),
    radial-gradient(
      ellipse at bottom,
      rgba(0, 91, 138, 0.15) 0%,
      rgba(0, 0, 0, 0) 70%
    );
  animation: lightRays 15s ease infinite alternate;
}

@keyframes lightRays {
  0% {
    transform: scale(1) skew(0deg);
    opacity: 0.3;
  }

  50% {
    transform: scale(1.05) skew(2deg);
    opacity: 0.4;
  }

  100% {
    transform: scale(1.1) skew(0deg);
    opacity: 0.3;
  }
}

/* ----- RESPONSIVE STYLES ----- */
@media (max-width: 767px) {
  .error-container {
    max-width: 90%;
    padding: 1.5rem;
    margin-top: 10px;
  }

  h1 {
    font-size: 24px;
  }

  p {
    font-size: 1.2rem;
  }

  .terminal-cursor {
    height: 16px;
  }

  body {
    padding-top: 30px;
  }
}

@media (max-width: 480px) {
  .error-container {
    padding: 1rem;
  }

  h1 {
    font-size: 20px;
  }

  p {
    font-size: 1rem;
  }

  .error-code {
    font-size: 1rem;
  }

  a.btn-primary {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }
}

/* Landscape orientation adjustments for short screens */
@media (orientation: landscape) and (max-height: 500px) {
  .error-container {
    margin-top: 5px;
  }
  body {
    padding-top: 20px;
  }
}
