/* =========================================
   VARIABLES & RESET
   ========================================= */
:root {
  /* Color Palette */
  --bg-color: #080808;
  --terminal-bg: rgba(13, 13, 13, 0.85); /* Enyhén áttetsző a blur effekthez */
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --text-muted: #555555;

  --accent-green: #22c55e;
  --accent-orange: #ffa500;
  --accent-blue: #3b82f6;
  --accent-red: #ef4444; /* Hozzáadva kritikus hibához */

  --font-mono: "Space Mono", monospace;
  --font-sans: "Inter", sans-serif;

  --window-border: rgba(255, 255, 255, 0.15);

  /* Typography */
  --font-mono: "Space Mono", monospace;
  --font-sans: "Inter", sans-serif;

  /* Spacing & Sizes */
  --radius-lg: 12px;
  --radius-sm: 6px;

  /* Animation */
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-mono); /* Alapértelmezett a terminál érzet miatt */
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* =========================================
   AMBIENT EFFECTS (Scanlines & Glow)
   ========================================= */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0) 50%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.1)
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 10;
  opacity: 0.3;
}

.ambient-glow {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at center,
    rgba(34, 197, 94, 0.08),
    transparent 60%
  );
  pointer-events: none;
  z-index: 0;
  animation: pulseGlow 10s ease-in-out infinite alternate;
}

/* =========================================
   TERMINAL CONTAINER
   ========================================= */
.terminal-container {
  width: min(900px, 94vw);
  min-height: min(600px, 80vh);
  background: var(--terminal-bg);
  border: 1px solid var(--window-border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  z-index: 1;
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.8s var(--transition-smooth);
}

/* Header */
.terminal-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--window-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.window-controls {
  position: absolute;
  left: 16px;
  display: flex;
  gap: 8px;
}

.control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}
.control.close {
  background: #ff5f56;
}
.control.minimize {
  background: #ffbd2e;
}
.control.maximize {
  background: #27c93f;
}

.window-title {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

/* Body */
.terminal-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-mono);
  scrollbar-width: thin;
  scrollbar-color: var(--window-border) transparent;
}

/* =========================================
   CLI ELEMENTS
   ========================================= */
.cli-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.footer-cli {
  margin-top: 40px;
  margin-bottom: 0;
  opacity: 0.7;
}

.prompt {
  color: var(--accent-green);
  font-weight: 700;
}

.command {
  color: var(--text-primary);
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1.2em;
  background-color: var(--accent-green);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

/* =========================================
   STATUS SECTIONS
   ========================================= */
.content-hidden {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.content-visible {
  opacity: 1;
}

/* Overall Status */
.section-overall {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--window-border);
}

.status-big-indicator {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.status-icon {
  width: 16px;
  height: 16px;
  background: var(--text-secondary);
  box-shadow: 0 0 15px currentColor;
  border-radius: 50%;
  transition: all 0.5s var(--transition-smooth);
}

#overall-text {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.meta-text {
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding-left: 32px; /* align with text */
}

/* Section Titles */
.section-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Components Grid */
.components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.component-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--window-border);
  padding: 16px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.component-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

.comp-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
}

.comp-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid currentColor;
}

/* Incidents (ha van) */
.incident-item {
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid var(--accent-red);
  padding: 16px;
  margin-bottom: 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.incident-title {
  color: var(--accent-red);
  font-weight: bold;
  margin-bottom: 4px;
}
.incident-body {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* =========================================
   STATES & COLORS
   ========================================= */
.text-green {
  color: var(--accent-green);
}
.text-orange {
  color: var(--accent-orange);
}
.text-blue {
  color: var(--accent-blue);
}
.text-red {
  color: var(--accent-red);
}

.bg-green {
  background-color: var(--accent-green);
}
.bg-orange {
  background-color: var(--accent-orange);
}
.bg-blue {
  background-color: var(--accent-blue);
}
.bg-red {
  background-color: var(--accent-red);
}

.glow-green {
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}
.glow-orange {
  box-shadow: 0 0 20px rgba(255, 165, 0, 0.4);
}
.glow-blue {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}
.glow-red {
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* =========================================
   LOADER & ERROR
   ========================================= */
.loader {
  margin: 40px 0;
}
.loading-text {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--accent-blue);
}
.progress-bar {
  width: 100%;
  max-width: 300px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-blue);
  animation: loadBar 1.5s ease-in-out forwards;
}

.error-box {
  border: 1px solid var(--accent-red);
  padding: 16px;
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.05);
  margin-top: 20px;
}
.retry-link {
  background: none;
  border: none;
  color: var(--text-primary);
  text-decoration: underline;
  cursor: pointer;
  font-family: var(--font-mono);
  margin-left: 10px;
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loadBar {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

@keyframes pulseGlow {
  from {
    opacity: 0.3;
    transform: scale(1);
  }
  to {
    opacity: 0.6;
    transform: scale(1.1);
  }
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .terminal-container {
    border-radius: 0;
    width: 100%;
    height: 100vh;
    margin: 0;
    border: none;
  }
  .component-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .comp-status {
    align-self: flex-start;
  }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
