/* =============================================================================
   SPAM NUKE — DESIGN TOKENS & BASE STYLES
   theme.css — v2.0 — Tactical Operations Console
   Contains: CSS custom properties, reset, typography, scrollbars,
             utility classes, keyframe animations, and atmospheric effects.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   1. DESIGN TOKENS
   --------------------------------------------------------------------------- */

:root {
  /* Backgrounds — deeper, more layered */
  --bg:        #06080c;
  --surface-1: #0b0e14;
  --surface-2: #10141c;
  --surface-3: #161b28;

  /* Borders */
  --border:   #1a1f30;
  --border-2: #252c42;

  /* Red — delete / danger / primary accent */
  --red:       #ff2d2d;
  --red-dim:   #ff2d2d18;
  --red-glow:  #ff2d2d55;
  --red-hot:   #ff4444;

  /* Green — inbox / safe / success */
  --green:      #00e6b4;
  --green-dim:  #00e6b416;
  --green-glow: #00e6b440;

  /* Amber — promotions / warnings */
  --amber:      #ffb020;
  --amber-dim:  #ffb02016;
  --amber-glow: #ffb02040;

  /* Muted — newsletters / secondary */
  --muted:      #7080a8;
  --muted-dim:  #7080a816;
  --muted-glow: #7080a840;

  /* Cyan — informational / active / new */
  --cyan:      #00c8f0;
  --cyan-dim:  #00c8f016;
  --cyan-glow: #00c8f040;

  /* Text */
  --text:   #e8eaf2;
  --text-2: #98a0bc;
  --text-3: #505878;

  /* Typography — Rajdhani: geometric, tactical, distinctive */
  --font-head: 'Rajdhani', sans-serif;
  --font-body: 'JetBrains Mono', monospace;

  /* Spacing (8px grid) */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;
  --sp-6: 48px;

  /* Border radius */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* Safe area insets */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Bottom nav geometry */
  --nav-base-h: 56px;
  --nav-safe-effective: 0px;
  --nav-offset: calc(var(--nav-base-h) + var(--nav-safe-effective));
}


/* ---------------------------------------------------------------------------
   2. RESET
   --------------------------------------------------------------------------- */

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


/* ---------------------------------------------------------------------------
   3. BASE / TYPOGRAPHY
   --------------------------------------------------------------------------- */

html, body {
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* ---------------------------------------------------------------------------
   4. ATMOSPHERIC OVERLAYS
   Noise grain + subtle scan lines for CRT tactical feel.
   --------------------------------------------------------------------------- */

/* Noise grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Subtle horizontal scan lines */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.018;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(255, 255, 255, 0.03) 4px
  );
}


/* ---------------------------------------------------------------------------
   5. SCROLLBAR HIDING
   --------------------------------------------------------------------------- */

::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; -ms-overflow-style: none; }


/* ---------------------------------------------------------------------------
   6. KEYFRAMES
   --------------------------------------------------------------------------- */

/* Status indicator pulse */
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* Progress bar sweeping glow */
@keyframes prog-glow {
  0%   { left: -40px; }
  100% { left: 100%; }
}

/* Loading spinner */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Modal / bottom sheet entrance */
@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* Generic fade in */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Nuke button breathing pulse — more aggressive */
@keyframes nuke-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px var(--red-glow), 0 0 60px rgba(255,45,45,0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 0 30px var(--red-glow), 0 0 80px rgba(255,45,45,0.15), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }
}

/* Card staggered entrance */
@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* HUD bracket flash */
@keyframes bracket-flash {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* Threat indicator pulse for high-threat domains */
@keyframes threat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 6px 1px var(--red-glow); }
}

/* Counter roll up */
@keyframes count-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Glow sweep on header */
@keyframes header-sweep {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Login grid scroll */
@keyframes grid-scroll {
  from { transform: translateY(0); }
  to   { transform: translateY(40px); }
}

/* Subtle glow breathe for active elements */
@keyframes glow-breathe {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}


/* ---------------------------------------------------------------------------
   7. UTILITY CLASSES
   --------------------------------------------------------------------------- */

/* Glow shadows */
.glow-red   { box-shadow: 0 0 12px var(--red-glow); }
.glow-green { box-shadow: 0 0 12px var(--green-glow); }

/* Text colors */
.text-red   { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--muted); }
.text-cyan  { color: var(--cyan); }
.text-2     { color: var(--text-2); }
.text-3     { color: var(--text-3); }

/* Font families */
.font-head { font-family: var(--font-head); }

/* Text overflow */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Staggered card animation helper */
.card-anim {
  animation: card-enter 0.35s ease-out both;
}
.card-anim:nth-child(1) { animation-delay: 0s; }
.card-anim:nth-child(2) { animation-delay: 0.06s; }
.card-anim:nth-child(3) { animation-delay: 0.12s; }
.card-anim:nth-child(4) { animation-delay: 0.18s; }
.card-anim:nth-child(5) { animation-delay: 0.24s; }
.card-anim:nth-child(6) { animation-delay: 0.30s; }
.card-anim:nth-child(7) { animation-delay: 0.36s; }

/* ─── Qwen Suggestion Panel (per-domain detail sheet) ────────────────────── */
.qwen-suggestion {
  margin-top: 14px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
}
.qwen-suggestion.tier-high { border-left-color: var(--green); }
.qwen-suggestion.tier-med  { border-left-color: var(--cyan);  }
.qwen-suggestion.tier-low  { border-left-color: var(--amber); }

.qwen-suggestion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.qwen-suggestion-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.qwen-suggestion-confidence {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.5px;
}
.qwen-suggestion.tier-high .qwen-suggestion-confidence { color: var(--green); }
.qwen-suggestion.tier-med  .qwen-suggestion-confidence { color: var(--cyan);  }
.qwen-suggestion.tier-low  .qwen-suggestion-confidence { color: var(--amber); }

.qwen-suggestion-action {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.qwen-suggestion-action.sel-del   { color: var(--red);   }
.qwen-suggestion-action.sel-inbox { color: var(--green); }
.qwen-suggestion-action.sel-promo { color: var(--amber); }
.qwen-suggestion-action.sel-news  { color: var(--muted); }

.qwen-suggestion-reason {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
}
.qwen-suggestion-actions {
  display: flex;
  gap: 8px;
}

/* ─── Qwen Badge (per-card suggestion UI) ────────────────────────────────── */
.qwen-badge-wrap {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qwen-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 3px 8px 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left-width: 2px;
  border-radius: var(--radius-sm, 4px);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  max-width: 100%;
}
.qwen-chip.tier-high { border-left-color: var(--green); }
.qwen-chip.tier-med  { border-left-color: var(--cyan);  }
.qwen-chip.tier-low  { border-left-color: var(--amber); }

.qwen-chip-text {
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qwen-chip.tier-high .qwen-chip-text { color: var(--green); }
.qwen-chip.tier-med  .qwen-chip-text { color: var(--cyan);  }
.qwen-chip.tier-low  .qwen-chip-text { color: var(--amber); }

.qwen-actions {
  display: flex;
  gap: 8px;
}

.qwen-btn {
  appearance: none;
  flex: 1 1 50%;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm, 4px);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}

/* ACCEPT — color matches the rule it will write. Uses the same sel-*
   tokens the detail-sheet action grid uses so the preview is consistent. */
.qwen-accept.sel-del {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}
.qwen-accept.sel-inbox {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}
.qwen-accept.sel-promo {
  background: var(--amber-dim);
  border-color: var(--amber);
  color: var(--amber);
}
.qwen-accept.sel-news {
  background: var(--cyan-dim, rgba(0,180,216,0.10));
  border-color: var(--cyan);
  color: var(--cyan);
}
.qwen-accept:active { filter: brightness(1.15); }

.qwen-dismiss:active {
  border-color: var(--muted);
  color: var(--muted);
}
