/* pos-coin Intelligence Report — Dark Cybersecurity Theme */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #1c2128;
  --border: #30363d;
  --border-accent: #3b4048;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-red: #f85149;
  --accent-orange: #d29922;
  --accent-yellow: #e3b341;
  --accent-green: #3fb950;
  --accent-blue: #58a6ff;
  --accent-purple: #bc8cff;
  --accent-cyan: #39d2c0;
  --link: #58a6ff;
  --link-hover: #79c0ff;
  --code-bg: #161b22;
  --sidebar-width: 280px;
  --header-height: 52px;
  --banner-height: 36px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
}

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

html { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  height: 100%;
  overflow: hidden;
}

/* === HEADER === */
.header-back {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-secondary); text-decoration: none; font-size: 14px;
  flex-shrink: 0; transition: all 0.15s;
}
.header-back:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
#header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}
.header-brand { display: flex; align-items: center; gap: 8px; flex: 1; }
.brand-icon { font-size: 20px; }
.brand-text { font-weight: 600; font-size: 15px; color: var(--text-primary); }
.brand-sub { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
#search-btn {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: 6px;
  padding: 6px 10px; cursor: pointer; display: flex; align-items: center;
}
#search-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
#audience-select {
  background: var(--bg-tertiary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 8px; font-size: 13px; cursor: pointer;
}
#audience-select:focus { border-color: var(--accent-blue); outline: none; }

/* Menu toggle (mobile) */
#menu-toggle {
  display: none; background: none; border: none; cursor: pointer;
  width: 28px; height: 20px; position: relative; flex-shrink: 0;
}
#menu-toggle span {
  display: block; width: 100%; height: 2px; background: var(--text-secondary);
  position: absolute; left: 0; transition: all 0.2s;
}
#menu-toggle span:nth-child(1) { top: 0; }
#menu-toggle span:nth-child(2) { top: 9px; }
#menu-toggle span:nth-child(3) { top: 18px; }

/* === SIDEBAR === */
#sidebar {
  position: fixed; top: calc(var(--header-height) + var(--banner-height)); left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 0;
  z-index: 90;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.nav-section { padding: 0 16px; margin-bottom: 20px; }
.nav-section h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin-bottom: 8px; padding: 0 8px;
}
.nav-link {
  display: block; padding: 6px 12px; margin: 1px 0;
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; border-radius: 6px; transition: all 0.15s;
}
.nav-link:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-link.active { background: rgba(88, 166, 255, 0.1); color: var(--accent-blue); font-weight: 500; }
.nav-footer {
  padding: 16px 24px; margin-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted);
}
.nav-footer p { margin-bottom: 4px; }
.nav-section.hidden { display: none; }

/* === MAIN CONTENT === */
#content {
  position: fixed;
  top: calc(var(--header-height) + var(--banner-height));
  left: var(--sidebar-width);
  right: 0; bottom: 0;
  overflow-y: auto;
  padding: 32px 48px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#content-inner { max-width: 900px; }

/* === MARKDOWN CONTENT STYLES === */
#content-inner h1 { font-size: 28px; font-weight: 700; margin: 0 0 16px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
#content-inner h2 { font-size: 22px; font-weight: 600; margin: 32px 0 12px; color: var(--text-primary); }
#content-inner h3 { font-size: 17px; font-weight: 600; margin: 24px 0 8px; color: var(--text-primary); }
#content-inner h4 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; color: var(--text-secondary); }
#content-inner p { margin: 0 0 12px; color: var(--text-secondary); }
#content-inner a { color: var(--link); text-decoration: none; }
#content-inner a:hover { color: var(--link-hover); text-decoration: underline; }
#content-inner strong { color: var(--text-primary); }
#content-inner ul, #content-inner ol { margin: 0 0 12px; padding-left: 24px; color: var(--text-secondary); }
#content-inner li { margin-bottom: 4px; }
#content-inner hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
#content-inner blockquote {
  border-left: 3px solid var(--accent-blue);
  padding: 8px 16px; margin: 12px 0;
  background: rgba(88, 166, 255, 0.05);
  color: var(--text-secondary);
}

/* Tables */
#content-inner table {
  width: 100%; border-collapse: collapse; margin: 12px 0 20px;
  font-size: 13px;
}
#content-inner th {
  background: var(--bg-tertiary); padding: 8px 12px;
  text-align: left; font-weight: 600; font-size: 12px;
  border-bottom: 2px solid var(--border); color: var(--text-primary);
  position: sticky; top: 0;
}
#content-inner td {
  padding: 6px 12px; border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
#content-inner tr:hover td { background: rgba(255,255,255,0.02); }

/* Code blocks */
#content-inner code {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--code-bg); padding: 2px 6px;
  border-radius: 4px; color: var(--accent-cyan);
}
#content-inner pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; margin: 12px 0 16px;
  overflow-x: auto; position: relative;
  font-size: 12px; line-height: 1.5;
}
#content-inner pre code {
  background: none; padding: 0; color: var(--text-secondary);
}

/* Copy button on code blocks */
.code-copy {
  position: absolute; top: 8px; right: 8px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 4px;
  padding: 4px 8px; font-size: 11px; cursor: pointer;
  opacity: 0; transition: opacity 0.2s;
}
pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--text-primary); border-color: var(--accent-blue); }

/* Severity badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-critical { background: rgba(248,81,73,0.15); color: var(--accent-red); border: 1px solid rgba(248,81,73,0.3); }
.badge-high { background: rgba(210,153,34,0.15); color: var(--accent-orange); border: 1px solid rgba(210,153,34,0.3); }
.badge-medium { background: rgba(227,179,65,0.15); color: var(--accent-yellow); border: 1px solid rgba(227,179,65,0.3); }
.badge-low { background: rgba(63,185,80,0.15); color: var(--accent-green); border: 1px solid rgba(63,185,80,0.3); }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 20px 0; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; text-align: center;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--accent-red); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Alert boxes */
.alert {
  border-radius: 8px; padding: 16px; margin: 16px 0;
  display: flex; gap: 12px; align-items: flex-start;
}
.alert-danger { background: rgba(248,81,73,0.08); border: 1px solid rgba(248,81,73,0.3); }
.alert-warning { background: rgba(210,153,34,0.08); border: 1px solid rgba(210,153,34,0.3); }
.alert-info { background: rgba(88,166,255,0.08); border: 1px solid rgba(88,166,255,0.3); }
.alert-success { background: rgba(63,185,80,0.08); border: 1px solid rgba(63,185,80,0.3); }
.alert-icon { font-size: 20px; flex-shrink: 0; }
.alert-content { flex: 1; }
.alert-content h4 { margin: 0 0 4px; font-size: 14px; }
.alert-content p { margin: 0; font-size: 13px; }

/* Blockchain address styling */
.addr {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--accent-purple); cursor: pointer;
  text-decoration: none;
}
.addr:hover { color: var(--accent-blue); text-decoration: underline; }

/* Download button */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid; text-decoration: none;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.btn-primary:hover { background: #4090e0; text-decoration: none; }
.btn-outline { background: transparent; color: var(--accent-blue); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent-blue); background: rgba(88,166,255,0.08); text-decoration: none; }
.btn-danger { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }
.btn-danger:hover { background: #d63d35; text-decoration: none; }

/* === SEARCH MODAL === */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 15vh; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-content {
  position: relative; width: 560px; max-width: 90vw;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
#search-input {
  width: 100%; padding: 16px 20px;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text-primary); font-size: 16px; outline: none;
  font-family: var(--font-sans);
}
#search-input::placeholder { color: var(--text-muted); }
#search-results { max-height: 400px; overflow-y: auto; }
#search-results .result-item {
  display: block; padding: 10px 20px;
  color: var(--text-secondary); text-decoration: none;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
#search-results .result-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
#search-results .result-item .result-title { font-weight: 600; font-size: 14px; color: var(--text-primary); }
#search-results .result-item .result-excerpt { font-size: 12px; margin-top: 2px; }
#search-results mark { background: rgba(88,166,255,0.3); color: var(--text-primary); border-radius: 2px; }
.search-hint { padding: 8px 20px; font-size: 11px; color: var(--text-muted); text-align: center; }

/* === TOAST === */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--accent-green); color: #000;
  padding: 10px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  z-index: 300; transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.toast.hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  #menu-toggle { display: block; }
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    width: 260px;
  }
  #sidebar.open { transform: translateX(0); }
  #content { left: 0; padding: 24px 20px; }
  .brand-sub { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  #content-inner table { font-size: 11px; }
  #content-inner th, #content-inner td { padding: 4px 6px; }
}

/* Print styles */
@media print {
  #header, #sidebar, .code-copy, #search-modal, .toast, #audience-select { display: none !important; }
  #content { position: static; padding: 0; }
  body { background: #fff; color: #000; overflow: visible; }
  #content-inner { max-width: 100%; }
  #content-inner pre { border-color: #ccc; }
  #content-inner code { color: #333; }
}
