/* ==========================================================================
   TERMINAL DESIGN SYSTEM - MODULE 2: UI & VISUAL ENGINE
   Aesthetic: Cyberpunk / Hacker Retro Programming Terminal
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette - Hacker / Terminal Theme */
  --bg-primary: #0a0e14;
  --bg-secondary: #121824;
  --bg-tertiary: #1a2332;
  --bg-card: rgba(18, 24, 36, 0.85);
  --bg-terminal: #07090e;
  
  --accent-green: #00ff66;
  --accent-green-glow: rgba(0, 255, 102, 0.25);
  --accent-cyan: #00e5ff;
  --accent-cyan-glow: rgba(0, 229, 255, 0.25);
  --accent-amber: #ffb000;
  --accent-amber-glow: rgba(255, 176, 0, 0.25);
  --accent-red: #ff3366;
  --accent-red-glow: rgba(255, 51, 102, 0.25);
  --accent-purple: #b57edc;
  
  --text-main: #e2e8f0;
  --text-muted: #8a99ad;
  --text-dim: #4a5568;
  --text-bright: #ffffff;
  
  --border-color: rgba(0, 229, 255, 0.2);
  --border-active: #00e5ff;
  --border-glow: 0 0 10px rgba(0, 229, 255, 0.4);
  
  --font-mono: 'Fira Code', monospace;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

/* Themes */
body.theme-matrix {
  --bg-primary: #050b05;
  --bg-secondary: #0a170a;
  --bg-tertiary: #102610;
  --accent-cyan: #00ff41;
  --border-color: rgba(0, 255, 65, 0.3);
}

body.theme-amber {
  --bg-primary: #0f0a03;
  --bg-secondary: #1a1205;
  --bg-tertiary: #2a1e08;
  --accent-green: #ffb000;
  --accent-cyan: #ffc107;
  --border-color: rgba(255, 176, 0, 0.3);
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-mono);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* CRT Scanlines Overlay */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.7;
}

body.scanlines-disabled .crt-overlay {
  display: none;
}

/* Layout Shell */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Navbar */
.terminal-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.brand-logo .prompt-symbol {
  color: var(--accent-green);
  font-weight: 700;
  font-size: 1.3rem;
  animation: pulse-glow 2s infinite;
}

.brand-title {
  color: var(--text-bright);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.brand-tag {
  background: rgba(0, 255, 102, 0.1);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--border-color);
  box-shadow: var(--border-glow);
}

.user-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  background: var(--bg-tertiary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

/* Main Content Wrapper */
.main-wrapper {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
  display: block;
}

/* Common UI Components */
.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.card-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-cyan);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.card-title {
  color: var(--text-bright);
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: var(--bg-terminal);
  border: 1px solid var(--border-color);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-fast);
}

.form-control:focus {
  border-color: var(--accent-cyan);
  box-shadow: var(--border-glow);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(0, 255, 102, 0.2));
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--text-muted);
}

.btn-danger {
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
}

/* Modal Overlay */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.3);
  position: relative;
}

/* CLI Window */
.cli-window {
  background: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.cli-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.cli-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.cli-output {
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--accent-green);
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.cli-input-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cli-prompt {
  color: var(--accent-cyan);
  font-weight: 700;
}

.cli-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
}

/* Footer */
.terminal-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 5px var(--accent-green)); }
  50% { opacity: 0.5; filter: drop-shadow(0 0 1px var(--accent-green)); }
}

@media (max-width: 768px) {
  .terminal-header {
    flex-direction: column;
    gap: 12px;
  }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}
