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

:root {
  --bg: #0f0f0f;
  --bg2: #171717;
  --bg3: #1f1f1f;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #f0f0f0;
  --text2: #888;
  --text3: #555;
  --accent: #5B8DEF;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 10px;
  --radius-lg: 14px;
}

html, body { height: 100%; }

body {
  font-family: 'Syne', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* Layout */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2rem;
  padding-left: 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--text2);
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--bg3); color: var(--text); }

.sidebar-footer {
  font-size: 11px;
  color: var(--text3);
  padding-top: 1rem;
  border-top: 0.5px solid var(--border);
  font-family: 'IBM Plex Mono', monospace;
}

/* Main */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 2.5rem 3rem;
}

/* Search area */
.search-area {
  max-width: 600px;
  margin: 8vh auto 0;
  text-align: center;
}

.search-hero h1 {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -1px;
}

.search-hero h1 span {
  color: var(--text2);
}

.search-hero p {
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 1rem;
}

.search-box input {
  width: 100%;
  height: 48px;
  padding: 0 1.25rem;
  background: var(--bg2);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus { border-color: var(--accent); }

.search-box button {
  width: 100%;
  height: 48px;
  padding: 0 1.5rem;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.search-box button:hover { opacity: 0.85; }
.search-box button:disabled { opacity: 0.4; cursor: not-allowed; }

.search-examples {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 13px;
  color: var(--text3);
}

.search-examples button {
  background: none;
  border: 0.5px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.search-examples button:hover { border-color: var(--border2); color: var(--text); }

/* Status / Error */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 13px;
  color: var(--text2);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.error-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(248,113,113,0.08);
  border: 0.5px solid rgba(248,113,113,0.2);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 13px;
  color: var(--red);
}

.error-bar button {
  margin-left: auto;
  background: none;
  border: 0.5px solid var(--red);
  color: var(--red);
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* Results */
.results { max-width: 900px; }

.company-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.company-logo {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: var(--bg3);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  flex-shrink: 0;
}

.company-info { flex: 1; }
.company-info h2 { font-size: 20px; font-weight: 700; margin-bottom: 3px; }
.company-info p { font-size: 13px; color: var(--text2); margin-bottom: 8px; }

.company-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  border: 0.5px solid var(--border2);
  color: var(--text2);
  font-family: 'IBM Plex Mono', monospace;
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0.5px solid var(--border);
  color: var(--text2);
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.reset-btn:hover { border-color: var(--border2); color: var(--text); }

/* Panels */
.panel { display: none; }
.panel.active { display: block; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.panel-header h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.site-link-btn {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  border: 0.5px solid rgba(91,141,239,0.3);
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}

.site-link-btn:hover { background: rgba(91,141,239,0.1); }

/* Competitors */
.competitors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.competitor-card {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  transition: border-color 0.15s;
}

.competitor-card:hover { border-color: var(--border2); }

.comp-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.comp-logo {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--bg3);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  flex-shrink: 0;
}

.comp-name { font-size: 15px; font-weight: 500; }
.comp-type { font-size: 11px; color: var(--text3); }

.comp-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
  margin-bottom: 12px;
}

.threat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.threat-label { font-size: 11px; color: var(--text3); min-width: 50px; }

.bar-track {
  flex: 1;
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.7s ease;
}

.bar-fill.high { background: var(--red); }
.bar-fill.med { background: var(--amber); }
.bar-fill.low { background: var(--green); }

.bar-pct {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text2);
  min-width: 28px;
  text-align: right;
}

/* Positioning map */
.map-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.axis-label {
  position: absolute;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text3);
  z-index: 2;
}

.axis-top    { top: -18px; left: 50%; transform: translateX(-50%); }
.axis-bottom { bottom: -18px; left: 50%; transform: translateX(-50%); }
.axis-left   { top: 50%; left: -6px; transform: translateY(-50%) rotate(-90deg); transform-origin: center; }
.axis-right  { top: 50%; right: -50px; transform: translateY(-50%); }

.pos-map {
  position: relative;
  width: 100%;
  height: 360px;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 20px 0;
}

.axis-h {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 0.5px;
  background: var(--border2);
}

.axis-v {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 0.5px;
  background: var(--border2);
}

.pos-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: default;
}

.node-circle {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: white;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 0 1px var(--node-color, #5B8DEF);
}

.node-label {
  font-size: 10px;
  font-weight: 500;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  color: var(--text);
}

.positioning-text {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

/* Browser / Screenshot */
.browser-frame {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg3);
  border-bottom: 0.5px solid var(--border);
}

.browser-dots {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.browser-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: block;
}

.browser-url {
  flex: 1;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screenshot-wrap {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screenshot-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text2);
  font-size: 13px;
  padding: 3rem;
}

.loading-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.screenshot-img {
  width: 100%;
  display: block;
  border-bottom: 0.5px solid var(--border);
}

.site-metrics {
  padding: 1.25rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 1rem;
}

.metric-card {
  background: var(--bg3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.metric-label {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 5px;
  font-family: 'IBM Plex Mono', monospace;
}

.metric-value {
  font-size: 14px;
  font-weight: 500;
}

.metric-value.good { color: var(--green); }
.metric-value.warn { color: var(--amber); }
.metric-value.bad  { color: var(--red); }
.metric-value.info { color: var(--accent); }

.site-summary {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
}

/* SWOT */
.swot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.swot-card {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 0.5px solid;
}

.swot-card h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.swot-card ul {
  list-style: none;
  font-size: 13px;
  line-height: 1.65;
}

.swot-card ul li::before { content: "→ "; opacity: 0.5; }

.swot-s { background: rgba(74,222,128,0.06); border-color: rgba(74,222,128,0.2); }
.swot-s h4 { color: var(--green); }
.swot-w { background: rgba(248,113,113,0.06); border-color: rgba(248,113,113,0.2); }
.swot-w h4 { color: var(--red); }
.swot-o { background: rgba(91,141,239,0.06); border-color: rgba(91,141,239,0.2); }
.swot-o h4 { color: var(--accent); }
.swot-t { background: rgba(251,191,36,0.06); border-color: rgba(251,191,36,0.2); }
.swot-t h4 { color: var(--amber); }

.swot-card ul li { color: var(--text2); }

/* Spinner */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
