/* =====================================================================
   Tiloscope — shared design system
   Colors derived from the app's cluster visualization palette
   ===================================================================== */

:root {
  --bg:          #0f1117;
  --surface:     #1a1d27;
  --surface2:    #222538;

  --amber:       rgba(0, 206, 0, 0.9);
  --amber-solid: #00CE00;
  --sky:         rgba(56, 189, 248, 0.80);
  --sky-solid:   #38bdf8;
  --green:       rgba(134, 239, 172, 0.55);
  --green-solid: #86efac;

  --text:        #e5e7eb;
  --muted:       #9ca3af;
  --border:      rgba(255, 255, 255, 0.08);

  --radius:      6px;
  --radius-lg:   12px;
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

a { color: var(--sky-solid); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--text); }

/* ── Nav ────────────────────────────────────────────────────────────── */
.site-nav {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  text-decoration: none;
  transition: color .15s;
}
.nav-logo:hover { color: var(--amber-solid); text-decoration: none; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links a {
  font-size: .875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--amber-solid); }
.nav-user {
  font-size: .8rem;
  color: var(--muted);
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: auto;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .625rem;
  text-align: center;
}
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { font-size: .8125rem; color: var(--muted); transition: color .15s; }
.footer-links a:hover { color: var(--text); text-decoration: none; }
.footer-copy { font-size: .75rem; color: var(--muted); opacity: .5; }

/* ── Containers ─────────────────────────────────────────────────────── */
.container    { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 700px;  margin: 0 auto; padding: 0 1.5rem; }
.container-xs { max-width: 480px;  margin: 0 auto; padding: 0 1.5rem; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .55rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .15s;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--amber); color: #0f1117; }
.btn-secondary{ background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-ghost    { background: transparent; color: var(--text); border-color: rgba(255,255,255,.15); }
.btn-danger   { background: #ef4444; color: #fff; }
.btn-outline-danger { background: transparent; color: #fca5a5; border-color: rgba(239,68,68,.45); }
.btn-sm  { padding: .35rem .85rem; font-size: .8125rem; }
.btn-block { width: 100%; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.125rem; }
label {
  display: block;
  margin-bottom: .375rem;
  font-size: .8125rem;
  color: var(--muted);
  font-weight: 500;
}
.form-hint { font-size: .75rem; color: var(--muted); margin-top: .3rem; opacity: .7; }

input[type=text],
input[type=email],
input[type=password] {
  width: 100%;
  padding: .6rem .875rem;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .875rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus {
  border-color: rgba(0, 206, 0, 0.9);
  box-shadow: 0 0 0 3px rgba(0, 206, 0, .08);
}
.font-mono,
.font-monospace {
  font-family: 'ui-monospace', 'Cascadia Code', 'Fira Mono', monospace;
  font-size: .8125rem;
}
.input-group { display: flex; gap: .5rem; align-items: stretch; }
.input-group input { flex: 1; min-width: 0; }

/* ── Alerts (JS-manipulated — keep class names as-is) ───────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  border: 1px solid transparent;
}
.alert-success { background: rgba(134,239,172,.12); border-color: rgba(134,239,172,.28); color: #86efac; }
.alert-danger  { background: rgba(239, 68, 68,.12); border-color: rgba(239, 68, 68,.28); color: #fca5a5; }
.alert-warning { background: rgba(251,191, 36,.12); border-color: rgba(251,191, 36,.28); color: #fde68a; }
.alert-info    { background: rgba( 56,189,248,.12); border-color: rgba( 56,189,248,.28); color: #7dd3fc; }

/* ── Bootstrap compat (referenced by existing JS — do not rename) ───── */
.d-none      { display: none !important; }
.text-muted  { color: var(--muted); }
.text-danger { color: #fca5a5; }
.text-success{ color: #86efac; }
.text-warning{ color: #fde68a; }
.text-info   { color: #7dd3fc; }
.small       { font-size: .8rem; }
.mb-0        { margin-bottom: 0 !important; }

/* ── Toasts ─────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
  max-width: 340px;
}
.toast {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  pointer-events: auto;
  border: 1px solid transparent;
  animation: toast-in .2s ease;
}
.toast-success { background: rgba(134,239,172,.15); border-color: rgba(134,239,172,.3); color: #86efac; }
.toast-danger  { background: rgba(239, 68, 68,.15); border-color: rgba(239, 68, 68,.3); color: #fca5a5; }
.toast-warning { background: rgba(251,191, 36,.15); border-color: rgba(251,191, 36,.3); color: #fde68a; }
.toast-info    { background: rgba( 56,189,248,.15); border-color: rgba( 56,189,248,.3); color: #7dd3fc; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 480px;
  width: 100%;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.125rem;
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: #fca5a5; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.375rem;
  line-height: 1;
  padding: .2rem .4rem;
  border-radius: var(--radius);
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-body { margin-bottom: 1.25rem; }
.modal-body p { font-size: .875rem; color: var(--muted); margin-bottom: .625rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .75rem; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.card-header {
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .9375rem;
}
.card-body { padding: 1.25rem; }
.card-danger { border-color: rgba(239, 68, 68, .3); }
.card-danger .card-header { color: #fca5a5; }

/* ── Dashboard stats row ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-divider { border-right: 1px solid var(--border); }
.stat-val  { font-size: 2.25rem; font-weight: 700; }
.stat-label{ font-size: .75rem; color: var(--muted); margin-bottom: .25rem; }

.refresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.last-refreshed { font-size: .8rem; color: var(--muted); }

/* ── Canvas ─────────────────────────────────────────────────────────── */
.cluster-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  background: #0f1117;
  margin-bottom: 1rem;
}
.cluster-empty {
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
  padding: 2rem 0;
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  padding: 6rem 0 5rem;
  text-align: center;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.hero-title .accent { color: var(--amber-solid); }
.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--muted);
  max-width: 460px;
  margin: 1.25rem auto 2.5rem;
}
.hero-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Image badge overlay (e.g. "Coming Soon" on hero screenshots) ───── */
.img-badge-wrap {
  position: relative;
  display: inline-block;
  vertical-align: text-bottom;
}
.img-badge {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amber-solid);
  color: #0f1117;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

/* ── Features section ───────────────────────────────────────────────── */
.section { padding: 5rem 0; }
.section-title {
  text-align: center;
  font-size: 1.625rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.section-sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 3rem;
  font-size: .9rem;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.feature-icon  { font-size: 1.75rem; margin-bottom: 1rem; display: block; }
.feature-title { font-size: .9375rem; font-weight: 700; margin-bottom: .5rem; }
.feature-desc  { font-size: .875rem; color: var(--muted); line-height: 1.65; }

/* ── Getting Started steps ──────────────────────────────────────────── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.step-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--amber);
  color: #0f1117;
  font-size: .8125rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.step-title { font-size: .9375rem; font-weight: 700; margin-bottom: .5rem; }
.step-desc  { font-size: .875rem; color: var(--muted); line-height: 1.65; }
.steps-cta  { text-align: center; margin-top: 2.5rem; }

/* ── ConnectIQ badge placeholder ────────────────────────────────────── */
.ciq-section { padding: 3rem 0 5rem; text-align: center; }
.ciq-label { font-size: .8rem; color: var(--muted); margin-bottom: 1rem; letter-spacing: .08em; text-transform: uppercase; }
.ciq-badge {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .875rem 1.5rem;
  opacity: .65;
}
.ciq-badge-icon { font-size: 1.5rem; }
.ciq-badge-text { text-align: left; }
.ciq-badge-name { font-size: .9rem; font-weight: 600; display: block; }
.ciq-badge-sub  { font-size: .75rem; color: var(--amber-solid); display: block; margin-top: .1rem; }

/* ── Auth page ──────────────────────────────────────────────────────── */
.auth-wrap { padding: 4rem 0; }
.auth-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
}
.auth-card h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1.5rem; }
.auth-divider  { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.auth-link  { font-size: .8125rem; text-align: center; display: block; margin-top: .75rem; color: var(--muted); }
.auth-note  { font-size: .75rem; color: var(--muted); text-align: center; margin-top: .75rem; opacity: .75; }

.auth-header { text-align: center; padding: 3rem 0 1rem; }
.auth-header h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: .25rem; }
.auth-header p  { color: var(--muted); font-size: .9rem; }

.forgot-section { margin-top: 1.125rem; }
.forgot-section hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.forgot-hint { font-size: .8125rem; color: var(--muted); margin-bottom: .75rem; }

/* ── Static content pages (impressum, privacy, faq) ─────────────────── */
.content-page { padding: 4rem 0; }
.content-page h1 { font-size: 2rem; font-weight: 800; margin-bottom: .375rem; }
.page-subtitle { color: var(--muted); margin-bottom: 3rem; font-size: .9rem; }

.content-section { margin-bottom: 2.5rem; }
.content-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--amber-solid);
  margin-bottom: .875rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: .01em;
}
.content-section h3 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .375rem;
  margin-top: 1.125rem;
}
.content-section p {
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: .75rem;
  line-height: 1.75;
}
.content-section ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: .75rem;
}
.content-section ul li {
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: .375rem;
  line-height: 1.65;
}

/* ── FAQ ────────────────────────────────────────────────────────────── */
.faq-list { margin-top: 1.5rem; }
.faq-item { border-bottom: 1px solid var(--border); padding: 1.375rem 0; }
.faq-item:last-child { border-bottom: none; }
.faq-q { font-size: .9375rem; font-weight: 600; color: var(--text); margin-bottom: .5rem; }
.faq-a { font-size: .875rem; color: var(--muted); line-height: 1.75; }
.faq-a a { color: var(--sky-solid); }

/* ── Impressum address obfuscation ──────────────────────────────────── */
.address-protect { unicode-bidi: bidi-override; direction: ltr; }
.js-contact { /* populated by JS */ }

/* ── Misc utilities ─────────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-3 { margin-bottom: .75rem; }
.loading-state { color: var(--muted); padding: 2rem 0; font-size: .9rem; }
.danger-note { font-size: .875rem; color: var(--muted); margin-bottom: 1rem; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-val   { font-size: 1.625rem; }
  .nav-links  { gap: 1rem; }
  .hero       { padding: 4rem 0 3rem; }
  .auth-card-grid { flex-direction: column; align-items: center; }
}
