/**
 * Terminal Overlay CSS - PizzINT Style
 * Terminal/console aesthetic overlay for FinancialRatingAI
 */

/* Terminal Container */
.terminal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 150px;
  background: rgba(0, 0, 0, 0.95);
  border-bottom: 2px solid #00ff00;
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 14px;
  color: #00ff00;
  z-index: 9999; /* Lower than notifications (10000+) */
  padding: 12px 20px;
  box-shadow: 0 4px 20px rgba(0, 255, 0, 0.3);
  overflow: hidden; /* Ensure content doesn't overflow */
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto; /* Allow interactions within overlay */
}

/* Responsive heights */
@media (max-width: 768px) {
  .terminal-overlay {
    height: 120px;
    font-size: 12px;
    padding: 10px 15px;
  }
}

@media (max-width: 640px) {
  .terminal-overlay {
    height: 100px;
    font-size: 11px;
    padding: 8px 12px;
  }
}

/* Terminal Content Grid */
.terminal-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  height: 100%;
  align-items: start;
  position: relative; /* Ensure content stays within overlay */
  overflow: hidden; /* Prevent content from overflowing overlay */
}

@media (max-width: 768px) {
  .terminal-content {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Scanning Text Area */
.terminal-scanning {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scanning-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}

.scanning-prefix {
  color: #00ff00;
  font-weight: bold;
}

.scanning-text {
  color: #00ff00;
  white-space: nowrap;
  overflow: hidden;
}

/* Typewriter cursor */
.typewriter-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background-color: #00ff00;
  margin-left: 2px;
  animation: blink-cursor 1s infinite;
  vertical-align: middle;
}

@keyframes blink-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Status Indicators */
.terminal-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  min-width: 200px;
  justify-content: flex-start;
  position: relative; /* Ensure it stays within overlay bounds */
  z-index: 1; /* Lower than notifications */
}

@media (max-width: 768px) {
  .terminal-status {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    min-width: auto;
  }
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
}

.status-item .status-label {
  flex-shrink: 0;
}

.status-item .connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.status-item > * {
  vertical-align: middle;
}

.status-label {
  color: #ffaa00;
  text-transform: uppercase;
}

.status-value {
  color: #00ff00;
  font-weight: bold;
}

/* DEFCON Level Indicator */
.defcon-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 11px;
}

.defcon-5 {
  color: #00ff00;
  border-color: #00ff00;
}

.defcon-4 {
  color: #ffff00;
  border-color: #ffff00;
}

.defcon-3 {
  color: #ff8800;
  border-color: #ff8800;
}

.defcon-2 {
  color: #ff0000;
  border-color: #ff0000;
  animation: pulse-red 2s infinite;
}

.defcon-1 {
  color: #ff0000;
  border-color: #ff0000;
  animation: flash-red 0.5s infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(255, 0, 0, 0.5); }
  50% { opacity: 0.8; box-shadow: 0 0 20px rgba(255, 0, 0, 0.8); }
}

@keyframes flash-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Connection Status */
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  vertical-align: middle;
  position: relative; /* Ensure it stays within overlay */
  z-index: 1; /* Lower than notifications */
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.connected {
  background-color: #00ff00;
  box-shadow: 0 0 8px #00ff00;
  animation: pulse-green 2s infinite;
}

.status-dot.disconnected {
  background-color: #ff0000;
  box-shadow: 0 0 8px #ff0000;
  animation: pulse-red-dot 1s infinite;
}

.status-dot.connecting {
  background-color: #ffaa00;
  box-shadow: 0 0 8px #ffaa00;
  animation: pulse-orange 1.5s infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

@keyframes pulse-red-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-orange {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

/* Scan Line Animation */
.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ff00, transparent);
  opacity: 0.6;
  animation: scan-sweep 3s linear infinite;
  pointer-events: none;
}

@keyframes scan-sweep {
  0% { top: 0; opacity: 0.6; }
  50% { opacity: 0.8; }
  100% { top: 100%; opacity: 0.6; }
}

/* Terminal Text Glow */
.terminal-glow {
  text-shadow: 0 0 5px currentColor, 0 0 10px currentColor;
}

/* Monitoring Metrics */
.monitoring-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  color: #ffaa00;
  font-size: 10px;
  text-transform: uppercase;
}

.metric-value {
  color: #00ff00;
  font-size: 14px;
  font-weight: bold;
}

/* Minimize/Collapse Button */
.terminal-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: 1px solid #00ff00;
  color: #00ff00;
  padding: 4px 8px;
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.terminal-toggle:hover {
  background: rgba(0, 255, 0, 0.1);
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

.terminal-overlay.collapsed {
  height: 40px;
  overflow: hidden;
}

.terminal-overlay.collapsed .terminal-content {
  display: none;
}

/* Terminal Prompt Style */
.terminal-prompt {
  color: #00ff00;
}

.terminal-prompt::before {
  content: "> ";
  color: #00ff00;
}

/* Alert Text */
.alert-text {
  color: #ff0000;
  animation: alert-pulse 1s infinite;
}

@keyframes alert-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Ensure body has padding when overlay is visible */
body.has-terminal-overlay {
  padding-top: 150px;
}

@media (max-width: 768px) {
  body.has-terminal-overlay {
    padding-top: 120px;
  }
}

@media (max-width: 640px) {
  body.has-terminal-overlay {
    padding-top: 100px;
  }
}

/* Smooth transitions */
.terminal-overlay,
.defcon-indicator,
.status-dot {
  transition: all 0.3s ease;
}

