/* OSINT Platform — Starfire Design System */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&display=swap');

:root {
  --orange: #ff6f1f;
  --orange-bright: #ff9a1f;
  --violet: #a855f7;
  --violet-deep: #7c3aed;
  --magenta: #ff2daa;
  --green: #39ff14;
  --bg: #0a0818;
  --bg2: #120e24;
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: #e5e7eb;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  min-height: 100vh;
}

/* ── Particles canvas ── */
#particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Nebula background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(168, 85, 247, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 70%, rgba(255, 111, 31, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 80% 30%, rgba(255, 45, 170, 0.04) 0%, transparent 60%);
  z-index: 0;
  animation: nebulaPulse 10s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes nebulaPulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ── Layout shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
nav#sidebar {
  width: 220px;
  flex-shrink: 0;
  background: rgba(18, 14, 36, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(168, 85, 247, 0.15);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}

nav#sidebar.hidden {
  display: none;
}

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid rgba(168, 85, 247, 0.15);
}

.sidebar-logo h1 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, var(--orange-bright), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.sidebar-logo p {
  font-size: 0.65rem;
  color: rgba(168, 85, 247, 0.5);
  margin: 4px 0 0;
  letter-spacing: 0.08em;
}

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

/* ── Nav links ── */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: rgba(229, 231, 235, 0.6);
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}

.nav-link:hover {
  color: var(--orange-bright);
  background: rgba(255, 111, 31, 0.08);
}

.nav-link.active {
  color: var(--orange-bright);
  background: rgba(255, 111, 31, 0.12);
  border-left: 2px solid var(--orange);
  padding-left: 12px;
}

.nav-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(168, 85, 247, 0.15);
}

.sidebar-footer .label {
  font-size: 0.6rem;
  color: rgba(168, 85, 247, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

#sidebar-user {
  color: var(--violet);
  font-size: 0.78rem;
  font-weight: 700;
}

#logout-btn {
  margin-top: 10px;
  font-size: 0.65rem;
  color: rgba(229, 231, 235, 0.35);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
  padding: 0;
  font-family: inherit;
}

#logout-btn:hover {
  color: #f87171;
}

/* ── Main content ── */
main#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: auto;
}

main#main-content.hidden {
  display: none;
}

/* ── Header ── */
.app-header {
  background: rgba(18, 14, 36, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(168, 85, 247, 0.15);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(229, 231, 235, 0.5);
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#clock {
  font-size: 0.65rem;
  color: rgba(229, 231, 235, 0.3);
  font-family: monospace;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  color: var(--green);
  letter-spacing: 0.08em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--green); }
  50% { opacity: 0.5; box-shadow: 0 0 3px var(--green); }
}

/* ── Page content ── */
.page-content {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Section titles ── */
.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--orange), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

/* ── Stat cards grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Card ── */
.card {
  background: rgba(168, 85, 247, 0.05);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.07);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: rgba(255, 111, 31, 0.4);
  box-shadow: 0 0 25px rgba(255, 111, 31, 0.12);
}

.stat-card {
  composes: card;
}

.stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(168, 85, 247, 0.7);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 20px rgba(57, 255, 20, 0.4);
  line-height: 1;
}

.stat-value.warning {
  color: var(--orange-bright);
  text-shadow: 0 0 20px rgba(255, 154, 31, 0.4);
}

.stat-value.critical {
  color: #f87171;
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.4);
}

.stat-detail {
  font-size: 0.6rem;
  color: rgba(229, 231, 235, 0.3);
  margin-top: 4px;
}

/* ── Progress bar ── */
.progress-track {
  height: 3px;
  background: rgba(168, 85, 247, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--violet-deep), var(--violet));
  transition: width 0.7s ease;
}

.progress-fill.warning {
  background: linear-gradient(90deg, var(--orange), var(--orange-bright));
}

.progress-fill.critical {
  background: linear-gradient(90deg, #b91c1c, #f87171);
}

/* ── Charts row ── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 900px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}

/* ── Services grid ── */
#services-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.service-item {
  background: rgba(18, 14, 36, 0.6);
  border: 1px solid rgba(168, 85, 247, 0.12);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.service-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
}

.service-dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.service-dot.warn { background: var(--orange-bright); box-shadow: 0 0 6px var(--orange-bright); }
.service-dot.err { background: #f87171; box-shadow: 0 0 6px #f87171; }

.service-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(229, 231, 235, 0.8);
}

.service-status {
  font-size: 0.6rem;
  margin-top: 2px;
}

.service-status.ok { color: var(--green); }
.service-status.warn { color: var(--orange-bright); }
.service-status.err { color: #f87171; }

/* ── Log table ── */
.log-table-wrap {
  overflow-x: auto;
}

.log-table {
  width: 100%;
  font-size: 0.7rem;
  border-collapse: collapse;
}

.log-table thead tr {
  border-bottom: 1px solid rgba(168, 85, 247, 0.2);
}

.log-table th {
  padding: 0 0 8px;
  color: rgba(168, 85, 247, 0.6);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.6rem;
}

.log-table th:last-child,
.log-table td:last-child {
  text-align: right;
}

#log-rows tr {
  border-bottom: 1px solid rgba(168, 85, 247, 0.06);
  transition: background 0.15s;
}

#log-rows tr:hover {
  background: rgba(168, 85, 247, 0.06);
}

#log-rows td {
  padding: 7px 0;
  vertical-align: middle;
}

/* ── Login overlay ── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

#login-overlay.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: rgba(18, 14, 36, 0.9);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 12px;
  padding: 36px;
  box-shadow:
    0 0 40px rgba(168, 85, 247, 0.12),
    0 0 80px rgba(255, 111, 31, 0.06);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, var(--orange-bright), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 0 6px;
}

.login-logo p {
  font-size: 0.65rem;
  color: rgba(168, 85, 247, 0.5);
  letter-spacing: 0.1em;
}

/* ── Form elements ── */
.form-field {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(168, 85, 247, 0.7);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 6px;
  padding: 9px 12px;
  color: #e5e7eb;
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 12px rgba(255, 111, 31, 0.15);
}

.form-input::placeholder {
  color: rgba(229, 231, 235, 0.2);
}

/* Tool inputs inherit same style */
.tool-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 6px;
  padding: 8px 12px;
  color: #e5e7eb;
  font-size: 0.78rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  flex: 1;
}

.tool-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 10px rgba(255, 111, 31, 0.12);
}

.tool-input::placeholder {
  color: rgba(229, 231, 235, 0.2);
}

/* File input */
input[type="file"].tool-input {
  padding: 6px 10px;
}

/* Select */
select.tool-input,
select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 6px;
  padding: 8px 12px;
  color: #e5e7eb;
  font-size: 0.78rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
}

select:focus {
  border-color: var(--orange);
}

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--magenta));
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn-primary:hover {
  box-shadow: 0 0 20px rgba(255, 111, 31, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Tool run button */
.tool-run-btn {
  background: linear-gradient(135deg, var(--orange), var(--magenta));
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-family: inherit;
  cursor: pointer;
  transition: box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-run-btn:hover {
  box-shadow: 0 0 16px rgba(255, 111, 31, 0.35);
}

.tool-card.loading .tool-run-btn {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Category badges / tags ── */
.badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(168, 85, 247, 0.12);
  color: var(--violet);
  border: 1px solid rgba(168, 85, 247, 0.25);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.badge-warn {
  background: rgba(255, 154, 31, 0.12);
  color: var(--orange-bright);
  border-color: rgba(255, 154, 31, 0.25);
}

.badge-ok {
  background: rgba(57, 255, 20, 0.1);
  color: var(--green);
  border-color: rgba(57, 255, 20, 0.2);
}

/* ── Tool cards ── */
.tool-card {
  background: rgba(168, 85, 247, 0.04);
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-card:hover {
  border-color: rgba(255, 111, 31, 0.35);
  box-shadow: 0 0 24px rgba(255, 111, 31, 0.1);
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.tool-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--orange-bright);
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(255, 154, 31, 0.3);
}

.tool-description {
  font-size: 0.65rem;
  color: rgba(229, 231, 235, 0.4);
  margin-top: 3px;
}

.tool-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

/* ── Result block ── */
.tool-result {
  margin-top: 12px;
  border-radius: 6px;
  overflow: hidden;
}

.tool-result.hidden {
  display: none;
}

.tool-result pre {
  background: var(--bg2);
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: 6px;
  padding: 14px;
  font-size: 0.68rem;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--violet);
  max-height: 340px;
  overflow-y: auto;
}

/* ── Category section headers ── */
.category-header {
  margin-bottom: 14px;
  margin-top: 24px;
}

.category-header:first-child {
  margin-top: 0;
}

.category-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--orange), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(168, 85, 247, 0.2);
}

/* ── Tools grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}

@media (max-width: 960px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Username result grid ── */
.username-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.username-result-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(18, 14, 36, 0.6);
  border: 1px solid rgba(168, 85, 247, 0.12);
  font-size: 0.68rem;
  transition: border-color 0.15s;
}

.username-result-item.found {
  border-color: rgba(255, 111, 31, 0.3);
  background: rgba(255, 111, 31, 0.06);
}

.username-result-item.found .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 6px var(--orange);
  flex-shrink: 0;
}

.username-result-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.2);
  flex-shrink: 0;
}

/* ── Security header badges ── */
.header-present { color: var(--green); }
.header-missing { color: #f87171; }

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(18, 14, 36, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--orange);
}

/* ── Canvas chart ── */
canvas {
  width: 100% !important;
}

/* ── Loading spinner ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(168, 85, 247, 0.2);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Export button ── */
.export-btn {
  font-size: 0.65rem;
  color: rgba(168, 85, 247, 0.5);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(168, 85, 247, 0.2);
  background: none;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.export-btn:hover {
  color: var(--orange-bright);
  border-color: rgba(255, 111, 31, 0.35);
}

/* ── Error / warning notice ── */
.notice-warn {
  font-size: 0.7rem;
  color: var(--orange-bright);
  background: rgba(255, 111, 31, 0.08);
  border: 1px solid rgba(255, 111, 31, 0.2);
  border-radius: 5px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.notice-err {
  font-size: 0.7rem;
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 5px;
  padding: 8px 12px;
}

/* ── Misc ── */
.text-orange { color: var(--orange-bright); }
.text-violet { color: var(--violet); }
.text-green  { color: var(--green); }
.text-muted  { color: rgba(229, 231, 235, 0.35); }
.text-dim    { color: rgba(229, 231, 235, 0.55); }

[title] { cursor: help; }

details summary {
  color: rgba(168, 85, 247, 0.5);
  font-size: 0.68rem;
  cursor: pointer;
  user-select: none;
}

details summary:hover {
  color: var(--orange-bright);
}
