/* ─── ClinIQ Platform — Core Styles ─────────────────────────────────── */

:root {
  --bg-primary: #030712;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #243040;
  --border: #374151;
  --border-light: #4b5563;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --blue-glow: rgba(59, 130, 246, 0.15);
  --purple: #8b5cf6;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --teal: #14b8a6;
  --pink: #ec4899;
  --indigo: #6366f1;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* ─── Animations ──────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse-blue { 0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.4); } 50% { box-shadow: 0 0 0 12px rgba(59,130,246,0); } }
@keyframes shimmer { from { background-position: -1000px 0; } to { background-position: 1000px 0; } }
@keyframes bounce-in { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.05); } 70% { transform: scale(0.9); } 100% { transform: scale(1); opacity: 1; } }
@keyframes progress-fill { from { width: 0%; } to { width: var(--target-width); } }
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-10px); } }
@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes glow { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.animate-fade-in { animation: fadeIn 0.5s ease-out forwards; }
.animate-slide-in { animation: slideIn 0.4s ease-out forwards; }
.animate-bounce-in { animation: bounce-in 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* ─── Glassmorphism Cards ──────────────────────────────────── */
.glass-card {
  background: rgba(31, 41, 55, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(75, 85, 99, 0.4);
  border-radius: 16px;
}

.glass-card-hover {
  background: rgba(31, 41, 55, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(75, 85, 99, 0.4);
  border-radius: 16px;
  transition: all 0.3s ease;
  cursor: pointer;
}
.glass-card-hover:hover {
  background: rgba(36, 48, 64, 0.9);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.12);
}

/* ─── Navigation ──────────────────────────────────────────── */
#nav-sidebar {
  width: 260px;
  min-height: 100vh;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(55, 65, 81, 0.5);
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.nav-logo {
  padding: 24px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
}

.nav-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  margin: 2px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.nav-link:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
}
.nav-link.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(139,92,246,0.1));
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.3);
}
.nav-link .nav-icon { width: 20px; text-align: center; font-size: 16px; }

/* ─── Main Layout ──────────────────────────────────────────── */
#main-content {
  margin-left: 260px;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* ─── Top Bar ──────────────────────────────────────────────── */
.topbar {
  height: 64px;
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ─── Page Container ──────────────────────────────────────── */
.page-container {
  padding: 32px 28px;
  max-width: 1400px;
}

.page-header { margin-bottom: 32px; animation: fadeIn 0.4s ease-out; }
.page-title { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.page-subtitle { color: var(--text-secondary); margin-top: 6px; font-size: 15px; }

/* ─── Stats Cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--blue));
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.stat-value { font-size: 32px; font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

/* ─── Module Cards ──────────────────────────────────────────── */
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--module-color, var(--blue));
  border-radius: 16px 0 0 16px;
}
.module-card:hover {
  border-color: rgba(59,130,246,0.4);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.module-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}
.module-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.module-subtitle { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; }

/* ─── Progress Bar ──────────────────────────────────────────── */
.progress-track {
  background: rgba(75,85,99,0.3);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  transition: width 0.8s ease;
}

/* ─── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59,130,246,0.35);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--green), #059669);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,185,129,0.35); }

/* ─── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-blue { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-green { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-orange { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-red { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }
.badge-teal { background: rgba(20,184,166,0.15); color: #2dd4bf; border: 1px solid rgba(20,184,166,0.3); }

/* ─── Case Lab Cards ──────────────────────────────────────── */
.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.case-card:hover {
  border-color: rgba(59,130,246,0.5);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.case-thumbnail {
  font-size: 42px;
  width: 72px; height: 72px;
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}

/* ─── Quiz Styles ──────────────────────────────────────────── */
.quiz-option {
  background: rgba(31,41,55,0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.quiz-option:hover {
  border-color: rgba(59,130,246,0.5);
  background: rgba(59,130,246,0.05);
}
.quiz-option.selected {
  border-color: #3b82f6;
  background: rgba(59,130,246,0.1);
}
.quiz-option.correct {
  border-color: var(--green);
  background: rgba(16,185,129,0.1);
}
.quiz-option.incorrect {
  border-color: var(--red);
  background: rgba(239,68,68,0.1);
}
.option-letter {
  width: 28px; height: 28px; min-width: 28px;
  border-radius: 8px;
  background: rgba(75,85,99,0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.quiz-option.correct .option-letter { background: var(--green); color: white; }
.quiz-option.incorrect .option-letter { background: var(--red); color: white; }
.quiz-option.selected .option-letter { background: var(--blue); color: white; }

/* ─── Explanation Box ──────────────────────────────────────── */
.explanation-box {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 16px;
  animation: fadeIn 0.4s ease-out;
}
.explanation-box.wrong {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.3);
}

/* ─── CASP Checklist ──────────────────────────────────────── */
.casp-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: all 0.2s;
}
.casp-item:hover { border-color: var(--border-light); }
.casp-radio-group {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.casp-radio {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}
.casp-radio:hover { border-color: var(--border-light); color: var(--text-primary); }
.casp-radio.yes { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.4); color: #34d399; }
.casp-radio.no { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: #f87171; }
.casp-radio.cant-tell { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.4); color: #fbbf24; }

/* ─── Research Cycle ──────────────────────────────────────── */
.cycle-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}
.cycle-step:hover {
  border-color: rgba(59,130,246,0.4);
  transform: scale(1.02);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.cycle-step.active {
  border-color: rgba(59,130,246,0.6);
  background: rgba(59,130,246,0.05);
}
.step-number {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: white;
  margin-bottom: 12px;
}

/* ─── AI Hub ──────────────────────────────────────────────── */
.ai-search-bar {
  background: rgba(31,41,55,0.8);
  border: 1px solid rgba(75,85,99,0.5);
  border-radius: 14px;
  padding: 14px 20px;
  width: 100%;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.3s;
}
.ai-search-bar:focus {
  border-color: rgba(59,130,246,0.6);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
}
.ai-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 10px;
  animation: fadeIn 0.3s ease-out;
  transition: all 0.2s;
}
.ai-result-card:hover { border-color: var(--border-light); }

/* ─── Score Circle ──────────────────────────────────────────── */
.score-circle {
  width: 120px; height: 120px;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800;
  position: relative;
}

/* ─── Timeline ──────────────────────────────────────────────── */
.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 24px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 40px; height: 40px; min-width: 40px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  z-index: 1;
}
.timeline-dot.active {
  border-color: var(--blue);
  background: rgba(59,130,246,0.1);
}

/* ─── Table Styles ──────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  background: rgba(59,130,246,0.1);
  color: #60a5fa;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(59,130,246,0.2);
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ─── Mobile Hamburger ──────────────────────────────────────── */
#mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
}

/* ─── Notification ──────────────────────────────────────────── */
.notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  z-index: 1000;
  max-width: 340px;
  animation: slideIn 0.3s ease-out;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  #nav-sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  #nav-sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  #mobile-menu-btn { display: flex; }
  .overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    display: none;
  }
  .overlay.show { display: block; }
}
@media (max-width: 640px) {
  .page-container { padding: 20px 16px; }
  .page-title { font-size: 22px; }
}

/* ─── Gradient Text ──────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #60a5fa, #a78bfa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Glow Effects ──────────────────────────────────────────── */
.glow-blue { box-shadow: 0 0 24px rgba(59,130,246,0.25); }
.glow-green { box-shadow: 0 0 24px rgba(16,185,129,0.25); }
.glow-purple { box-shadow: 0 0 24px rgba(139,92,246,0.25); }

/* ─── Loading Skeleton ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(75,85,99,0.3) 50%, var(--bg-card) 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  border-radius: 8px;
}

/* ─── Tooltip ──────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,24,39,0.95);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 999;
}

/* ─── Step Indicator ──────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}
.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}
.step-dot.active { background: var(--blue); transform: scale(1.3); }
.step-dot.done { background: var(--green); }

/* ─── Hero Banner ──────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.12) 0%, rgba(139,92,246,0.08) 50%, rgba(16,185,129,0.06) 100%);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 20px;
  padding: 32px 36px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,0.08), transparent 70%);
  border-radius: 50%;
}
