/* DexaMed AI MedPix Clinical Quiz Hall - Modern Glassmorphism Styling */
@font-face {
  font-family: "Inter";
  src: url("/medpix/fonts/Inter-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #070d12;
  --bg-card: rgba(14, 23, 34, 0.72);
  --bg-card-hover: rgba(19, 31, 46, 0.88);
  --bg-topbar: rgba(7, 13, 18, 0.85);
  --bg-drawer: rgba(10, 18, 27, 0.96);
  --bg-chip: rgba(255, 255, 255, 0.05);
  --bg-chip-hover: rgba(63, 191, 173, 0.12);
  --ink: #f0f6fa;
  --ink-dim: #9cb2c2;
  --ink-faint: #627787;
  --teal: #3fbfad;
  --teal-light: #5eead4;
  --teal-glow: rgba(63, 191, 173, 0.35);
  --violet: #7c8cf8;
  --violet-glow: rgba(124, 140, 248, 0.3);
  --amber: #f0b64a;
  --amber-glow: rgba(240, 182, 74, 0.25);
  --coral: #f87171;
  --edge: rgba(255, 255, 255, 0.08);
  --edge-strong: rgba(255, 255, 255, 0.16);
  --edge-lit: rgba(63, 191, 173, 0.45);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-pill: 9999px;
  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 16px 36px -6px rgba(0, 0, 0, 0.7), 0 0 24px -4px var(--teal-glow);
  --shadow-modal: 0 24px 64px -12px rgba(0, 0, 0, 0.85);
}

:root[data-theme="light"] {
  --bg: #f5f8fa;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-topbar: rgba(245, 248, 250, 0.9);
  --bg-drawer: rgba(255, 255, 255, 0.98);
  --bg-chip: rgba(0, 0, 0, 0.05);
  --bg-chip-hover: rgba(63, 191, 173, 0.15);
  --ink: #0f172a;
  --ink-dim: #475569;
  --ink-faint: #94a3b8;
  --edge: rgba(0, 0, 0, 0.08);
  --edge-strong: rgba(0, 0, 0, 0.16);
  --edge-lit: rgba(14, 124, 123, 0.45);
  --shadow-card: 0 8px 20px -2px rgba(15, 23, 42, 0.07);
  --shadow-hover: 0 16px 32px -4px rgba(15, 23, 42, 0.15), 0 0 18px -2px rgba(63, 191, 173, 0.35);
  --shadow-modal: 0 24px 60px -8px rgba(15, 23, 42, 0.2);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--bg);
  min-height: 100vh;
  direction: ltr;
  text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease;
  overflow-x: hidden;
}

/* Ambient Aurora Gradient */
.aurora {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 480px;
  background:
    radial-gradient(ellipse 70% 50% at 50% -15%, rgba(63, 191, 173, 0.16), transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% -10%, rgba(124, 140, 248, 0.13), transparent 70%),
    radial-gradient(ellipse 40% 30% at 15% 10%, rgba(240, 182, 74, 0.07), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
}

/* Topbar Navigation */
header.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  border-bottom: 1px solid var(--edge);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--bg-topbar);
  transition: border-color 0.2s;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-svg {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text strong {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.25;
}

.brand-text strong span.ai-pill {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  margin-left: 0.35rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #070d12;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.brand-text span.brand-sub {
  font-size: 0.78rem;
  color: var(--ink-dim);
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
}

.nav-links a {
  color: var(--ink-dim);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--teal-light);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Buttons */
.iconbtn {
  background: var(--bg-chip);
  border: 1px solid var(--edge);
  color: var(--ink);
  height: 40px;
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
}

.iconbtn:hover {
  background: var(--bg-chip-hover);
  border-color: var(--teal);
  color: var(--teal-light);
}

.iconbtn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.kbd-shortcut {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--edge-strong);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--ink-dim);
}

/* Collapsible Search Drawer */
.search-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 5rem;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.search-drawer[hidden] {
  display: none;
  opacity: 0;
  visibility: hidden;
}

.search-modal {
  width: 90%;
  max-width: 680px;
  background: var(--bg-drawer);
  border: 1px solid var(--edge-lit);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.search-input-row {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--edge);
  gap: 0.75rem;
}

.search-input-row svg.search-icon {
  width: 22px;
  height: 22px;
  color: var(--teal);
  flex-shrink: 0;
}

.search-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--ink);
}

.search-input-row input::placeholder {
  color: var(--ink-faint);
}

.search-input-row .btn-clear {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-input-row .btn-clear:hover {
  color: var(--ink);
}

.search-input-row .esc-hint {
  font-size: 0.75rem;
  color: var(--ink-faint);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
}

.search-drawer-body {
  padding: 1.25rem;
  max-height: 60vh;
  overflow-y: auto;
}

.search-quick-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.search-quick-tags span.quick-label {
  font-size: 0.8rem;
  color: var(--ink-dim);
  margin-right: 0.25rem;
}

.quick-tag-btn {
  background: var(--bg-chip);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-tag-btn:hover {
  background: var(--bg-chip-hover);
  border-color: var(--teal);
  color: var(--teal-light);
}

/* Main Layout */
main.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  position: relative;
  z-index: 1;
}

/* Hero Section */
.hero {
  padding: 3rem 2.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), var(--violet), transparent);
}

.hero-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(63, 191, 173, 0.12);
  border: 1px solid var(--teal-glow);
  color: var(--teal-light);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 1rem;
  color: var(--ink);
  max-width: 1100px;
}

.hero p.lead {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 980px;
  margin: 0 0 2rem;
}

/* Hero Stats KPI Grid */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--edge);
}

.stat-card {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--teal-light);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.35rem;
}

/* Category Filter Chips Bar */
.filter-section {
  margin-bottom: 1.75rem;
}

.filter-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.filter-heading-row h2 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  margin: 0;
}

.filter-chips {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.35rem 0.2rem 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--edge-strong) transparent;
  -webkit-overflow-scrolling: touch;
}

.filter-chips::-webkit-scrollbar {
  height: 6px;
}

.filter-chips::-webkit-scrollbar-thumb {
  background: var(--edge-strong);
  border-radius: var(--radius-pill);
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--edge);
  color: var(--ink-dim);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.chip:hover {
  border-color: var(--teal);
  color: var(--ink);
  transform: translateY(-1px);
}

.chip.active {
  background: var(--teal);
  color: #070d12;
  border-color: var(--teal);
  box-shadow: 0 4px 14px var(--teal-glow);
  font-weight: 700;
}

.chip .badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  line-height: 1.2;
}

.chip.active .badge {
  background: rgba(7, 13, 18, 0.25);
  color: #070d12;
}

/* Results Control Bar */
.resultbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.results-count {
  font-size: 0.95rem;
  color: var(--ink-dim);
}

.results-count strong {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.page-size-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--ink-dim);
}

.page-size-wrapper label {
  font-weight: 500;
}

.page-size-chips {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.page-size-chips .chip-pagesize {
  padding: 0.25rem 0.65rem;
  min-width: 38px;
  height: 28px;
  font-size: 0.82rem;
  justify-content: center;
  box-shadow: none;
}

.page-size-chips .chip-pagesize[aria-pressed="true"] {
  background: var(--teal);
  color: #070d12;
  border-color: var(--teal);
  box-shadow: 0 0 10px var(--teal-glow, rgba(0, 229, 255, 0.35));
  font-weight: 700;
}

/* Cases Card Grid */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

/* Clinical Case Card */
.case-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease,
              box-shadow 0.25s ease;
  box-shadow: var(--shadow-card);
  position: relative;
}

.case-card:hover {
  transform: translateY(-5px);
  border-color: var(--teal);
  box-shadow: var(--shadow-hover);
}

.case-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
}

.case-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.35s ease;
}

.case-card:hover .case-media img {
  transform: scale(1.03);
}

/* Card Badges */
.card-specialty-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(7, 13, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 2;
}

.card-slices-tag {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(7, 13, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--teal-glow);
  color: var(--teal-light);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  z-index: 2;
}

.card-quiz-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(240, 182, 74, 0.2);
  border: 1px solid var(--amber-glow);
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 2;
}

.case-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.case-meta-category {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
}

.case-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.65rem;
  line-height: 1.35;
}

.case-excerpt {
  font-size: 0.85rem;
  color: var(--ink-dim);
  margin: 0 0 1rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.case-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  border-top: 1px solid var(--edge);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--teal);
}

.case-card:hover .case-footer {
  color: var(--teal-light);
}

.case-footer svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.case-card:hover .case-footer svg {
  transform: translateX(4px);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  border-radius: var(--radius-lg);
  margin: 2rem 0;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--ink-faint);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.empty-state p {
  color: var(--ink-dim);
  font-size: 0.95rem;
  max-width: 450px;
  margin: 0 auto 1.5rem;
}

.btn-reset-filters {
  background: var(--teal);
  color: #070d12;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset-filters:hover {
  background: var(--teal-light);
  box-shadow: 0 4px 14px var(--teal-glow);
}

/* Pagination Controls */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.page-btn {
  background: var(--bg-card);
  border: 1px solid var(--edge);
  color: var(--ink);
  min-width: 40px;
  height: 40px;
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.page-btn:hover {
  background: var(--bg-chip-hover);
  border-color: var(--teal);
  color: var(--teal-light);
}

.page-btn.active {
  background: var(--teal);
  color: #070d12;
  border-color: var(--teal);
  font-weight: 800;
  box-shadow: 0 4px 14px var(--teal-glow);
}

.page-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.page-ellipsis {
  color: var(--ink-faint);
  padding: 0 0.35rem;
  font-weight: 700;
}

/* Site Footer */
footer.site-footer {
  border-top: 1px solid var(--edge);
  margin-top: 5rem;
  padding: 3rem 1.5rem 2.5rem;
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.footer-disclaimer {
  max-width: 820px;
  color: var(--ink-faint);
  font-size: 0.82rem;
  line-height: 1.65;
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0.5rem 0;
}

.footer-links a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--teal-light);
}

.footer-copyright {
  color: var(--ink-faint);
  font-size: 0.82rem;
  margin: 0;
}

.footer-copyright a {
  color: var(--teal);
  text-decoration: none;
}

.footer-copyright a:hover {
  text-decoration: underline;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  header.topbar {
    padding: 0.65rem 1rem;
  }
  main.container {
    padding: 1.25rem 1rem 4rem;
  }
  .hero {
    padding: 2rem 1.25rem;
  }
  .hero h1 {
    font-size: 1.65rem;
  }
  .hero p.lead {
    font-size: 0.95rem;
  }
  .cases-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .resultbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }
  .controls-right {
    width: 100%;
    justify-content: space-between;
  }
}
