/* ============================================================
   Telescopium Tools — Deep Space Luxury UI
   Medical Research Intelligent Tools Platform
   ============================================================
   Design Tokens:
   - Main BG:        #080B14
   - Deep BG:        #111827
   - Brand Blue:     #3B82F6
   - Brand Purple:   #8B5CF6
   - Primary Text:   #F8FAFC
   - Secondary Text: #94A3B8
   - Card Glass:     rgba(17, 24, 39, 0.65)
   - Border Glass:   rgba(59, 130, 246, 0.12)
   ============================================================ */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    'Noto Sans SC',
    sans-serif;
  background-color: #080B14;
  color: #F8FAFC;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Starfield Background ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1px 1px at 10% 15%, rgba(148, 163, 184, 0.25), transparent),
    radial-gradient(1px 1px at 22% 38%, rgba(148, 163, 184, 0.18), transparent),
    radial-gradient(1.5px 1.5px at 35% 12%, rgba(59, 130, 246, 0.22), transparent),
    radial-gradient(1px 1px at 48% 62%, rgba(148, 163, 184, 0.2), transparent),
    radial-gradient(1.5px 1.5px at 55% 28%, rgba(139, 92, 246, 0.2), transparent),
    radial-gradient(1px 1px at 63% 75%, rgba(148, 163, 184, 0.15), transparent),
    radial-gradient(1.5px 1.5px at 72% 18%, rgba(59, 130, 246, 0.18), transparent),
    radial-gradient(1px 1px at 80% 55%, rgba(148, 163, 184, 0.2), transparent),
    radial-gradient(1px 1px at 88% 82%, rgba(139, 92, 246, 0.15), transparent),
    radial-gradient(1.5px 1.5px at 95% 42%, rgba(148, 163, 184, 0.18), transparent),
    radial-gradient(1px 1px at 15% 80%, rgba(148, 163, 184, 0.16), transparent),
    radial-gradient(1px 1px at 42% 90%, rgba(59, 130, 246, 0.14), transparent),
    radial-gradient(1.5px 1.5px at 68% 48%, rgba(139, 92, 246, 0.16), transparent),
    radial-gradient(1px 1px at 92% 92%, rgba(148, 163, 184, 0.12), transparent);
}

/* Subtle light orbs */
body::after {
  content: '';
  position: fixed;
  pointer-events: none;
  z-index: 0;
  top: -20%;
  left: 25%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.04) 0%, transparent 70%);
  filter: blur(40px);
}

/* ---------- Layout Wrapper ---------- */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 11, 20, 0.82);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

.navbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #F8FAFC;
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.nav-logo-text {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #F8FAFC;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94A3B8;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: #F8FAFC;
  background: rgba(59, 130, 246, 0.1);
}

/* ---------- Hero ---------- */
.hero {
  padding: 96px 0 72px;
  text-align: center;
  position: relative;
}

.hero-tag {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8B5CF6;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.18);
  margin-bottom: 28px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  line-height: 1.1;
  color: #F8FAFC;
  margin-bottom: 16px;
}

.hero-title span {
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  font-weight: 500;
  color: #94A3B8;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.hero-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.hero-tags span {
  font-size: 0.8rem;
  color: #64748B;
  letter-spacing: 0.06em;
}

.hero-desc {
  max-width: 620px;
  margin: 0 auto 40px;
  font-size: 0.95rem;
  color: #64748B;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(59, 130, 246, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(59, 130, 246, 0.08);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

/* ---------- Search ---------- */
.search-section {
  padding: 0 0 64px;
}

.search-wrap {
  max-width: 540px;
  margin: 0 auto;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.05rem;
  color: #64748B;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 18px 14px 48px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.12);
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(10px);
  color: #F8FAFC;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.search-input::placeholder {
  color: #475569;
}

.search-input:focus {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-empty {
  display: none;
  text-align: center;
  padding: 48px 0 16px;
  color: #64748B;
  font-size: 0.95rem;
}

.search-empty.visible {
  display: block;
}

/* ---------- Section Headers ---------- */
.section {
  padding: 0 0 72px;
}

.section-header {
  margin-bottom: 32px;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #64748B;
  margin-bottom: 8px;
}

.section-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: #F8FAFC;
  letter-spacing: 0.02em;
}

.section-desc {
  font-size: 0.9rem;
  color: #64748B;
  margin-top: 6px;
  max-width: 520px;
}

/* ---------- Card Grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ---------- Glass Card ---------- */
.card {
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(59, 130, 246, 0.08);
  border-radius: 16px;
  padding: 26px 28px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.22);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(59, 130, 246, 0.06);
}

.card.hidden {
  display: none;
}

.card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 0.85rem;
  color: #94A3B8;
  line-height: 1.65;
  flex: 1;
  margin-bottom: 16px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.card-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748B;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #3B82F6;
  text-decoration: none;
  transition: color 0.2s, gap 0.2s;
}

.card-link:hover {
  color: #60A5FA;
  gap: 10px;
}

.card-link::after {
  content: '→';
  font-size: 0.85rem;
}

/* ---------- Floating AI Widget ---------- */

/* Toggle button */
.ai-floating-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 28px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  background: rgba(17, 24, 39, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #F8FAFC;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(59, 130, 246, 0.08);
  transition: transform 0.25s, box-shadow 0.25s, opacity 0.25s, visibility 0.25s;
}

.ai-floating-icon {
  font-size: 1.1rem;
  color: #8B5CF6;
}

.ai-floating-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.18), 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.ai-floating-btn--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Chat panel */
.ai-chat-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 201;
  width: 380px;
  max-height: 620px;
  display: flex;
  flex-direction: column;
  background: rgba(17, 24, 39, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(59, 130, 246, 0.14);
  border-radius: 22px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(59, 130, 246, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
  overflow: hidden;
}

.ai-chat-panel--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
  flex-shrink: 0;
}

.ai-chat-header-info {
  min-width: 0;
}

.ai-chat-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #F8FAFC;
}

.ai-chat-header-subtitle {
  font-size: 0.72rem;
  color: #64748B;
  margin-top: 2px;
}

.ai-chat-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(148, 163, 184, 0.06);
  color: #94A3B8;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.ai-chat-close:hover {
  color: #F8FAFC;
  background: rgba(148, 163, 184, 0.14);
}

/* Messages */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.ai-chat-msg {
  display: flex;
}

.ai-chat-msg--user {
  justify-content: flex-end;
}

.ai-chat-msg--ai {
  justify-content: flex-start;
}

.ai-chat-bubble {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-chat-msg--user .ai-chat-bubble {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.ai-chat-msg--ai .ai-chat-bubble {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.12);
  color: #E2E8F0;
  border-bottom-left-radius: 6px;
}

/* Input row */
.ai-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(59, 130, 246, 0.1);
  flex-shrink: 0;
}

.ai-chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.14);
  background: rgba(8, 11, 20, 0.5);
  color: #F8FAFC;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color 0.2s;
}

.ai-chat-input::placeholder {
  color: #475569;
}

.ai-chat-input:focus {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

.ai-chat-send {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #8B5CF6, #7C3AED);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
}

.ai-chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.4);
}

.ai-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Loading */
.ai-chat-loading {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 14px;
  font-size: 0.8rem;
  color: #94A3B8;
  flex-shrink: 0;
}

.ai-chat-loading.visible {
  display: flex;
}

.ai-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(139, 92, 246, 0.25);
  border-top-color: #8B5CF6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Error */
.ai-chat-error {
  display: none;
  margin: 0 16px 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.ai-chat-error.visible {
  display: block;
}

/* ---------- Internal Links ---------- */
.internal-section {
  padding: 0 0 72px;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid rgba(59, 130, 246, 0.08);
  padding: 40px 0;
  text-align: center;
}

.footer-brand {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #F8FAFC;
  margin-bottom: 8px;
}

.footer-tagline {
  font-size: 0.8rem;
  color: #64748B;
  margin-bottom: 4px;
}

.footer-copy {
  font-size: 0.75rem;
  color: #475569;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 28px;
  margin: 18px 0 24px;
}

.footer-links a {
  font-size: 0.82rem;
  color: #94A3B8;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #60A5FA;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero {
    padding: 64px 0 48px;
  }

  .hero-title {
    font-size: 2.2rem;
    letter-spacing: 0.12em;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-desc {
    font-size: 0.85rem;
  }

  .nav-links a {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .ai-chat-panel {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 16px;
    max-height: calc(100vh - 100px);
  }

  .ai-floating-btn {
    bottom: 16px;
    right: 16px;
  }

  .section {
    padding: 0 0 48px;
  }

  .search-section {
    padding: 0 0 48px;
  }
}

@media (max-width: 480px) {
  .navbar-inner {
    padding: 0 14px;
  }

  .page-wrap {
    padding: 0 14px;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.82rem;
  }
}
