/* ==========================================================================
   IAA OS — Core Styles
   Government-style operator terminal. FBI blue/grey, clinical, deliberate.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Rajdhani:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=Caveat:wght@500;700&family=Special+Elite&display=swap');

:root {
  /* Palette — deliberately cold, federal */
  --bg-void: #050810;
  --bg-deep: #0a1220;
  --bg-panel: #0f1b30;
  --bg-surface: #142442;
  --bg-elevated: #1a2d55;
  --bg-hover: #223766;

  --border-subtle: rgba(120, 170, 230, 0.08);
  --border-default: rgba(120, 170, 230, 0.16);
  --border-strong: rgba(120, 170, 230, 0.28);

  --text-primary: #dde7f5;
  --text-secondary: #8fa3c4;
  --text-muted: #5a6f93;
  --text-dim: #3a4b6b;

  --accent-blue: #4a8fe0;
  --accent-cyan: #5ec7e8;
  --accent-gold: #d4a645;

  --status-critical: #e85563;
  --status-high: #e88c45;
  --status-medium: #d4b835;
  --status-low: #5ab378;
  --status-active: #4a8fe0;
  --status-closed: #5a6f93;

  --classified-red: #c42f3d;

  /* Fonts */
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-display: 'Rajdhani', sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;

  /* Timings */
  --ease-snap: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-void);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body.scrollable {
  overflow: auto;
  user-select: text;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

button { cursor: pointer; }

input, textarea, select {
  user-select: text;
}

/* ==========================================================================
   Scanline + CRT overlay — adds terminal feel across the OS
   ========================================================================== */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.06) 3px,
      rgba(0, 0, 0, 0) 4px
    );
  mix-blend-mode: multiply;
}

.crt-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.35) 100%);
}

/* ==========================================================================
   Boot screen
   ========================================================================== */
#boot-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-void);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s;
}

#boot-screen.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-logo {
  width: 120px;
  height: 120px;
  max-width: 120px;
  max-height: 120px;
  opacity: 0;
  animation: bootLogoIn 0.8s var(--ease-snap) forwards;
  flex-shrink: 0;
}

.boot-logo svg,
.boot-logo img {
  display: block;
  width: 120px;
  height: 120px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(74, 143, 224, 0.4));
}

.boot-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 8px;
  font-weight: 700;
  color: var(--text-primary);
  opacity: 0;
  animation: bootFadeIn 0.5s 0.4s forwards;
}

.boot-subtitle {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--text-muted);
  opacity: 0;
  animation: bootFadeIn 0.5s 0.6s forwards;
}

.boot-log {
  margin-top: 30px;
  width: 500px;
  max-width: 80vw;
  min-height: 160px;
  font-size: 12px;
  color: var(--text-secondary);
}

.boot-log-line {
  opacity: 0;
  animation: bootLineIn 0.3s var(--ease-snap) forwards;
  margin: 4px 0;
  display: flex;
  gap: 12px;
}

.boot-log-line .tag {
  color: var(--accent-cyan);
  min-width: 60px;
}

.boot-log-line .ok {
  color: var(--status-low);
  margin-left: auto;
}

.boot-progress {
  width: 500px;
  max-width: 80vw;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  margin-top: 20px;
  overflow: hidden;
  position: relative;
}

.boot-progress::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
  animation: bootProgress 2.5s ease-in-out infinite;
}

@keyframes bootLogoIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes bootFadeIn { to { opacity: 1; } }
@keyframes bootLineIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes bootProgress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ==========================================================================
   Login screen
   ========================================================================== */
#login-screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(74, 143, 224, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(94, 199, 232, 0.05) 0%, transparent 50%),
    var(--bg-void);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.4s;
}

#login-screen.active {
  display: flex;
  opacity: 1;
}

.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(74, 143, 224, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 143, 224, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  animation: gridDrift 60s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0; }
  to { background-position: 50px 50px; }
}

.login-container {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 60px;
  align-items: center;
  max-width: 900px;
  width: 90%;
  animation: loginSlideIn 0.6s var(--ease-snap);
}

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

.login-brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-seal {
  width: 140px;
  height: 140px;
  max-width: 140px;
  max-height: 140px;
  animation: sealPulse 4s ease-in-out infinite;
  flex-shrink: 0;
}

.login-seal img,
.login-seal svg {
  display: block;
  width: 140px;
  height: 140px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@keyframes sealPulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(74, 143, 224, 0.3)); }
  50% { filter: drop-shadow(0 0 35px rgba(74, 143, 224, 0.5)); }
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 44px;
  letter-spacing: 6px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  margin-top: 20px;
}

.login-brand .tagline {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 600;
}

.login-brand .description {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 12px;
  max-width: 360px;
}

.login-classification {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(196, 47, 61, 0.12);
  border: 1px solid rgba(196, 47, 61, 0.4);
  color: var(--classified-red);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  width: fit-content;
  margin-top: 20px;
}

.login-classification::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--classified-red);
  border-radius: 50%;
  animation: redBlink 1.5s ease-in-out infinite;
}

@keyframes redBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.login-card {
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-deep) 100%);
  border: 1px solid var(--border-default);
  padding: 40px 36px;
  position: relative;
  backdrop-filter: blur(10px);
}

.login-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
}

.login-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.login-card-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 3px;
  font-weight: 600;
}

.login-card-header .session-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.login-tab {
  flex: 1;
  padding: 10px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  border: none;
  position: relative;
  transition: color 0.2s;
}

.login-tab.active { color: var(--accent-cyan); }

.login-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-cyan);
}

.login-tab:hover:not(.active) { color: var(--text-secondary); }

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.2s, background 0.2s;
}

.form-input:focus {
  border-color: var(--accent-blue);
  background: var(--bg-surface);
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent-blue);
  color: white;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  margin-top: 8px;
}

.form-btn:hover {
  background: #5a9fed;
  box-shadow: 0 0 20px rgba(74, 143, 224, 0.4);
}

.form-btn:active {
  transform: scale(0.98);
}

.form-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.form-btn:hover::before { left: 100%; }

.form-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.form-error {
  background: rgba(232, 85, 99, 0.1);
  border-left: 2px solid var(--status-critical);
  color: var(--status-critical);
  padding: 10px 14px;
  font-size: 12px;
  font-family: var(--font-mono);
  margin-bottom: 16px;
  display: none;
}

.form-error.show { display: block; animation: shake 0.3s; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
  font-family: var(--font-mono);
}

.form-hint code {
  color: var(--accent-gold);
  background: rgba(212, 166, 69, 0.08);
  padding: 2px 6px;
  border-radius: 2px;
}

.login-footer {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.login-footer .dot-sep { margin: 0 10px; color: var(--text-dim); }
