/* ======= Light theme (clean + consistent) ======= */
:root{
  /* Core palette */
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --ink: #111827;          /* primary text */
  --muted: #6b7280;        /* secondary text */
  --brand: #2563eb;        /* primary blue */
  --brand-2: #4f46e5;      /* indigo accent */
  --accent: #06b6d4;       /* cyan accent */
  --line: #e5e7eb;         /* borders */
  --chip: #f3f4f6;         /* chip background */
  --chip-hover: #e5e7eb;   /* chip hover bg */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-strong: 0 10px 30px rgba(17,24,39,.10);
  --shadow-soft: 0 8px 24px rgba(17,24,39,.08);
}

/* Page background */
html, body { height: 100%; }
body{
  font-family: "Lato", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------- Global typography helpers --------- */
.page-title{
  color: var(--brand);
  font-weight: 800;
  letter-spacing: .2px;
  margin-bottom: .35rem;
}
.page-subtitle{
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* Backward compatibility (if templates still use text-primary titles) */
h1.text-primary{
  color: var(--brand) !important;
  font-weight: 800;
  letter-spacing: .2px;
  margin-bottom: .35rem;
}

/* Section titles */
.section-title{
  margin-top: 1.6rem;
  margin-bottom: .9rem;
  padding-bottom: .4rem;
  font-weight: 700;
  color: var(--ink);
  border: none;
  position: relative;
}
.section-title::after{
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 160px; height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), transparent 75%);
  opacity: .8;
}

/* Cards */
.glass-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}

/* Optional: give pages a subtle separation on light bg */
.container > .glass-card{
  background: var(--surface);
}

/* Labels & controls */
.form-label{
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.form-text{
  color: var(--muted);
}
.form-control{
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.form-control::placeholder{ color: #9ca3af; }
.form-control:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  border-color: rgba(37,99,235,.55);
}

/* Smart search dropdown */
#deviceSuggestions{
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-soft);
  background: var(--surface);
}
#deviceSuggestions a{
  color: var(--ink);
}
#deviceSuggestions a:hover{
  background: rgba(37,99,235,.08);
}

/* Buttons */
.btn{
  border-radius: 999px;
}
.btn-primary{
  background: linear-gradient(135deg, rgba(37,99,235,1), rgba(79,70,229,1));
  border: 1px solid rgba(37,99,235,.55);
}
.btn-primary:hover{ filter: brightness(.97); }

.btn-success{
  border: 1px solid rgba(22,163,74,.45);
}

.btn-outline-secondary{
  color: var(--muted);
  border: 1px solid #d1d5db;
  background: transparent;
}
.btn-outline-secondary:hover{
  background: rgba(37,99,235,.07);
  color: var(--ink);
  border-color: rgba(37,99,235,.25);
}

/* Filter chips */
#filterChips{
  margin-top: .35rem;
  margin-bottom: .25rem;
}
#filterChips .filter-chip{
  background: var(--chip);
  color: var(--ink);
  border-color: #d1d5db !important;
}
#filterChips .filter-chip:hover{
  background: var(--chip-hover);
  color: var(--brand);
  border-color: rgba(37,99,235,.35) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}

/* Charts container spacing */
#chartsContainer > div{ padding: .6rem; }

/* --------- Results table + container --------- */
/* FIXED: no invalid nested CSS */
.results-container{
  height: 70vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.table{
  color: var(--ink);
  font-size: .95rem;
  margin: 0;
}
.table thead th{
  font-weight: 700;
  letter-spacing: .2px;
  padding-top: .65rem;
  padding-bottom: .65rem;
  border-color: var(--line);
  background: var(--surface-2);
}
.table tbody td{
  padding-top: .55rem;
  padding-bottom: .55rem;
  vertical-align: middle;
  border-color: var(--line);
}
.table tbody tr:hover{
  background: rgba(37,99,235,.05);
}

.table-scroll-top{
  position: relative;
}

/* Sticky horizontal scrollbar above results */
.scrollbar-top {
    position: sticky;
    top: 0px;   /* accounts for your live status bar */
    z-index: 100;

    overflow-x: auto;
    overflow-y: hidden;

    height: 18px;

    background: white;
    border-bottom: 1px solid #dee2e6;
}

.scrollbar-inner {
  width: 100px;   /* adjust if your table is wider */
  height: 1px;
}

.table-scroll-body {
  overflow-x: auto;
}


#recallsTable {
  min-width: 1400px;
}

#recallsTable tbody td {
  vertical-align: top;
}


/* === Top horizontal scrollbar (synced with table) === */
.top-scroll-wrap {
  position: sticky;
  top: 0;
  z-index: 15;

  overflow-x: auto;
  overflow-y: hidden;

  height: 18px;

  margin-bottom: 0.75rem;
  padding-top: 0.35rem;

  border-bottom: 1px solid var(--line);

  background: var(--surface);

  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.top-scroll-wrap div {
  height: 1px;
}

/* Ensure wide table */
.results-table-wide {
  min-width: 2200px;
}



/* Optional: hide bottom scrollbar (WebKit browsers) */
.table-scroll-body{
  overflow-x: auto;
}


/* Sticky header support */
#resultsTable thead th{
  position: sticky;
  top: 0;
  z-index: 2;
}

#recallsTable thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
}

/* MDR inline box (shared) */
.mdr-text-box{
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: var(--surface);
  font-size: 0.9rem;
  line-height: 1.25rem;
  min-width: 320px;
}

/* Breadcrumbs styling (to match light theme) */
.breadcrumb{
  margin-bottom: 0;
}
.breadcrumb a{
  color: var(--brand);
  text-decoration: none;
}
.breadcrumb a:hover{
  text-decoration: underline;
}
.breadcrumb-item.active{
  color: var(--muted);
}

/* Scrollbars (WebKit) */
.results-container::-webkit-scrollbar{ width:10px; height:10px; }
.results-container::-webkit-scrollbar-thumb{ background:#cbd5e1; border-radius:12px; }
.results-container::-webkit-scrollbar-track{ background: transparent; }

/* Focus ring (a11y) */
:focus-visible{
  outline: 3px solid rgba(37,99,235,.35);
  outline-offset: 2px;
}

/* Placeholder result text visibility */
.placeholder-text{
  color: var(--muted);
  font-style: italic;
}

/* Ensure results-container always uses card look */
.results-container.glass-card{
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* Chart layout helpers */
#eventTypeByYearMfgChart{ min-height: 520px; }

#chartsContainer > [class*="col-"]{
  display: flex;
}
#chartsContainer > [class*="col-"] > div{
  flex: 1;
  display: flex;
  flex-direction: column;
}

#eventTypeChart,
#eventTypeByYearMfgChart,
#problemChart{
  width: 100%;
  height: 520px;
  min-height: 520px;
}

.chart-card{
  border-radius: .5rem;
  padding: .75rem .75rem .5rem .75rem;
  height: 100%;
}
.chart-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.chart-title{
  font-weight: 700;
  margin: 0;
}

.intended-use-cell {
  max-height: 90px;
  overflow: hidden;
  white-space: pre-wrap;
  line-height: 1.35;
  font-size: 0.9rem;
  cursor: pointer;
  position: relative;
}

/* subtle fade to indicate more content */
.intended-use-cell::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
}

.intended-use-cell.expanded {
  max-height: 360px;
  overflow-y: auto;
}

.intended-use-cell.expanded::after {
  display: none;
}

/* Mobile tweaks */
@media (max-width: 576px){
  h1.text-primary{ font-size: 1.4rem; }
  .table{ font-size: .92rem; }
}

/* ======= Index / Landing Page Styling ======= */

.hero-section {
  padding: 4rem 3rem;
  border-radius: 2rem;
  background:
    radial-gradient(circle at top right, rgba(13, 110, 253, 0.16), transparent 35%),
    linear-gradient(135deg, #ffffff 0%, #f3f7fb 55%, #eaf1f8 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1rem;

  background: rgba(13, 110, 253, 0.08);
  color: #0d6efd;
  border: 1px solid rgba(13, 110, 253, 0.18);

  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 999px;
}

.hero-title {
  font-size: clamp(2.4rem, 5vw, 4.25rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #0f172a;
}

.hero-subtitle {
  max-width: 620px;
  font-size: 1.2rem;
  line-height: 1.65;
  color: #64748b;
}

.hero-proof-card {
  padding: 2rem;
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.12), transparent 32%),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 55%, #eef4fb 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.10);
}

.hero-proof-card div + div {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.hero-proof-card strong {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
  letter-spacing: -0.04em;
}

.hero-proof-card span {
  display: block;
  margin-top: 0.35rem;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.5;
}

.landing-feature-section {
  padding: 2rem;
  border-radius: 2rem;
  background:
    radial-gradient(circle at top left, rgba(13, 110, 253, 0.08), transparent 32%),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 55%, #eef4fb 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.06);
}

.feature-copy-card {
  min-height: 100%;
  max-width: 560px;
}

.landing-glass-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;

  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.12), transparent 30%),
    linear-gradient(135deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.96) 45%, rgba(238,244,251,0.96) 100%);

  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);

  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.landing-glass-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 65px rgba(15, 23, 42, 0.12);
}

.landing-glass-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;

  width: 100%;
  height: 4px;

  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, #93c5fd 100%);
}

.landing-glass-card h2 {
  font-size: clamp(1.8rem, 2vw, 2.3rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin-bottom: 1.25rem;
}

.landing-glass-card p,
.landing-glass-card li {
  color: #64748b;
}

.feature-list {
  padding-left: 1.1rem;
  margin-bottom: 0;
  color: #64748b;
  line-height: 1.9;
}

.feature-list li::marker {
  color: #0d6efd;
}

.landing-image-card {
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.95));
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.feature-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature-image + .feature-image {
  margin-top: 1rem;
}

.feature-image:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.16);
}

.cta-dark-section {
  margin-top: 5rem;
  margin-bottom: 2rem;
}

.cta-dark-inner {
  position: relative;
  overflow: hidden;
  padding: 4.5rem 2rem;
  border-radius: 2rem;

  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.14), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #eef4fb 100%);

  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 70px rgba(15,23,42,0.08);
}

.cta-title {
  max-width: 850px;
  margin: 0 auto 1.5rem auto;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.cta-text {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.1rem;
  line-height: 1.7;
  color: #64748b;
}

@media (min-width: 992px) {
  .feature-copy-card {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

@media (max-width: 991.98px) {
  .hero-section {
    padding: 2.25rem 1.5rem;
  }
}

@media (max-width: 767.98px) {
  .landing-feature-section {
    padding: 1.25rem;
  }

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

  .landing-glass-card h2 {
    font-size: 1.65rem;
  }
}

/* Standardize Select2 placeholder/example text */
.select2-container 
.select2-selection--multiple 
.select2-search__field::placeholder {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Selected items text */
.select2-container 
.select2-selection--multiple {
    font-size: 0.875rem;
}

.sticky-analysis-banner {
  position: sticky !important;
  top: 64px;
  z-index: 1015;
  background: white;
}

.analysis-summary-title {
  font-size: 0.9rem;
  line-height: 1.15;
}

.analysis-summary-meta,
.analysis-summary-details {
  font-size: 0.75rem;
  line-height: 1.25;
}

.sticky-analysis-banner .btn-sm {
  --bs-btn-padding-y: 0.15rem;
  --bs-btn-padding-x: 0.45rem;
  --bs-btn-font-size: 0.75rem;
}

.analysis-filter-text {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  max-height: 3.25em;
  overflow-y: auto;
}

.selectable-510k-row {
    cursor: pointer;
}

.selected-analysis-row td {
    background-color: rgba(13,110,253,.12) !important;
}

.selectable-row {
    cursor: pointer;
}

.selectable-row.row-selected > td {
    background-color: #e8f1ff !important;
}

.selection-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

.selection-count {
    font-size: 0.9rem;
    color: #555;
}

.k510-sort-btn {
  font-weight: 600;
  text-decoration: none;
  color: inherit;
}

.k510-sort-btn:hover {
  text-decoration: underline;
}
/* Compact navigation stays available without consuming a multi-row header. */
.site-menu-bar {
  top: 0.5rem;
  z-index: 1030;
  padding: 0.45rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  background: rgba(var(--bs-light-rgb), 0.96);
  box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.site-menu-scroll {
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.site-menu-scroll::-webkit-scrollbar {
  display: none;
}

.site-menu-scroll .btn {
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .site-menu-bar {
    top: 0.25rem;
    margin-inline: -0.25rem;
    padding: 0.35rem;
  }
}
