﻿/* ═══════════════════════════════════════════════════════════════
   SPIDER UNIFIED THEME — Spider-Man × Iron Man HUD
   Condiviso da hub, dashboard, spider, dance, blind, social, bridge
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Rajdhani:wght@300;400;500;600;700&display=swap');

:root {
  /* Spider-Man — tutto rosso */
  --spider-red: #c0392b;
  --spider-red-bright: #e74c3c;
  --spider-red-glow: rgba(192, 57, 43, 0.45);
  --spider-blue: #8b1a1a;
  --web-line: rgba(255, 255, 255, 0.04);

  /* Iron Man — tutto rosso */
  --arc: #e74c3c;
  --arc-bright: #ff6b6b;
  --arc-glow: rgba(231, 76, 60, 0.5);
  --gold: #c0392b;
  --gold-bright: #ff4444;
  --gold-glow: rgba(192, 57, 43, 0.45);

  /* Base */
  --dark: #030308;
  --dark-2: #080810;
  --dark-3: #0e0e18;
  --dark-4: #161622;
  --panel: rgba(8, 8, 16, 0.88);
  --border: rgba(192, 57, 43, 0.3);
  --border-red: rgba(192, 57, 43, 0.35);
  --text: #e8e8f0;
  --text-dim: #7070a0;
  --success: #00ff88;
  --warning: #ff9f00;
  --danger: #ff3333;
  --font-hud: 'Orbitron', 'Courier New', monospace;
  --font-body: 'Rajdhani', 'Segoe UI', sans-serif;
}

/* ── Background layers ── */
body.spider-theme {
  font-family: var(--font-body);
  background: var(--dark);
  color: var(--text);
  position: relative;
  min-height: 100vh;
}

body.spider-theme::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 600px at 15% 20%, var(--spider-red-glow) 0%, transparent 55%),
    radial-gradient(ellipse 700px 500px at 85% 75%, var(--arc-glow) 0%, transparent 50%),
    radial-gradient(circle 120px at 50% 50%, rgba(192, 57, 43, 0.06) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

body.spider-theme::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(192, 57, 43, 0.012) 2px, rgba(192, 57, 43, 0.012) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 80px, var(--web-line) 80px, var(--web-line) 81px),
    repeating-linear-gradient(0deg, transparent, transparent 80px, var(--web-line) 80px, var(--web-line) 81px);
  pointer-events: none;
  z-index: 0;
  animation: webShift 60s linear infinite;
}

@keyframes webShift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, 40px); }
}

.spider-scan-overlay {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 3px,
    rgba(192, 57, 43, 0.015) 3px, rgba(192, 57, 43, 0.015) 6px
  );
  pointer-events: none;
  z-index: 1;
}

.spider-scan-line {
  position: fixed;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 5%, var(--arc) 50%, transparent 95%);
  box-shadow: 0 0 20px var(--arc-glow), 0 0 40px var(--arc-glow);
  opacity: 0.6;
  animation: scanSweep 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes scanSweep {
  0% { top: -2px; opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.7; }
  100% { top: 100%; opacity: 0; }
}

/* ── Arc Reactor (decorativo) ── */
.arc-reactor {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--arc-bright) 0%, var(--arc) 30%, transparent 70%);
  box-shadow: 0 0 30px var(--arc-glow), 0 0 60px var(--arc-glow), inset 0 0 20px rgba(192, 57, 43, 0.3);
  animation: arcPulse 2.5s ease-in-out infinite;
  position: relative;
}
.arc-reactor::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 2px solid rgba(192, 57, 43, 0.6);
  animation: arcSpin 8s linear infinite;
}
.arc-reactor::after {
  content: '';
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--dark);
  border: 1px solid var(--arc);
}

@keyframes arcPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.3); }
}
@keyframes arcSpin {
  to { transform: rotate(360deg); }
}

/* ── Typography ── */
.spider-title {
  font-family: var(--font-hud);
  font-weight: 900;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--arc-bright) 0%, var(--gold-bright) 50%, var(--spider-red-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 25px var(--arc-glow));
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from { filter: drop-shadow(0 0 15px var(--arc-glow)); }
  to { filter: drop-shadow(0 0 35px var(--arc-glow)) drop-shadow(0 0 15px var(--spider-red-glow)); }
}

.spider-subtitle {
  font-family: var(--font-hud);
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── HUD Panels (Iron Man corners) ── */
.hud-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  position: relative;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
}
.hud-panel::before,
.hud-panel::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-color: var(--arc);
  border-style: solid;
  pointer-events: none;
}
.hud-panel::before {
  top: -1px; left: -1px;
  border-width: 2px 0 0 2px;
}
.hud-panel::after {
  bottom: -1px; right: -1px;
  border-width: 0 2px 2px 0;
}

.hud-panel:hover {
  transform: translateY(-4px);
  border-color: rgba(192, 57, 43, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--arc-glow);
}

.hud-panel.spider-accent {
  border-color: var(--border-red);
}
.hud-panel.spider-accent::before,
.hud-panel.spider-accent::after {
  border-color: var(--spider-red-bright);
}
.hud-panel.spider-accent:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 25px var(--spider-red-glow);
}

/* ── Buttons ── */
.spider-btn {
  font-family: var(--font-hud);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: transparent;
  position: relative;
  overflow: hidden;
}
.spider-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.08) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.spider-btn:hover::before { transform: translateX(100%); }

.spider-btn-arc {
  border: 1px solid var(--arc);
  color: var(--arc);
}
.spider-btn-arc:hover {
  background: rgba(192, 57, 43, 0.15);
  box-shadow: 0 0 20px var(--arc-glow);
  color: #fff;
}

.spider-btn-red {
  border: 1px solid var(--spider-red);
  color: var(--spider-red-bright);
}
.spider-btn-red:hover {
  background: rgba(192, 57, 43, 0.2);
  box-shadow: 0 0 20px var(--spider-red-glow);
}

.spider-btn-gold {
  border: 1px solid var(--gold);
  color: var(--gold-bright);
}
.spider-btn-gold:hover {
  background: rgba(243, 156, 18, 0.15);
  box-shadow: 0 0 20px var(--gold-glow);
}

/* ── Status dots ── */
.spider-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.spider-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: dotBlink 2s infinite;
}
.spider-dot.checking { background: var(--warning); }
.spider-dot.offline { background: var(--danger); }

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Status bar ── */
.spider-status-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(3, 3, 8, 0.95);
  border-top: 1px solid var(--border);
  padding: 8px 20px;
  display: flex;
  gap: 20px;
  align-items: center;
  font-family: var(--font-hud);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  z-index: 100;
  backdrop-filter: blur(12px);
}

/* ── Header bar (app-shell, sub-pages) ── */
.spider-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(8, 8, 16, 0.95);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-hud);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.spider-topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--spider-red), var(--arc), var(--gold), transparent);
  opacity: 0.5;
}
.spider-topbar a,
.spider-topbar button {
  color: var(--arc);
  text-decoration: none;
  background: rgba(192, 57, 43, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
}
.spider-topbar a:hover,
.spider-topbar button:hover {
  background: rgba(192, 57, 43, 0.15);
  box-shadow: 0 0 12px var(--arc-glow);
}

/* ── Card accent colors ── */
[data-accent="spider"] { --card-color: var(--spider-red-bright); --card-glow: var(--spider-red-glow); }
[data-accent="arc"]    { --card-color: var(--arc); --card-glow: var(--arc-glow); }
[data-accent="gold"]   { --card-color: var(--gold-bright); --card-glow: var(--gold-glow); }
[data-accent="green"]  { --card-color: var(--success); --card-glow: rgba(0, 255, 136, 0.25); }
[data-accent="purple"] { --card-color: #c084fc; --card-glow: rgba(192, 132, 252, 0.25); }

/* ── Content z-index wrapper ── */
.spider-content { position: relative; z-index: 5; }

/* ── Hex grid decoration ── */
.hex-grid {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23e74c3c' fill-opacity='1'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .spider-title { letter-spacing: 0.12em; font-size: clamp(1.4rem, 7vw, 2.2rem); }
  .arc-reactor { width: 48px; height: 48px; }
  .spider-topbar { flex-wrap: wrap; }
  .hud-panel { border-radius: 6px; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .spider-title { font-size: clamp(1.6rem, 4vw, 2.4rem); }
}

/* ── Edith PIN gate ── */
.edith-pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 3, 8, 0.88);
  backdrop-filter: blur(8px);
}
.edith-pin-overlay.hidden { display: none; }
.edith-pin-card {
  width: min(340px, 92vw);
  padding: 24px 22px;
  border-radius: 8px;
  border: 1px solid rgba(192, 57, 43, 0.45);
  background: rgba(8, 8, 16, 0.96);
  box-shadow: 0 0 40px rgba(192, 57, 43, 0.15), inset 0 0 30px rgba(243, 156, 18, 0.05);
  text-align: center;
}
.edith-pin-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-hud, 'Orbitron', monospace);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--gold-bright, #c0392b);
}
.edith-pin-card p { margin: 0 0 14px; font-size: 0.9rem; color: var(--text-dim, #9090b8); }
.edith-pin-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 4px;
  border: 1px solid rgba(192, 57, 43, 0.4);
  background: rgba(0, 0, 0, 0.5);
  color: var(--arc, #e74c3c);
  font-family: var(--font-hud, 'Orbitron', monospace);
  font-size: 1.2rem;
  letter-spacing: 0.3em;
  text-align: center;
}
.edith-pin-err { color: var(--spider-red-bright, #e74c3c) !important; font-size: 0.8rem !important; }
.edith-pin-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: center; }
.edith-pin-actions .btn {
  padding: 10px 18px;
  border-radius: 4px;
  font-family: var(--font-hud, 'Orbitron', monospace);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  border: 1px solid rgba(192, 57, 43, 0.3);
}
.edith-pin-actions .btn.primary {
  background: linear-gradient(135deg, rgba(243, 156, 18, 0.9), rgba(192, 57, 43, 0.85));
  color: #030308;
  border-color: var(--gold-bright, #c0392b);
}
.edith-pin-actions .btn.ghost { background: transparent; color: var(--arc, #e74c3c); }
