/* =========================================================================
   Canary Demo Widget — "security ops" terminal overlay
   Deliberately looks nothing like the decoy site above it: monospace,
   near-black, neon accents — a visual cue that this layer is the "real"
   control panel and everything below it is the trap.
========================================================================= */

#canary-widget-root, #canary-widget-root * {
  box-sizing: border-box;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

#canary-widget-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  color: #d7e2ea;
  --cw-bg: #05070a;
  --cw-panel: #0a0e14;
  --cw-border: #1e2a38;
  --cw-green: #39ff88;
  --cw-green-dim: #1f8f52;
  --cw-red: #ff3b5c;
  --cw-amber: #ffb454;
  --cw-cyan: #39d9ff;
  --cw-text: #d7e2ea;
  --cw-text-dim: #64707d;
}

/* ---- Toggle button ---- */
.cw-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cw-bg);
  border: 1.5px solid var(--cw-green-dim);
  color: var(--cw-green);
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 0 0 1px #000, 0 6px 24px rgba(0,0,0,0.55), 0 0 18px -6px rgba(57,255,136,0.45);
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}
.cw-toggle:hover {
  border-color: var(--cw-green);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px #000, 0 8px 28px rgba(0,0,0,0.6), 0 0 26px -4px rgba(57,255,136,0.65);
}
.cw-toggle.cw-flash {
  animation: cw-alert-flash 1.1s ease-out;
}
@keyframes cw-alert-flash {
  0%   { border-color: var(--cw-red); box-shadow: 0 0 0 1px #000, 0 0 0 4px rgba(255,59,92,0.35), 0 0 30px -2px rgba(255,59,92,0.85); transform: scale(1.04); }
  100% { border-color: var(--cw-green-dim); box-shadow: 0 0 0 1px #000, 0 6px 24px rgba(0,0,0,0.55), 0 0 18px -6px rgba(57,255,136,0.45); transform: scale(1); }
}
.cw-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cw-green);
  box-shadow: 0 0 6px 1px rgba(57,255,136,0.9);
  animation: cw-led-pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes cw-led-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.cw-toggle-label { display: flex; flex-direction: column; line-height: 1.15; }
.cw-toggle-label b { font-size: 12.5px; }
.cw-toggle-label span { font-size: 9px; color: var(--cw-text-dim); font-weight: 500; letter-spacing: 0.08em; }
.cw-toggle-badge {
  background: var(--cw-green-dim);
  color: #04140a;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---- Panel ---- */
.cw-panel {
  display: none;
  position: absolute;
  top: 56px;
  right: 0;
  width: 430px;
  max-width: calc(100vw - 24px);
  max-height: min(82vh, 680px);
  background: var(--cw-panel);
  border: 1.5px solid var(--cw-border);
  border-radius: 10px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.6), 0 0 0 1px #000;
  overflow: hidden;
  flex-direction: column;
}
.cw-panel.active { display: flex; }

/* Terminal window chrome */
.cw-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #0d1219;
  border-bottom: 1px solid var(--cw-border);
  flex-shrink: 0;
}
.cw-dot3 { width: 10px; height: 10px; border-radius: 50%; }
.cw-dot3.r { background: #ff5f56; }
.cw-dot3.y { background: #ffbd2e; }
.cw-dot3.g { background: #27c93f; }
.cw-titlebar-text {
  margin-left: 4px;
  font-size: 11px;
  color: var(--cw-text-dim);
}

.cw-panel-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--cw-border);
}
.cw-panel-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--cw-green);
  margin-bottom: 4px;
}
.cw-panel-header p {
  font-size: 11px;
  color: var(--cw-text-dim);
  line-height: 1.55;
}

.cw-tabs {
  display: flex;
  border-bottom: 1px solid var(--cw-border);
  flex-shrink: 0;
  background: #080b10;
}
.cw-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--cw-text-dim);
  font-size: 11px;
  font-weight: 700;
  padding: 10px 4px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.cw-tab:hover { color: var(--cw-text); }
.cw-tab.active {
  color: var(--cw-green);
  border-bottom-color: var(--cw-green);
}

.cw-body {
  padding: 14px 16px 16px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.6;
}
.cw-view { display: none; }
.cw-view.active { display: block; }

/* ---- Intro tab ---- */
.cw-intro p { color: var(--cw-text); margin-bottom: 10px; }
.cw-intro strong { color: var(--cw-green); }
.cw-technique-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.cw-technique-list li {
  display: flex;
  gap: 8px;
  background: #0d1219;
  border: 1px solid var(--cw-border);
  border-left: 3px solid var(--cw-cyan);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--cw-text);
  font-size: 11.5px;
}
.cw-disclaimer {
  margin-top: 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--cw-amber);
  background: #241a0655;
  color: var(--cw-amber);
  font-size: 11px;
  border-radius: 0 6px 6px 0;
}

/* ---- Stats row (shared) ---- */
.cw-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.cw-stat {
  background: #0d1219;
  border: 1px solid var(--cw-border);
  border-radius: 6px;
  padding: 8px 6px;
  text-align: center;
}
.cw-stat-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--cw-green);
  font-variant-numeric: tabular-nums;
}
.cw-stat-label {
  font-size: 9.5px;
  color: var(--cw-text-dim);
  margin-top: 2px;
  letter-spacing: 0.03em;
}

/* ---- Live log tab: real terminal feed ---- */
.cw-terminal {
  background: #000;
  border: 1px solid var(--cw-border);
  border-radius: 6px;
  padding: 10px 12px;
  max-height: 320px;
  overflow-y: auto;
  font-size: 11px;
}
.cw-log-empty {
  color: var(--cw-text-dim);
  padding: 20px 4px;
  text-align: center;
}
.cw-log-line {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: 3px;
}
.cw-log-line .t { color: var(--cw-text-dim); flex-shrink: 0; }
.cw-log-line .icon { flex-shrink: 0; }
.cw-log-line .path { color: var(--cw-red); }
.cw-log-line.type-aws_credentials .path { color: var(--cw-amber); }
.cw-log-line.type-qr_scan .path { color: var(--cw-cyan); }
.cw-log-line.type-login_attempt .path { color: var(--cw-green); }
.cw-log-line .ip { color: var(--cw-text-dim); margin-left: auto; flex-shrink: 0; }
.cw-log-line.cw-new {
  animation: cw-line-in 1.6s ease-out;
}
@keyframes cw-line-in {
  0%   { background: rgba(255,59,92,0.28); transform: translateX(-2px); }
  100% { background: rgba(255,59,92,0); transform: translateX(0); }
}
.cw-cursor-line {
  color: var(--cw-green);
  margin-top: 4px;
}
.cw-cursor-line .blink {
  display: inline-block;
  width: 7px;
  height: 12px;
  background: var(--cw-green);
  margin-left: 2px;
  vertical-align: middle;
  animation: cw-blink 1s steps(1) infinite;
}
@keyframes cw-blink { 50% { opacity: 0; } }

/* ---- Map tab: literal directory tree ---- */
.cw-tree-root {
  font-size: 11.5px;
  color: var(--cw-text);
}
.cw-tree-hint { color: var(--cw-text-dim); font-size: 11px; margin-bottom: 10px; }
.cw-tree-node { margin: 0; }
.cw-tree-node > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px;
  border-radius: 5px;
  user-select: none;
}
.cw-tree-node > summary::-webkit-details-marker { display: none; }
.cw-tree-node > summary:hover { background: #0d1219; }
.cw-tree-node > summary::before {
  content: '▸';
  color: var(--cw-text-dim);
  font-size: 9px;
  transition: transform 0.15s;
  width: 10px;
}
.cw-tree-node[open] > summary::before { transform: rotate(90deg); }
.cw-tree-folder-name { font-weight: 700; color: var(--cw-cyan); }
.cw-tree-node.found > summary .cw-tree-folder-name { color: var(--cw-green); }
.cw-tree-kind {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--cw-border);
  color: var(--cw-text-dim);
}
.cw-tree-kind-honeytoken {
  color: var(--cw-amber);
  border-color: #6b4d10;
  background: rgba(255,180,84,0.1);
}
.cw-tree-kind-redirect {
  color: var(--cw-cyan);
  border-color: #0f5468;
  background: rgba(57,217,255,0.08);
}
.cw-tree-count {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--cw-text-dim);
  background: #0d1219;
  border: 1px solid var(--cw-border);
  padding: 1px 6px;
  border-radius: 999px;
}
.cw-tree-node.found .cw-tree-count { color: var(--cw-green); border-color: var(--cw-green-dim); }
.cw-tree-desc {
  font-size: 10px;
  color: var(--cw-text-dim);
  padding: 0 6px 6px 22px;
  line-height: 1.5;
}
.cw-tree-children {
  margin-left: 14px;
  padding-left: 10px;
  border-left: 1px dashed var(--cw-border);
}
.cw-tree-file {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--cw-text-dim);
  opacity: 0.65;
}
.cw-tree-file.found {
  color: var(--cw-green);
  opacity: 1;
  background: #0a1a10;
}
.cw-tree-file .glyph { flex-shrink: 0; }
.cw-tree-file .fpath { font-family: inherit; word-break: break-all; }
.cw-tree-file .ftime {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--cw-green-dim);
  flex-shrink: 0;
}

/* ---- Try-it tab: personal email alerts ---- */
.cw-subscribe {
  background: #0d1219;
  border: 1px solid var(--cw-border);
  border-radius: 6px;
  padding: 10px 11px;
  margin-bottom: 12px;
}
.cw-subscribe-label { font-size: 11.5px; font-weight: 700; color: var(--cw-text); margin-bottom: 4px; }
.cw-subscribe-hint { font-size: 10.5px; color: var(--cw-text-dim); line-height: 1.5; margin-bottom: 8px; }
.cw-subscribe-row { display: flex; gap: 6px; }
.cw-subscribe-input {
  flex: 1;
  min-width: 0;
  background: var(--cw-bg);
  border: 1px solid var(--cw-border);
  color: var(--cw-text);
  padding: 7px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-family: inherit;
}
.cw-subscribe-input:focus { outline: none; border-color: var(--cw-cyan); }
.cw-subscribe-btn {
  display: inline-block;
  flex-shrink: 0;
  background: var(--cw-green-dim);
  border: 1px solid var(--cw-green-dim);
  color: #05130b;
  padding: 7px 12px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cw-subscribe-btn:hover:not(:disabled) { background: var(--cw-green); border-color: var(--cw-green); }
.cw-subscribe-btn:disabled { opacity: 0.6; cursor: default; }
.cw-subscribe-status {
  display: none;
  font-size: 10.5px;
  margin-top: 7px;
  color: var(--cw-text-dim);
}
.cw-subscribe-status.show { display: block; }
.cw-subscribe-status.ok { color: var(--cw-green); }
.cw-subscribe-status.err { color: var(--cw-red); }

/* ---- Try-it tab: cinematic simulation ---- */
.cw-try-item {
  margin-bottom: 8px;
}
.cw-try-btn {
  width: 100%;
  text-align: left;
  background: #0d1219;
  border: 1px solid var(--cw-border);
  color: var(--cw-text);
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.cw-try-btn:hover:not(:disabled) { border-color: var(--cw-cyan); background: #0f1620; }
.cw-try-btn:disabled { opacity: 0.6; cursor: default; }
.cw-try-btn small { color: var(--cw-text-dim); font-weight: 400; }

.cw-sim {
  margin-top: 10px;
  background: #000;
  border: 1px solid var(--cw-border);
  border-radius: 6px;
  padding: 12px;
  font-size: 11px;
  display: none;
}
.cw-sim.show { display: block; }
.cw-sim-cmd { color: var(--cw-cyan); white-space: pre-wrap; word-break: break-all; }
.cw-sim-cmd .prompt { color: var(--cw-green); }
.cw-sim-caret {
  display: inline-block;
  width: 6px; height: 11px;
  background: var(--cw-cyan);
  vertical-align: middle;
  animation: cw-blink 0.9s steps(1) infinite;
}
.cw-sim-status {
  margin-top: 8px;
  color: var(--cw-text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 16px;
}
.cw-spinner {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--cw-border);
  border-top-color: var(--cw-cyan);
  animation: cw-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes cw-spin { to { transform: rotate(360deg); } }
.cw-sim-alert {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid var(--cw-red);
  background: rgba(255,59,92,0.12);
  color: var(--cw-red);
  font-weight: 800;
  font-size: 11.5px;
  display: none;
  align-items: center;
  gap: 7px;
}
.cw-sim-alert.show {
  display: flex;
  animation: cw-alert-in 0.4s ease-out;
}
@keyframes cw-alert-in {
  0% { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}
.cw-sim-result {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--cw-border);
  color: var(--cw-text);
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 10.5px;
  line-height: 1.7;
  display: none;
}
.cw-sim-result.show { display: block; animation: cw-alert-in 0.35s ease-out; }
.cw-sim-result .k { color: var(--cw-text-dim); }
.cw-sim-result .v { color: var(--cw-amber); }

.cw-panel-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--cw-border);
  font-size: 9.5px;
  color: var(--cw-text-dim);
  text-align: center;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  #canary-widget-root { top: 10px; right: 10px; }
  .cw-panel { width: calc(100vw - 20px); }
}
