/* Retropixel Glassmorphic Theme for AlgoTrail */

/* Root variables for consistent theming */
:root {
  --primary-bg: #f5f1eb;
  --secondary-bg: linear-gradient(135deg, #ff6f61 0%, #ff8a65 50%, #ffb74d 100%);
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(0, 0, 0, 0.1);
  --text-primary: #212121;
  --text-secondary: #424242;
  --accent-color: #e65100;
  --neon-glow: 0 0 20px rgba(230, 81, 0, 0.3);
  --retro-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Body and main background */
body {
  background: var(--primary-bg);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Lato', Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

/* Add retro grid pattern overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: -999;
}

/* Glassmorphic navbar */
.navbar {
  background: var(--secondary-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--retro-shadow);
  border-radius: 15px;
  margin: 10px;
  z-index: 1000;
  position: relative;
}

.navbar-brand {
  color: var(--text-primary) !important;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.navbar-brand:hover {
  color: var(--accent-color) !important;
  text-shadow: var(--neon-glow);
}

/* Logo styling */
.logo-img {
  height: 30px;
  width: 30px;
  margin-right: 10px;
  filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.5));
}

.logo-text {
  font-size: 24px;
  font-weight: bold;
  background: linear-gradient(45deg, #00ffff, #ff00ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navbar links */
.navbar-nav > li > a {
  color: #ffffff !important;
  transition: all 0.3s ease;
  border-radius: 8px;
  margin: 0 2px;
}

.navbar-nav > li > a:hover,
.navbar-nav > li > a:focus {
  color: var(--accent-color) !important;
  background: rgba(0, 255, 255, 0.1) !important;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

/* Dropdown menus */
.dropdown-menu {
  background: #ffffff !important;
  border: 2px solid var(--accent-color) !important;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 255, 255, 0.4);
  z-index: 999999 !important;
  position: absolute !important;
  margin: 0 !important;
  padding: 0 !important;
}

.navbar-nav .dropdown-menu {
  z-index: 999999 !important;
  background: rgba(15, 20, 35, 0.99) !important;
  border: 2px solid var(--accent-color) !important;
}

.dropdown {
  z-index: 999999 !important;
  position: relative !important;
}

.open > .dropdown-menu {
  z-index: 999999 !important;
  display: block !important;
}

/* Remove Bootstrap default dropdown styling */
.dropdown-menu::before,
.dropdown-menu::after {
  display: none !important;
}

.dropdown-menu .divider {
  background: var(--glass-border) !important;
  margin: 5px 0 !important;
}

.dropdown-menu > li > a {
  color: var(--text-primary) !important;
  transition: all 0.3s ease;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
  background: rgba(0, 255, 255, 0.3) !important;
  color: var(--accent-color) !important;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.8) !important;
}

/* Buttons */
.btn {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: 10px;
  transition: all 0.3s ease;
  font-family: 'Courier New', monospace;
  font-weight: bold;
}

.btn:hover {
  background: rgba(0, 255, 255, 0.2);
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: var(--neon-glow);
  transform: translateY(-2px);
}

#actualStartButton {
  background: var(--secondary-bg);
  border: 2px solid var(--accent-color);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#actualStartButton:hover {
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
  transform: translateY(-3px);
}

/* Main grid container */
#mainGrid {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  margin: 20px;
  padding: 20px;
  box-shadow: var(--retro-shadow);
}

/* Prevent color changes when algorithm is selected */
#mainGrid.algorithm-selected {
  background: var(--glass-bg) !important;
}

#mainText.algorithm-selected {
  background: var(--glass-bg) !important;
}

#algorithmDescriptor.algorithm-selected {
  background: var(--glass-bg) !important;
}

/* Legend styling */
#mainText {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: var(--retro-shadow);
}

#mainText ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#mainText li {
  color: var(--text-secondary);
  margin: 8px 0;
  font-weight: bold;
  display: flex;
  align-items: center;
  font-size: 14px;
}

#mainText li div {
  margin-right: 10px;
  border: 2px solid var(--glass-border);
  border-radius: 4px;
}

/* Algorithm descriptor */
#algorithmDescriptor {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: var(--accent-color) !important;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
  box-shadow: var(--retro-shadow);
}

/* Force consistent background regardless of state */
body {
  background: var(--primary-bg) !important;
  background-attachment: fixed !important;
}

body.algorithm-running,
body.algorithm-selected {
  background: var(--primary-bg) !important;
  background-attachment: fixed !important;
}

/* Board/Grid styling */
#board {
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid var(--glass-border);
  border-radius: 10px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
  padding: 10px;
}

/* Node styling with retro pixel aesthetic */
.unvisited {
  background-color: #ffe0b2;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.unvisited:hover {
  background-color: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.wall {
  background: linear-gradient(45deg, #2c3e50, #34495e);
  border: 1px solid #1a252f;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.start {
  background: radial-gradient(circle, #00ff00, #008000);
  border: 2px solid #00ff00;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
  animation: pulse-green 2s infinite;
}

.target {
  background: radial-gradient(circle, #ff0080, #cc0066);
  border: 2px solid #ff0080;
  box-shadow: 0 0 15px rgba(255, 0, 128, 0.8);
  animation: pulse-pink 2s infinite;
}

.visited {
  background: rgba(0, 255, 255, 0.3);
  border: 1px solid rgba(0, 255, 255, 0.5);
  animation: visited-glow 0.5s ease-in-out;
}

.shortest-path {
  background: linear-gradient(45deg, #ffff00, #ffa500);
  border: 1px solid #ffff00;
  box-shadow: 0 0 10px rgba(255, 255, 0, 0.6);
  animation: path-glow 1s ease-in-out;
}

.object {
  background: radial-gradient(circle, #ff4444, #cc0000);
  border: 2px solid #ff4444;
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.8);
}

.borderlessWeight {
  background: linear-gradient(45deg, #9b59b6, #8e44ad);
  border: 1px solid #9b59b6;
  opacity: 0.8;
}

/* Retro animations */
@keyframes pulse-green {
  0%, 100% { 
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 25px rgba(0, 255, 0, 1);
    transform: scale(1.05);
  }
}

@keyframes pulse-pink {
  0%, 100% { 
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.8);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 25px rgba(255, 0, 128, 1);
    transform: scale(1.05);
  }
}

@keyframes visited-glow {
  0% { 
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.8);
  }
  100% { 
    background: rgba(0, 255, 255, 0.3);
    transform: scale(1);
  }
}

@keyframes path-glow {
  0% { 
    background: rgba(255, 255, 0, 0.3);
    transform: scale(0.9);
  }
  100% { 
    background: linear-gradient(45deg, #ffff00, #ffa500);
    transform: scale(1);
  }
}

/* Hide tutorial overlay */
#tutorial {
  display: none !important;
}

/* Chatbot styling */
#chatbot {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 2px solid var(--accent-color);
  box-shadow: var(--retro-shadow), var(--neon-glow);
}

#chatbot-header {
  background: var(--secondary-bg) !important;
  color: #ffffff !important;
  color: var(--text-primary) !important;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

#chat-messages {
  background: rgba(255, 255, 255, 0.8) !important;
  color: var(--text-primary) !important;
}

.message {
  color: var(--text-primary) !important;
  font-weight: 500;
}

.user-message {
  background: rgba(0, 255, 255, 0.2) !important;
  border: 1px solid rgba(0, 255, 255, 0.4);
  color: var(--text-primary) !important;
}

.bot-message {
  background: #fff3e0 !important;
  border: 1px solid rgba(255, 0, 128, 0.4);
  color: var(--text-primary) !important;
}

#chat-input-container {
  background: rgba(0, 0, 0, 0.3) !important;
  border-top: 1px solid var(--glass-border) !important;
}

#user-input {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-primary) !important;
  border-radius: 8px;
}

#user-input::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
}

#send-btn {
  background: var(--secondary-bg) !important;
  border: 1px solid var(--accent-color) !important;
  color: var(--text-primary) !important;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

#send-btn:hover {
  background: rgba(0, 255, 255, 0.3) !important;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.typing-indicator {
  color: var(--accent-color) !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .navbar {
    margin: 5px;
  }
  
  #mainGrid {
    margin: 10px;
    padding: 10px;
  }
  
  .logo-text {
    font-size: 18px;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--glass-bg);
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 255, 0.3);
}
