/* ============================================
   IGCSE ICT Chapter 10 — Global Design System
   Dark theme · Glassmorphism · Neon Glow
   ============================================ */

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

/* ---------- CSS Variables ---------- */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f2a;
  --bg-card: rgba(15, 15, 42, 0.6);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-bg-hover: rgba(255, 255, 255, 0.06);

  --neon-cyan: #00f0ff;
  --neon-purple: #b026ff;
  --neon-pink: #ff2d95;
  --neon-green: #39ff14;
  --neon-orange: #ff6b00;
  --neon-blue: #4d7cff;
  --neon-yellow: #ffe600;
  --neon-red: #ff3a3a;

  --text-primary: #e8e8ff;
  --text-secondary: rgba(232, 232, 255, 0.6);
  --text-muted: rgba(232, 232, 255, 0.35);

  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ---------- Particle Canvas ---------- */
#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Page Container ---------- */
.page-container {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Glass Panel ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-smooth);
}

.glass:hover {
  background: var(--glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

/* ---------- Neon Glow Utilities ---------- */
.glow-cyan    { box-shadow: 0 0 20px rgba(0, 240, 255, 0.15), inset 0 0 20px rgba(0, 240, 255, 0.03); }
.glow-purple  { box-shadow: 0 0 20px rgba(176, 38, 255, 0.15), inset 0 0 20px rgba(176, 38, 255, 0.03); }
.glow-pink    { box-shadow: 0 0 20px rgba(255, 45, 149, 0.15), inset 0 0 20px rgba(255, 45, 149, 0.03); }
.glow-green   { box-shadow: 0 0 20px rgba(57, 255, 20, 0.15), inset 0 0 20px rgba(57, 255, 20, 0.03); }
.glow-orange  { box-shadow: 0 0 20px rgba(255, 107, 0, 0.15), inset 0 0 20px rgba(255, 107, 0, 0.03); }
.glow-blue    { box-shadow: 0 0 20px rgba(77, 124, 255, 0.15), inset 0 0 20px rgba(77, 124, 255, 0.03); }
.glow-yellow  { box-shadow: 0 0 20px rgba(255, 230, 0, 0.15), inset 0 0 20px rgba(255, 230, 0, 0.03); }
.glow-red     { box-shadow: 0 0 20px rgba(255, 58, 58, 0.15), inset 0 0 20px rgba(255, 58, 58, 0.03); }

.text-glow-cyan   { text-shadow: 0 0 12px rgba(0, 240, 255, 0.5); }
.text-glow-purple { text-shadow: 0 0 12px rgba(176, 38, 255, 0.5); }
.text-glow-pink   { text-shadow: 0 0 12px rgba(255, 45, 149, 0.5); }
.text-glow-green  { text-shadow: 0 0 12px rgba(57, 255, 20, 0.5); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.btn:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-cyan {
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--neon-cyan);
}
.btn-cyan:hover {
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
  border-color: rgba(0, 240, 255, 0.5);
}

.btn-purple {
  border-color: rgba(176, 38, 255, 0.3);
  color: var(--neon-purple);
}
.btn-purple:hover {
  box-shadow: 0 0 20px rgba(176, 38, 255, 0.2);
  border-color: rgba(176, 38, 255, 0.5);
}

.btn-pink {
  border-color: rgba(255, 45, 149, 0.3);
  color: var(--neon-pink);
}
.btn-pink:hover {
  box-shadow: 0 0 20px rgba(255, 45, 149, 0.2);
  border-color: rgba(255, 45, 149, 0.5);
}

.btn-green {
  border-color: rgba(57, 255, 20, 0.3);
  color: var(--neon-green);
}
.btn-green:hover {
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.2);
  border-color: rgba(57, 255, 20, 0.5);
}

.btn-solid {
  background: linear-gradient(135deg, rgba(0,240,255,0.15), rgba(176,38,255,0.15));
  border-color: rgba(0, 240, 255, 0.3);
  font-weight: 600;
}
.btn-solid:hover {
  background: linear-gradient(135deg, rgba(0,240,255,0.25), rgba(176,38,255,0.25));
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
}

/* ---------- Headings ---------- */
.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 1.4vw, 1rem);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--neon-cyan);
}

/* ---------- Inputs ---------- */
.input, .textarea, .select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast);
  outline: none;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.1);
}

.textarea { resize: vertical; min-height: 80px; }

.select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300f0ff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ---------- Slider ---------- */
.slider-container { display: flex; align-items: center; gap: 12px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0,240,255,0.4);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0,240,255,0.4);
  cursor: pointer;
  border: none;
}

/* ---------- Badge / Tag ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-cyan { background: rgba(0,240,255,0.12); color: var(--neon-cyan); }
.badge-green { background: rgba(57,255,20,0.12); color: var(--neon-green); }
.badge-red { background: rgba(255,58,58,0.12); color: var(--neon-red); }
.badge-purple { background: rgba(176,38,255,0.12); color: var(--neon-purple); }

/* ---------- Progress Bar ---------- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(0,0,0,0.85);
  color: var(--text-primary);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes neonPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0,240,255,0.2), 0 0 20px rgba(0,240,255,0.1); }
  50% { box-shadow: 0 0 20px rgba(0,240,255,0.4), 0 0 40px rgba(0,240,255,0.2); }
}

.animate-in {
  animation: fadeIn 0.5s ease forwards;
}

/* ---------- Layout Utilities ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.text-center { text-align: center; }
.relative { position: relative; }

/* ---------- Spacing ---------- */
.p-sm { padding: 8px; }
.p-md { padding: 16px; }
.p-lg { padding: 24px; }

/* ---------- Back Button (nav) ---------- */
.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(15, 15, 42, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--neon-cyan);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.back-btn:hover {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
  transform: translateX(-3px);
}

.back-btn svg {
  width: 16px; height: 16px;
  fill: currentColor;
}

/* ---------- Simulator Header ---------- */
.sim-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 70px;
  flex-shrink: 0;
}

.sim-body {
  flex: 1;
  display: flex;
  padding: 0 20px 16px;
  gap: 16px;
  overflow: hidden;
  min-height: 0;
}

/* ---------- Panel ---------- */
.panel {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--neon-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .icon {
  width: 18px; height: 18px;
  opacity: 0.8;
}

/* ---------- Table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--neon-cyan);
  border-bottom: 1px solid var(--glass-border);
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: rgba(255,255,255,0.02);
  color: var(--text-primary);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: rgba(15, 15, 42, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  animation: fadeInScale 0.3s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .sim-header { padding: 12px 16px; }
  .sim-body {
    flex-direction: column;
    padding: 0 12px 12px;
    gap: 10px;
    overflow: auto;
  }
  .back-btn {
    top: 12px; left: 12px;
    padding: 8px 14px;
    font-size: 0.65rem;
  }
  .panel { padding: 12px; }
}

@media (max-width: 480px) {
  .page-title { font-size: 1.1rem; }
  .sim-body { padding: 0 8px 8px; gap: 8px; }
}
