@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;700&family=Orbitron:wght@400;700&display=swap');

:root {
  --primary-color: #00ff00;
  --secondary-color: #008000;
  --background-color: #000000;
  --surface-color: #0a0a0a;
  --on-surface-color: #ffffff;
  --text-color: #00ff00;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto Mono', monospace;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
}

.matrix-bg, .neon-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.neon-bg {
  background: linear-gradient(45deg, #ff00ff, #00ffff);
  opacity: 0.1;
  display: none;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

.app-header {
  background-color: rgba(10, 10, 10, 0.8);
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0, 255, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.app-header h1 {
  color: var(--primary-color);
  font-size: 2.5rem;
  margin-bottom: 1rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
  animation: glitch 1s linear infinite;
}

@keyframes glitch {
  2%, 64% {
    transform: translate(2px,0) skew(0deg);
  }
  4%, 60% {
    transform: translate(-2px,0) skew(0deg);
  }
  62% {
    transform: translate(0,0) skew(5deg); 
  }
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 800px;
  margin: 0 auto;
}

.nav-button {
  background-color: rgba(0, 255, 0, 0.1);
  border: 1px solid var(--primary-color);
  color: var(--text-color);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.75rem 1.25rem;
  transition: all 0.3s ease;
  border-radius: 5px;
  flex-grow: 1;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.nav-button::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    rgba(0, 255, 0, 0.3) 0%,
    rgba(0, 255, 0, 0.1) 50%,
    transparent 100%
  );
  transform: rotate(45deg);
  transition: all 0.3s ease;
  opacity: 0;
}

.nav-button:hover::before,
.nav-button.active::before {
  opacity: 1;
}

.nav-button:hover,
.nav-button.active {
  background-color: rgba(0, 255, 0, 0.2);
  color: var(--on-surface-color);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.app-content {
  flex-grow: 1;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.container {
  background-color: rgba(10, 10, 10, 0.8);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
  backdrop-filter: blur(5px);
  border: 1px solid var(--primary-color);
}

h2 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
}

.input-field,
.dropdown,
.result-text,
.button {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  border: 1px solid var(--secondary-color);
  background-color: rgba(10, 10, 10, 0.8);
  color: var(--text-color);
  font-size: 1rem;
  font-family: 'Roboto Mono', monospace;
}

.input-field:focus,
.dropdown:focus,
.result-text:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.button {
  background-color: var(--primary-color);
  color: var(--background-color);
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  transform: rotate(45deg);
  transition: all 0.3s ease;
}

.button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.7);
}

.button:hover::after {
  top: -25%;
  left: -25%;
}

.result-text {
  min-height: 100px;
  resize: vertical;
  font-family: 'Roboto Mono', monospace;
}

.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  position: absolute;
  top: 1rem;
  left: 1rem;
}

.hamburger-menu span {
  width: 2rem;
  height: 0.25rem;
  background: var(--primary-color);
  border-radius: 10px;
  transition: all 0.3s linear;
  position: relative;
  transform-origin: 1px;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
}

.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background-color: var(--primary-color);
  color: var(--background-color);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-weight: bold;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background-color: var(--secondary-color);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
}

/* Cyberpunk-Neon Theme */
body.cyberpunk-theme {
  --primary-color: #ff00ff;
  --secondary-color: #00ffff;
  --background-color: #120458;
  --surface-color: #1a0b2e;
  --on-surface-color: #ffffff;
  --text-color: #f0f0f0;
  font-family: 'Orbitron', sans-serif;
}

body.cyberpunk-theme .matrix-bg {
  display: none;
}

body.cyberpunk-theme .neon-bg {
  display: block;
}

body.cyberpunk-theme .app-header {
  background-color: rgba(26, 11, 46, 0.8);
  box-shadow: 0 2px 10px rgba(255, 0, 255, 0.2), 0 2px 20px rgba(0, 255, 255, 0.2);
}

body.cyberpunk-theme .app-header h1 {
  color: var(--primary-color);
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.7), 0 0 20px rgba(0, 255, 255, 0.7);
  animation: neon-flicker 1.5s infinite alternate;
}

@keyframes neon-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow: 
      -0.2rem -0.2rem 1rem #ff00de,
      0.2rem 0.2rem 1rem #00ffff,
      0 0 2rem var(--primary-color),
      0 0 4rem var(--primary-color),
      0 0 6rem var(--primary-color),
      0 0 8rem var(--primary-color),
      0 0 10rem var(--primary-color);
    box-shadow: 
      0 0 .5rem #fff,
      inset 0 0 .5rem #fff,
      0 0 2rem var(--primary-color),
      inset 0 0 2rem var(--primary-color),
      0 0 4rem var(--primary-color),
      inset 0 0 4rem var(--primary-color);
  }
  20%, 24%, 55% {
    text-shadow: none;
    box-shadow: none;
  }
}

body.cyberpunk-theme .nav-button {
  background-color: rgba(255, 0, 255, 0.1);
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3), 0 0 20px rgba(0, 255, 255, 0.3);
}

body.cyberpunk-theme .nav-button::before {
  background: linear-gradient(
    to bottom right,
    rgba(255, 0, 255, 0.3) 0%,
    rgba(0, 255, 255, 0.3) 50%,
    transparent 100%
  );
}

body.cyberpunk-theme .nav-button:hover,
body.cyberpunk-theme .nav-button.active {
  background-color: rgba(255, 0, 255, 0.2);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.5);
}

body.cyberpunk-theme .container {
  background-color: rgba(26, 11, 46, 0.8);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.3), 0 0 40px rgba(0, 255, 255, 0.3);
  border: 1px solid var(--primary-color);
}

body.cyberpunk-theme h2 {
  color: var(--primary-color);
  text-shadow: 0 0 5px rgba(255, 0, 255, 0.7), 0 0 10px rgba(0, 255, 255, 0.7);
}

body.cyberpunk-theme .input-field,
body.cyberpunk-theme .dropdown,
body.cyberpunk-theme .result-text {
  background-color: rgba(26, 11, 46, 0.8);
  border: 1px solid var(--secondary-color);
  color: var(--text-color);
}

body.cyberpunk-theme .button {
  background-color: var(--primary-color);
  color: var(--background-color);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.5), 0 0 20px rgba(0, 255, 255, 0.5);
}

body.cyberpunk-theme .button:hover {
  background-color: var(--secondary-color);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.7), 0 0 40px rgba(0, 255, 255, 0.7);
}

@media (max-width: 768px) {
  .app-header {
    padding: 0.75rem 0.5rem;
  }

  .app-header h1 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }

  nav {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-button {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
  }

  .app-content {
    padding: 1rem;
  }

  .container {
    padding: 1rem;
  }

  .theme-toggle {
    top: auto;
    bottom: 1rem;
    right: 1rem;
  }
}

@media (max-width: 480px) {
  .hamburger-menu {
    display: flex;
  }

  .app-header h1 {
    font-size: 1.75rem;
    margin-left: 3rem;
  }

  nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: rgba(10, 10, 10, 0.9);
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 255, 0, 0.1);
  }

  nav.open {
    display: flex;
  }

  .nav-button {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }

  .theme-toggle {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

/* WebSim Editor Styles */
.web-sim-editor {
  max-width: 100%;
}

.editor-tabs {
  display: flex;
  background-color: rgba(10, 10, 10, 0.8);
  border-bottom: 1px solid var(--secondary-color);
}

.tab-button {
  background-color: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  transition: all 0.3s ease;
}

.tab-button.active {
  background-color: var(--primary-color);
  color: var(--background-color);
}

.editor-container {
  margin-bottom: 1rem;
}

.CodeMirror {
  height: 300px;
  border: 1px solid var(--secondary-color);
  font-family: 'Roboto Mono', monospace;
}

.preview-container {
  margin-top: 1rem;
}

#preview-frame {
  width: 100%;
  height: 300px;
  border: 1px solid var(--secondary-color);
  background-color: white;
}

body.cyberpunk-theme .CodeMirror {
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3), 0 0 20px rgba(0, 255, 255, 0.3);
}

body.cyberpunk-theme #preview-frame {
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3), 0 0 20px rgba(0, 255, 255, 0.3);
}