/* =====================================================
   GLOBAL STYLES – CLEAN (STABLE BASE)
   Used by all public pages
===================================================== */

/* =====================================================
   RESET
===================================================== */

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

html { height: 100%; }

body {
  margin: 0;
  padding: 0;
  min-height: 100svh;   /* ✅ FIXED */
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
}

/* =====================================================
   MAP PAGE LAYOUT (STABLE + FULL WIDTH)
===================================================== */

body.map-filter-page main.page-wrapper {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: block;              /* ✅ normal flow (no flex shrink weirdness) */
}

body.map-filter-page #map-container-outer {
  width: 100%;
  max-width: 100%;
  margin: 30px auto 0;
  padding: 0 15px;
}

/* Keep map itself full width */
body.map-filter-page #map {
  width: 100%;
  display: block;
}

/* =====================================================
   HEADER
===================================================== */

header {
  background-color: var(--nhs-blue);
  color: var(--text-inverse);
  padding: 15px;
  text-align: center;
}

.header-content {
  margin: 0;
  text-align: center;
  padding-bottom: 10px;
  position: relative;
}

.site-title {
  margin-bottom: 8px;
  font-size: 2rem;
  font-weight: 700;
}

.admin-status {
  font-size: 14px;
  margin-bottom: 10px;
}

.header-link {
  color: var(--text-inverse);
  text-decoration: underline;
}

.inline-form { display: inline; margin: 0; padding: 0; }

.logout-button {
  background: none;
  border: none;
  color: var(--text-inverse);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

/* Navigation */

.nhs-nav a {
  margin: 0 5px;
  padding: 8px 12px;
  background-color: var(--nhs-blue);
  color: var(--text-inverse);
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.2s ease;
}

.nhs-nav a:hover,
.nhs-nav a:focus {
  background-color: #ffd200;
  color: #000000;
}

/* Accessibility */

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  padding: 10px 14px;
  z-index: 9999;
  background: var(--nhs-blue);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
}

.skip-link:focus { left: 10px; }

/* Theme Toggle */

.theme-toggle {
  position: absolute;
  top: 10px;
  right: 20px;
  background: transparent;
  border: 2px solid var(--text-inverse);
  border-radius: 50%;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: 0.3s ease;
  z-index: 99999;
  pointer-events: auto;
}

.theme-toggle:hover { opacity: 0.8; }

/* Thin blue separator */

.bluebarThin {
  width: 100vw;
  height: 5px;
  background-color: var(--nhs-blue);
  flex-shrink: 0;
}

/* =====================================================
   PAGE LAYOUT
===================================================== */

.page-wrapper {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

#main-container { width: 100%; }

.page-wrapper.flex-layout {
  display: flex;
  align-items: stretch;
  min-height: 100%;
}

.main-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: clamp(16px, 2vw, 28px);
  display: flex;
  flex-direction: column;
}

/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {
  width: 240px;
  background-color: var(--nhs-blue);
  padding: 20px 10px;
  color: var(--text-inverse);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-title {
  text-align: center;
  font-weight: bold;
  padding: 15px 10px;
  font-size: clamp(1.2rem, 0.8rem + 1vw, 1.8rem);
}

/* Sidebar Guidance (desktop/tablet) */

.sidebar-guidance-video {
  margin-top: auto;
  margin-bottom: 550px;
  font-size: 1rem;
  line-height: 1.5;
}

.sidebar-guidance-carousel {
  margin-bottom: 100px;
  font-size: 1rem;
  line-height: 1.5;
  border-top: 1px solid rgba(255,255,255,0.25);
}

.guidance-title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

/* =====================================================
   BUTTONS
===================================================== */

.button-styles,
.video-tab-btn-test,
.video-item-test {
  margin: 6px 0;
  padding: 10px;
  background-color: #0072ce;
  color: var(--text-inverse);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.button-styles:hover,
.video-tab-btn-test:hover,
.video-item-test:hover {
  background-color: #ffd200;
  color: #000000;
}

.button-active,
.video-tab-btn-test.active,
.video-item-test.active {
  background-color: #003087;
  color: var(--text-inverse);
}

.button-yellow,
.button-yellow:hover,
.button-yellow:focus,
.button-yellow.button-active {
  background-color: #ffd200;
  color: #000000;
  font-weight: 700;
  border-left: 6px solid #fbc02d;
}

/* ======================================================
   DISPLAY DATA PAGINATION — CSS ONLY (FORCE BUTTON LOOK)
====================================================== */

.pagination { margin-top: 30px; text-align: center; }

.pagination .current-page {
  display: block;
  margin: 12px 0;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-inverse);
}

.pagination a,
.pagination span {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 6px 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  color: var(--text-inverse);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 600;
}

.pagination a:hover { background: #ffd200; color: #000000; }

/* =====================================================
   CONTENT CARD
===================================================== */

.info-content {
  width: 100%;
  max-width: 100%;
  padding: clamp(20px, 2vw, 36px);
  background-color: var(--bg-card);
  border-radius: 12px;
  margin: 0 0 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.info-content h2 { text-align: center; margin-bottom: 0.75em; }
.info-content p { margin: 10px 0; line-height: 1.6; }

/* =====================================================
   VIDEO LIBRARY
===================================================== */

.video-library-test {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 32px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.10),
              0 2px 8px rgba(0,0,0,0.06);
}

.video-tabs-test {
  display: flex;
  max-width: 1200px;
  margin: 16px auto 0;
  background-color: var(--nhs-blue);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.video-tab-btn-test {
  flex: 1;
  padding: 14px 12px;
  border-radius: 0;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.video-tab-btn-test:last-child { border-right: none; }

.video-layout-test {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 20px;
}

.video-list-test {
  width: 260px;
  display: flex;
  flex-direction: column;
}

.video-player-wrap,
.video-player-wrap-test {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.video-player-wrap video,
.video-player-wrap-test video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#video-title-test {
  margin-top: 10px;
  text-align: center;
  font-weight: 600;
}

/* =====================================================
   CAROUSEL
===================================================== */

.carousel-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 48px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  position: relative;
}

.carousel-track-wrapper { overflow: hidden; width: 100%; }

.carousel-track {
  display: flex;
  gap: 12px;
  transition: transform 0.4s ease;
}

.carousel-track .image-link {
  width: 220px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-section);
  border-radius: 12px;
  flex: 0 0 auto;
}

.carousel-track .image-link img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.carousel-container .prev-btn,
.carousel-container .next-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,94,184,0.9);
  color: var(--text-inverse);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  z-index: 10;
  padding: 0;
  margin: 0;
  font-size: 1.2rem;
  line-height: 1;
}

.carousel-container .prev-btn { left: 10px; }
.carousel-container .next-btn { right: 10px; }

.carousel-container .prev-btn:hover,
.carousel-container .next-btn:hover {
  background-color: #ffd200;
  color: #000000;
}

/* =====================================================
   LIGHTBOX
===================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.lightbox.hidden { display: none; }

.lightbox-content {
  background: var(--bg-card);
  padding: 28px 32px;
  border-radius: 16px;
  max-width: 900px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
}

#carousel-lightbox { cursor: pointer; }

#carousel-lightbox img {
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 16px auto;
  cursor: default;
}

/* =====================================================
   POLICY PAGES
===================================================== */

.policy-section {
  width: 100%;
  max-width: 900px;
  margin: 60px auto;
  padding: 36px;

  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);

  line-height: 1.7;
}

/* Main title */

.policy-section h1 {
  font-size: 32px;
  margin-bottom: 24px;
  color: var(--section-heading);
}

/* Section headings */

.policy-section h2 {
  margin-top: 36px;
  margin-bottom: 10px;
  font-size: 20px;
  color: var(--section-heading);
}

/* Paragraph spacing */

.policy-section p {
  margin-bottom: 14px;
}

/* Lists */

.policy-section ul {
  margin: 12px 0 20px 22px;
}

.policy-section li {
  margin-bottom: 6px;
}

/* Links */

.policy-section a {
  color: var(--nhs-blue);
  text-decoration: underline;
}

.policy-section a:hover {
  text-decoration: none;
}

/* =====================================================
   POLICY INTRO BOX
===================================================== */

.policy-intro-box {
  background: var(--bg-card);
  border-left: 5px solid var(--nhs-blue);
  padding: 14px 18px;
  margin-bottom: 24px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.policy-intro-box p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
}
.policy-intro-box strong {
  display:block;
  margin-bottom:4px;
  font-size:0.85rem;
  color:var(--text-muted);
  letter-spacing:0.4px;
}
/* =====================================================
   FOOTER (LOCKED LIGHT STYLE)
===================================================== */

.footer-container {
  background: #f0f4f5;
  color: #1d1d1d;
  padding: 2rem 1rem;
  margin-top: auto;
  text-align: center;
  width: 100%;
}

.footer-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.footer-logos img {
  height: 60px;
  width: auto;
}

.footer-links a {
  color: #005eb8;
  text-decoration: none;
  margin: 0 1rem;
  font-size: 0.9rem;
}

.footer-links a:hover {
  text-decoration: underline;
}
/* =====================================================
   CANONICAL TRIAL RESULTS TABLE
===================================================== */

.trial-results-table-wrap {
  max-width: 1200px;
  margin: 30px auto;
  padding: 15px;
  background: var(--bg-card);
  border: 2px solid var(--accent-border);
  border-radius: 6px;
}

.trial-results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.trial-results-table thead th {
  background: var(--nhs-blue);
  color: var(--text-inverse);
  padding: 10px;
  text-align: left;
  font-weight: bold;
  border: none;
  border-bottom: 1px solid var(--border-light);
}

.trial-results-table tbody tr {
  background: var(--table-row-bg, #ffffff);
  transition: background 0.2s ease;
}

.trial-results-table tbody tr:nth-child(even) { background: var(--table-row-alt, #f5f8fb); }

.trial-results-table tbody tr:hover {
  background: var(--table-row-hover, #e9eef3);
  cursor: pointer;
}

.trial-results-table tbody td {
  padding: 10px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  color: var(--text-primary);
}

/* Dark Mode Table */

html[data-theme="dark"] .trial-results-table tbody tr { background: #163c6b; }
html[data-theme="dark"] .trial-results-table tbody tr:nth-child(even) { background: #1b4678; }
html[data-theme="dark"] .trial-results-table tbody tr:hover { background: #0f2f57; }
html[data-theme="dark"] .trial-results-table tbody td { border-bottom: 1px solid rgba(255,255,255,0.1); color: var(--text-inverse); }
html[data-theme="dark"] .trial-results-table thead th { border-bottom: 1px solid rgba(255,255,255,0.15); }

.results-section { display: none; }

/* =====================================================
   RESPONSIVE SYSTEM – TABLET + MOBILE
===================================================== */

/* =====================================================
   iPad Landscape (≤1100px)
   Body Filter tablet layout
===================================================== */

@media (max-width: 1100px) {

  body.body-filter-page .bodyfilter-wrapper { margin: 20px auto; }
  body.body-filter-page .bodyfilter-card { padding: 20px 16px; }

  body.body-filter-page .content.body-filter-layout {
    grid-template-columns: 1fr;
    gap: 25px;
    text-align: center;
  }

  body.body-filter-page .body-center {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 25px;
  }

  body.body-filter-page .left-buttons-inner,
  body.body-filter-page .right-buttons-inner {
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
  }

  body.body-filter-page .button-background {
    width: 150px;
    height: 150px;
  }

  body.body-filter-page #body-filter-helper {
    width: 300px;
    max-width: 100%;
    height: auto;
  }

  body.body-filter-page .image-section img {
    width: 100%;
    max-width: 420px;
    height: auto;
  }

  body.body-filter-page .filter-title { font-size: 1.4rem; }
  body.body-filter-page #UserInstruction h2 { font-size: 1.2rem; }
  body.body-filter-page #UserInstruction p { font-size: 0.9rem; }
}

/* =====================================================
   iPad Portrait (≤900px)
   Sidebar stacks ABOVE content
===================================================== */

@media (max-width: 900px) {
  .page-wrapper.flex-layout { flex-direction: column; }
  .sidebar { width: 100%; padding: 20px; }
  .main-content { width: 100%; padding: 20px; }
}

/* =====================================================
   MOBILE (≤768px) + MOBILE LANDSCAPE (short height)
===================================================== */

@media (max-width: 900px) and (max-height: 500px),
       (max-width: 768px) {

  /* ✅ allow scrolling on small screens (fixes “trapped” page) */
  body { overflow-y: auto !important; }

  /* Full-width wrapper */
  .page-wrapper {
    max-width: 100%;
    width: 100%;
  }

  header,
  .site-header {
    width: 100%;
    max-width: none;
    padding: 12px 12px 10px;
  }

  .header-content { padding-bottom: 8px; }

  .site-title {
    font-size: 1.6rem;
    line-height: 1.1;
    margin-bottom: 6px;
  }

  .admin-status {
    font-size: 12px;
    margin-bottom: 8px;
  }

  /* Nav wraps cleanly */
  .nhs-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0 8px 6px;
    margin: 0;
  }

  .nhs-nav a {
    margin: 0;
    padding: 8px 10px;
    font-size: 0.95rem;
    white-space: nowrap;
  }

  /* Theme toggle */
  .theme-toggle {
    top: 8px;
    right: 10px;
    padding: 5px 9px;
    font-size: 14px;
  }

  /* Hide sidebar guidance on mobile */
  .sidebar-guidance-video,
  .sidebar-guidance-carousel,
  .sidebar-spacer {
    display: none !important;
  }

  /* Content padding */
  .main-content { padding: 16px; }

  /* =====================================================
     MOBILE TABLE – FORCE CORRECT COLUMNS
  ===================================================== */

  /* BODY FILTER: no horizontal scroll */
  body.body-filter-page .trial-results-table-wrap {
    overflow-x: hidden !important;
  }

  /* MAP FILTER: no horizontal scroll */
  body.map-filter-page .trial-results-table-wrap {
    overflow-x: hidden !important;
  }

  /* Reset any previous display hacks */
  .trial-results-table th,
  .trial-results-table td {
    display: table-cell !important;
  }

  /* Hide Brief Synopsis + Brief Eligibility on mobile (ALL pages) */
  .trial-results-table th:nth-child(3),
  .trial-results-table td:nth-child(3),
  .trial-results-table th:nth-child(4),
  .trial-results-table td:nth-child(4) {
    display: none !important;
  }

  /* Ensure View column is visible */
  .trial-results-table th:nth-child(5),
  .trial-results-table td:nth-child(5) {
    display: table-cell !important;
  }

  /* Body Filter only uses fixed layout on mobile */
  body.body-filter-page .trial-results-table {
    width: 100%;
    table-layout: fixed;
  }

  /* Column sizing – Body Filter only */
  body.body-filter-page .trial-results-table td:nth-child(1) { width: 45%; }

  body.body-filter-page .trial-results-table td:nth-child(2) {
    width: 30%;
    text-align: center;
  }

  body.body-filter-page .trial-results-table td:nth-child(5) {
    width: 25%;
    text-align: center;
  }

  /* Mobile View button – clean compact version */
  .trial-results-table td:nth-child(5) .button-59 {
    display: inline-block;
    width: auto;
    max-width: none;
    padding: 8px 14px;
    font-size: 0.9rem;
    white-space: nowrap;
    border-radius: 10px;
  }

  /* Clean padding */
  .trial-results-table td {
    padding: 12px 8px;
    vertical-align: middle;
  }

  /* Allow wrapping everywhere EXCEPT the View column */
  .trial-results-table td:not(:last-child) {
    word-break: break-word;
  }

  /* Larger indication icon on mobile */
  .trial-results-table td:nth-child(2) img {
    width: 56px;
    max-width: 56px;
    height: auto;
  }

  /* =====================================================
     MOBILE MAP – HEIGHT + “FIT IN BOX” FIX
  ===================================================== */

  body.map-filter-page #map-container-outer {
    width: 100% !important;
    max-width: 100% !important;
    margin: 14px auto 0 !important;
    padding: 0 12px !important;
  }

  body.map-filter-page #map {
    width: 100% !important;
    height: 55vh !important;      /* ✅ base for mobile portrait */
    min-height: 220px !important; /* ✅ prevent collapse */
    max-height: 520px !important; /* ✅ prevent takeover */
    border: 2px solid var(--accent-border);
    border-radius: 6px;
    overflow: hidden;
  }

  /* Leaflet uses the same element (#map) as the container */
  body.map-filter-page #map.leaflet-container {
    height: 100% !important;
  }

  /* ✅ LANDSCAPE: reduce map + compress instruction panel */
  @media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {

    body.map-filter-page #map {
      height: 45vh !important;     /* ✅ frees space for content below */
      min-height: 180px !important;
      max-height: 340px !important;
    }

    /* Make the instruction card compact (instead of huge) */
    body.map-filter-page #UserInstruction {
      margin: 12px auto !important;
      padding: 14px !important;
    }

    body.map-filter-page #UserInstruction h2 {
      font-size: 1.2rem !important;
      margin-bottom: 6px !important;
    }

    body.map-filter-page #UserInstruction p {
      font-size: 0.9rem !important;
      margin: 6px 0 !important;
    }
  }

  /* =====================================================
     MOBILE VIDEO
  ===================================================== */

  .video-library-test {
    padding: 16px;
    border-radius: 14px;
  }

  .video-tabs-test {
    flex-wrap: wrap;
    border-radius: 12px;
  }

  .video-tab-btn-test {
    flex: 1 1 50%;
    padding: 12px 10px;
    font-size: 0.95rem;
    border-right: 1px solid rgba(255,255,255,0.15);
  }

  .video-layout-test {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .video-list-test { width: 100%; }

  .video-item-test {
    width: 100%;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.95rem;
  }

  .video-player-wrap,
  .video-player-wrap-test {
    width: 100%;
    max-width: 100%;
    border-radius: 14px;
  }

  .video-player-wrap video,
  .video-player-wrap-test video,
  .video-player-wrap iframe,
  .video-player-wrap-test iframe {
    width: 100%;
    height: 100%;
    display: block;
  }

  #video-title-test {
    font-size: 0.95rem;
    margin-top: 8px;
  }

  /* =====================================================
     MOBILE FOOTER
  ===================================================== */

  footer {
    padding: 25px 16px !important;
    text-align: center;
  }

  .footer-logos {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
  }

  .footer-logos img {
    max-width: 160px;
    height: auto;
  }

  footer .footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
  }

  footer .footer-links a {
    font-size: 0.95rem;
    text-decoration: none;
  }

  footer p {
    font-size: 0.9rem;
    margin: 8px 0;
  }

  footer a[href*="login"] {
    display: inline-block;
    margin-top: 12px;
    font-weight: 600;
  }
}

/* =====================================================
   MAP PAGE – MOBILE LANDSCAPE HARD FIX
   (Stops flex + 100vh causing stretch issues)
===================================================== */

@media (max-width: 900px) and (max-height: 500px) {

  body.map-filter-page {
    display: block !important;      /* 🔥 kill flex */
    min-height: auto !important;    /* 🔥 remove 100vh behaviour */
  }

  body.map-filter-page .page-wrapper {
    display: block !important;
    min-height: auto !important;
  }

  body.map-filter-page main.page-wrapper {
    display: block !important;
  }

  /* Reduce map height further for landscape */
  body.map-filter-page #map {
    height: 42vh !important;
    min-height: 180px !important;
    max-height: 320px !important;
  }

}
/* =====================================================
   FINAL LANDSCAPE HEIGHT FIX (Short Screens)
===================================================== */

@media (max-width: 900px) and (max-height: 500px) {

  body.map-filter-page #map {
    height: 38vh !important;   /* smaller map */
    min-height: 160px !important;
    max-height: 260px !important;
  }

}
/* =====================================================
   ULTRA SHORT LANDSCAPE FIT FIX (≤500px height)
   Makes everything fit without scroll
===================================================== */

@media (max-width: 900px) and (max-height: 500px) {

  /* Reduce header height */
  header {
    padding: 10px 12px !important;
  }

  .site-title {
    font-size: 1.4rem !important;
    margin-bottom: 4px !important;
  }

  .nhs-nav a {
    padding: 6px 8px !important;
    font-size: 0.85rem !important;
  }

  /* Reduce map further */
  body.map-filter-page #map {
    height: 34vh !important;
    min-height: 140px !important;
    max-height: 220px !important;
  }

  /* Compress instruction panel */
  #UserInstruction {
    margin: 8px auto !important;
    padding: 10px 12px !important;
  }

  #UserInstruction h2 {
    font-size: 1rem !important;
    margin-bottom: 4px !important;
  }

  #UserInstruction p {
    font-size: 0.85rem !important;
    margin: 4px 0 !important;
    line-height: 1.3 !important;
  }

}

/* =========================================
   CAROUSEL LIGHTBOX LAYOUT
========================================= */

.lightbox-content {
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  align-items: center;
  justify-items: center;
  max-width: 1200px;
  margin: auto;
}

/* Left button */
.lightbox-prev {
  grid-column: 1;
  font-size: 40px;
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
}

/* Image + text container */
.lightbox-main {
  grid-column: 2;
  text-align: center;
}

.lightbox-main img {
  max-width: 100%;
  height: auto;
}

/* Right button */
.lightbox-next {
  grid-column: 3;
  font-size: 40px;
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
}
/* ==============================
   ADMIN ROLE BADGES
============================== */

.role-badge{
  margin-left:8px;
  padding:3px 8px;
  border-radius:4px;
  font-size:12px;
  font-weight:700;
  letter-spacing:.5px;
  display:inline-block;
  text-transform:uppercase;
}

/* Super Admin */

.role-super-admin{
  background:#c62828;
  color:white;
  box-shadow:0 0 6px rgba(198,40,40,0.6);
}

/* Admin */

.role-admin{
  background:#ff9800;
  color:black;
}

/* ========================================
   Rich Text Editor
   Shared between Admin + Frontend
======================================== */

.rich-editor-wrapper {
    border: 1px solid #d8dde3;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
    margin-top: 6px;
    width: 100%;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid #d8dde3;
    background: #f5f7fa;
}

.editor-btn {
    background: #ffffff;
    border: 1px solid #cfd6dd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.editor-btn:hover {
    background: #eef3f7;
}

.editor-btn:active {
    background: #dfe7ef;
}

.editor-toolbar select {
    border: 1px solid #cfd6dd;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 13px;
}

/* Editor area */

.rich-text {
    min-height: 160px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
}

.rich-text:focus {
    background: #fffdf7;
}

/* Lists */

.rich-text ul {
    margin-left: 20px;
    list-style: disc;
}

.rich-text ol {
    margin-left: 20px;
    list-style: decimal;
}

/* Highlight */

.rich-text mark {
    background: #fff59d;
}



/* ========================================
   SUBMIT STUDY PAGE LAYOUT
======================================== */

.submit-info-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.submit-info-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}



/* ========================================
   FORM GRID (matches Admin page)
======================================== */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px 40px;
    margin-bottom: 20px;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.form-group.full-width {
    grid-column: 1 / -1;
}



/* ========================================
   FORM INPUTS
======================================== */

.form-label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #2a2a2a;
}

.form-input,
.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cfd6dd;
    border-radius: 4px;
    font-size: 14px;
    background: #ffffff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #005EB8;
}



/* ========================================
   RICH EDITOR GRID FIX
======================================== */

.form-grid .rich-editor-wrapper {
    grid-column: 1 / -1;
}



/* ========================================
   SUBMIT BUTTON
======================================== */

.submit-study-action {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.submit-study-btn {
    background: #005EB8;
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}

.submit-study-btn:hover {
    background: #004a94;
}

.editor-toolbar button {
    user-select: none;
}

.editor-toolbar button:focus {
    outline: none;
}
.editor-toolbar button {
    pointer-events: auto;
}

.editor-toolbar button:active {
    transform: translateY(1px);
}

/* =================================
   Rich Text Editor (Public Forms)
================================ */

.rich-editor-wrapper {
  border: 1px solid #d8dde0;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: #f6f8fa;
  border-bottom: 1px solid #d8dde0;
}

.editor-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid #cfd8dc;
  background: #ffffff;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.editor-btn:hover {
  background: #eef4f5;
}

.editor-toolbar select {
  height: 36px;
  border-radius: 6px;
  border: 1px solid #cfd8dc;
  padding: 4px 8px;
  font-size: 14px;
  background: white;
}

.rich-text {
  min-height: 160px;
  padding: 14px;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
}

.rich-text:empty:before {
  content: "Start typing...";
  color: #888;
}

.submission-success{
background:#e6f4ea;
border:1px solid #b7e1c0;
color:#1e7e34;
padding:14px 18px;
border-radius:6px;
margin-bottom:20px;
font-weight:600;
}

.submission-error{
background:#fdecea;
border:1px solid #f5c6cb;
color:#842029;
padding:14px 18px;
border-radius:6px;
margin-bottom:20px;
font-weight:600;
}
.submission-success i{
margin-right:8px;
}

.video-player-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.video-player-container video,
.video-player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* =============================
   NHS SELECT (VIDEO FILTER)
============================= */

.video-language-filter {
  margin-bottom: 16px;
}

.nhs-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #212b32;
}

/* Wrapper for arrow styling */
.nhs-select-wrapper {
  position: relative;
  max-width: 320px;
}

/* Main select */
.nhs-select {
  width: 100%;
  padding: 10px 40px 10px 12px;
  font-size: 16px;
  border: 2px solid #005eb8;
  border-radius: 6px;
  background-color: #ffffff;
  color: #212b32;
  appearance: none;
  cursor: pointer;
}

/* Custom arrow */
.nhs-select-wrapper::after {
  content: "▼";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 12px;
  color: #005eb8;
}

/* Focus state */
.nhs-select:focus {
  outline: none;
  border-color: #ffb81c;
  box-shadow: 0 0 0 3px rgba(255, 184, 28, 0.3);
}

/* Hover */
.nhs-select:hover {
  border-color: #003087;
}
/* =============================
   VIDEO LANGUAGE FILTER (NHS CLEAN - TOP LEFT)
============================= */

.video-language-filter {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-bottom: 12px;
}

/* Label */
.video-label {
  font-weight: 600;
  font-size: 16px;
  color: #212b32;
  margin: 0;
}

/* Select */
.video-select {
  padding: 6px 10px;

  font-size: 15px;
  line-height: 1.4;

  border: 2px solid #005eb8;
  border-radius: 4px;

  background-color: #ffffff;
  color: #212b32;

  min-width: 220px;
  max-width: 260px;

  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Hover */
.video-select:hover {
  border-color: #003087;
}

/* Focus (NHS accessibility) */
.video-select:focus {
  outline: none;
  border-color: #ffb81c;
  box-shadow: 0 0 0 3px rgba(255, 184, 28, 0.35);
}