/* ===== Babylon-5 Terminal — Shared Styles for Static Mockups ===== */

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  margin: 0;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

.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.15) 50%), linear-gradient(90deg, rgba(var(--crt-r), var(--crt-g), var(--crt-b), 0.03), rgba(var(--crt-r2), var(--crt-g2), var(--crt-b2), 0.01), rgba(var(--crt-r3), var(--crt-g3), var(--crt-b3), 0.03));
  background-size: 100% 4px, 3px 100%;
  pointer-events: none;
  z-index: 50;
  box-shadow: inset 0 0 100px rgba(0,0,0,0.9);
}

.crt-flicker {
  animation: flicker 0.2s infinite;
}

@keyframes flicker {
  0% { opacity: 0.99; }
  50% { opacity: 0.97; }
  100% { opacity: 0.99; }
}

.b5-panel {
  border-width: 1px;
  border-style: solid;
  border-color: var(--border-primary);
  background: var(--bg-panel);
  box-shadow: inset 0 0 20px var(--shadow-panel-inset), 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  position: relative;
}

.b5-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glow-panel), transparent);
  pointer-events: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); border-left: 1px solid var(--border-primary); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }
::-webkit-scrollbar-corner { background: transparent; }

.b5-border-amber {
  border-color: var(--text-accent);
  box-shadow: inset 0 0 20px rgba(217, 119, 6, 0.2);
}

.b5-border-red {
  border-color: #ef4444;
  box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.2);
}

.b5-text-glow { text-shadow: 0 0 8px var(--glow-primary); }
.b5-text-glow-amber { text-shadow: 0 0 8px var(--glow-accent); }
.b5-text-glow-red { text-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
.b5-text-glow-green { text-shadow: 0 0 8px rgba(74, 222, 128, 0.6); }

.scanline {
  width: 100%;
  height: 100px;
  background: linear-gradient(0deg, rgba(0,0,0,0) 0%, var(--crt-scanline) 50%, rgba(0,0,0,0) 100%);
  opacity: 0.1;
  position: absolute;
  bottom: 100%;
  animation: scanline 8s linear infinite;
  pointer-events: none;
}

@keyframes scanline {
  0% { bottom: 100%; }
  100% { bottom: -100px; }
}

/* Radar sweep animation */
.radar-sweep-conic {
  background: conic-gradient(from 0deg, transparent 0deg, transparent 270deg, rgba(245, 158, 11, 0.05) 320deg, rgba(245, 158, 11, 0.4) 360deg);
  animation: radar-rotate 4s linear infinite;
}

.radar-sweep-conic::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 50%;
  background: var(--radar-color);
  box-shadow: 0 0 15px var(--radar-color);
  transform: translateX(-50%);
  transform-origin: bottom center;
}

@keyframes radar-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.bg-noise {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.15;
  mix-blend-mode: overlay;
}

.ticker-wrap {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.ticker {
  display: inline-block;
  white-space: nowrap;
  padding-right: 100%;
  animation: ticker 20s linear infinite;
}

@keyframes ticker {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}

.glitch-effect {
  animation: glitch 3s infinite;
}

@keyframes glitch {
  0% { transform: translate(0) }
  20% { transform: translate(-2px, 1px) }
  40% { transform: translate(-1px, -1px) }
  60% { transform: translate(2px, 1px) }
  80% { transform: translate(1px, -1px) }
  100% { transform: translate(0) }
}

.pb-safe {
  padding-bottom: env(safe-area-inset-bottom);
}

/* Sidebar nav link styles */
.nav-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  width: 100%;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.875rem;
  font-weight: 700;
  transition: all 0.3s;
  border-radius: 0.5rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
}

.nav-sidebar-link:hover {
  background: var(--bg-panel-hover);
  color: var(--text-secondary);
  transform: translateX(4px);
}

.nav-sidebar-link.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  text-shadow: 0 0 8px var(--nav-active-glow);
  box-shadow: inset 0 0 15px var(--nav-active-shadow);
  border: 1px solid var(--nav-active-border);
}

.nav-sidebar-link.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--nav-active-bar);
  box-shadow: 0 0 10px var(--nav-active-glow);
}

/* Mobile nav link styles */
.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.4rem 0.15rem;
  min-height: 44px;
  border-radius: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 9px;
  font-weight: 700;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
}

@media (min-width: 400px) {
  .mobile-nav-link {
    font-size: 10px;
    gap: 0.375rem;
    letter-spacing: 0.08em;
  }
}

.mobile-nav-link:hover {
  background: var(--bg-panel-hover);
  color: var(--text-secondary);
}

.mobile-nav-link.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  text-shadow: 0 0 8px var(--nav-active-glow);
  box-shadow: inset 0 0 15px var(--nav-active-shadow);
  border: 1px solid var(--nav-active-border);
}

.mobile-nav-link.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--nav-active-bar);
  box-shadow: 0 0 10px var(--nav-active-glow);
}

/* Header gradient (moved from Tailwind inline) */
.b5-header-gradient {
  background: linear-gradient(to right, var(--bg-header-from), var(--bg-header-via), var(--bg-header-to));
}

/* Mobile nav gradient */
.b5-mobile-nav-gradient {
  background: linear-gradient(to top, var(--bg-nav-mobile), var(--bg-nav-mobile));
}

/* ===== Race-Specific Layout Overrides ===== */

/* ── EarthForce: Military HUD ── */
.theme-earthforce .race-bg-pattern {
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 50px, rgba(30, 58, 138, 0.03) 50px, rgba(30, 58, 138, 0.03) 51px),
    repeating-linear-gradient(90deg, transparent, transparent 50px, rgba(30, 58, 138, 0.03) 50px, rgba(30, 58, 138, 0.03) 51px);
}

.theme-earthforce .race-decor-header {
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, transparent, #f59e0b, #60a5fa, #f59e0b, transparent) 1;
}

/* ── Minbari: Crystal/Triangular ── */
.theme-minbari .race-bg-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L55 50 L5 50Z' fill='none' stroke='rgba(45,212,191,0.04)' stroke-width='1'/%3E%3C/svg%3E");
}

.theme-minbari .status-card {
  clip-path: polygon(0 8px, 8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px));
  border: none !important;
  outline: 1px solid var(--border-primary);
  outline-offset: -1px;
}

.theme-minbari .sector-item {
  clip-path: polygon(0 4px, 4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
}

.theme-minbari .incident-item {
  border-left: none !important;
  border-top: 1px solid var(--border-primary);
  padding-top: 12px;
  padding-left: 0;
}

.theme-minbari .race-decor-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 1px solid var(--text-primary);
  opacity: 0.15;
}

.theme-minbari .race-decor-corner.tl { top: 8px; left: 8px; border-right: none; border-bottom: none; clip-path: polygon(0 0, 100% 0, 0 100%); }
.theme-minbari .race-decor-corner.tr { top: 8px; right: 8px; border-left: none; border-bottom: none; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.theme-minbari .race-decor-corner.bl { bottom: 8px; left: 8px; border-right: none; border-top: none; clip-path: polygon(0 0, 0 100%, 100% 100%); }
.theme-minbari .race-decor-corner.br { bottom: 8px; right: 8px; border-left: none; border-top: none; clip-path: polygon(100% 0, 0 100%, 100% 100%); }

/* ── Centauri: Baroque/Ornamental ── */
.theme-centauri .race-bg-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='40' cy='40' r='20' fill='none' stroke='rgba(251,191,36,0.03)' stroke-width='1'/%3E%3Ccircle cx='40' cy='40' r='35' fill='none' stroke='rgba(167,139,250,0.02)' stroke-width='1'/%3E%3C/svg%3E");
}

.theme-centauri .status-card {
  border-width: 2px !important;
  border-radius: 8px;
  position: relative;
}

.theme-centauri .status-card::after {
  content: '';
  position: absolute;
  top: -1px; left: 20%; right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(251,191,36,0.5), transparent);
}

.theme-centauri .sector-item {
  border-radius: 6px;
  border-width: 1px;
  border-style: double;
}

.theme-centauri .race-decor-header {
  border-bottom: 2px double var(--text-primary);
  padding-bottom: 4px;
}

.theme-centauri .race-ornament {
  position: absolute;
  opacity: 0.06;
  pointer-events: none;
}

/* ── Narn: Brutal/Industrial ── */
.theme-narn .race-bg-pattern {
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(239,68,68,0.02) 20px, rgba(239,68,68,0.02) 21px),
    repeating-linear-gradient(-45deg, transparent, transparent 20px, rgba(239,68,68,0.02) 20px, rgba(239,68,68,0.02) 21px);
}

.theme-narn .status-card {
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  border: 2px solid var(--border-primary) !important;
}

.theme-narn .sector-item {
  border-left: 3px solid var(--text-primary) !important;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
}

.theme-narn .incident-item {
  border-left-width: 4px !important;
}

.theme-narn .race-decor-header {
  border-bottom: 4px solid var(--text-primary);
  position: relative;
}

.theme-narn .race-decor-header::after {
  content: '\25B0\25B0\25B0\25B0\25B0\25B0\25B0\25B0';
  position: absolute;
  bottom: -18px;
  left: 0;
  font-size: 8px;
  letter-spacing: 4px;
  color: var(--text-primary);
  opacity: 0.3;
}

.theme-narn .race-warning-stripe {
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(239,68,68,0.05) 10px, rgba(239,68,68,0.05) 20px);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ── Vorlon: Organic/Flowing ── */
.theme-vorlon .race-bg-pattern {
  background-image: radial-gradient(ellipse at 30% 50%, rgba(52,211,153,0.04) 0%, transparent 50%),
                     radial-gradient(ellipse at 70% 50%, rgba(253,224,71,0.03) 0%, transparent 50%);
}

.theme-vorlon .status-card {
  border-radius: 20px !important;
  border: 1px solid var(--border-primary) !important;
  overflow: hidden;
}

.theme-vorlon .status-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 120%, var(--glow-primary), transparent 70%);
  opacity: 0.08;
  pointer-events: none;
}

.theme-vorlon .sector-item {
  border-radius: 12px;
  border-left: none !important;
}

.theme-vorlon .incident-item {
  border-left: none !important;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--bg-panel) !important;
  border: 1px solid var(--border-primary) !important;
  margin-bottom: 8px;
}

.theme-vorlon .race-decor-header {
  text-align: center;
  border: none;
}

.theme-vorlon .race-glow-orb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-primary), transparent 70%);
  opacity: 0.06;
  pointer-events: none;
  animation: vorlon-float 8s ease-in-out infinite;
}

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

/* ── Shadows: Corrupted/Glitch ── */
.theme-shadows .race-bg-pattern {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(168,85,247,0.02) 2px, rgba(168,85,247,0.02) 4px);
  animation: shadow-static 0.5s steps(3) infinite;
}

@keyframes shadow-static {
  0% { background-position: 0 0; }
  33% { background-position: 0 2px; }
  66% { background-position: 0 -1px; }
  100% { background-position: 0 1px; }
}

.theme-shadows .status-card {
  border: 1px solid var(--border-primary) !important;
  position: relative;
  overflow: hidden;
}

.theme-shadows .status-card::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(168,85,247,0.1), transparent);
  animation: shadow-scan 4s linear infinite;
}

@keyframes shadow-scan {
  0% { left: -100%; }
  100% { left: 200%; }
}

.theme-shadows .sector-item {
  border-left: 2px solid var(--text-primary) !important;
  border-right: 2px solid var(--text-secondary) !important;
}

.theme-shadows .race-decor-header {
  text-decoration: line-through;
  text-decoration-color: var(--text-secondary);
  text-decoration-thickness: 1px;
}

.theme-shadows .race-corrupt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(168,85,247,0.015) 3px,
    rgba(168,85,247,0.015) 4px
  );
  animation: shadow-corrupt 3s infinite;
}

/* ── Drakh: Parasitic/Decay ── */
.theme-drakh .race-bg-pattern {
  background-image:
    radial-gradient(ellipse at 20% 80%, rgba(132,204,22,0.04) 0%, transparent 40%),
    repeating-linear-gradient(180deg, transparent, transparent 40px, rgba(132,204,22,0.015) 40px, rgba(132,204,22,0.015) 41px);
}

.theme-drakh .status-card {
  border-left: 3px solid var(--text-primary) !important;
  border-radius: 0 4px 4px 0;
}

.theme-drakh .sector-item {
  border-left: 2px solid rgba(132,204,22,0.3) !important;
  position: relative;
}

.theme-drakh .race-decor-header {
  border-bottom: 1px dashed var(--text-primary);
  opacity: 0.8;
}

/* ── Pakmara: Utilitarian/Minimal ── */
.theme-pakmara .race-bg-pattern {
  background: none;
}

.theme-pakmara .status-card {
  border: 1px solid var(--border-primary) !important;
  border-radius: 0;
}

.theme-pakmara .sector-item {
  border-radius: 0;
  border-bottom: 1px dashed var(--border-primary);
  border-left: none !important;
  background: none !important;
}

.theme-pakmara .incident-item {
  border-left: 2px solid var(--border-primary) !important;
  background: none !important;
}

.theme-pakmara .race-decor-header {
  border-bottom: 1px solid var(--border-primary);
  font-weight: normal;
  letter-spacing: normal;
}

/* ── League: Diplomatic/Clean ── */
.theme-league .race-bg-pattern {
  background-image:
    repeating-linear-gradient(90deg, transparent, transparent 100px, rgba(34,211,238,0.02) 100px, rgba(34,211,238,0.02) 101px);
}

.theme-league .status-card {
  border-radius: 4px;
  border-top: 2px solid var(--text-accent) !important;
}

.theme-league .sector-item {
  border-radius: 4px;
  border-left: 3px solid var(--text-accent) !important;
}

.theme-league .race-decor-header {
  border-bottom: 1px solid var(--border-strong);
  position: relative;
}

.theme-league .race-decor-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--text-accent);
}
