/* Following core principle: Reduce complexity (single rule handles all anchor navigation) */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Account for fixed navbar height */
}

/* Dark Mode Support - CSS Custom Properties for theming */
:root {
  /* Light mode colors (default) */
  --bg-body-image: url("../images/page-background.jpg");
  --bg-body-color: #f5f5dc;
  --bg-content: white;
  --color-heading: #58180D;
  --color-text: #000;
  --color-link: #0066cc;
  --color-link-hover: #0052a3;
  --color-summary: #6b4fbb;
  --bg-skill-frame: lightblue;
  --bg-table-odd: #b5e2f1;
  --bg-table-even: #E5E8E8;
  --bg-descriptive: #b5e2f1;
  --bg-feat-header: #d42129;
  --bg-monster: #f2e5b5;
  --bg-search-input: #343a40;
  --color-search-input: #fff;
  --bg-search-results: #fff;
  --color-search-text: #333;
  --border-search: #495057;
  --bg-blockquote: #faebbc;
  --border-blockquote: #e1cc89;
  --bg-details: transparent;
  --border-details: rgba(90, 88, 88, 0.5);
  --filter-img: none;
}

/* Dark mode overrides */
html.dark-mode {
  --bg-body-image: none;
  --bg-body-color: #1a1a1a;
  --bg-content: #2d2d2d;
  --color-heading: #d4a574;
  --color-text: #e0e0e0;
  --color-link: #5eb3f6;
  --color-link-hover: #8eccff;
  --color-summary: #9d7fff;
  --bg-skill-frame: #2a3d4a;
  --bg-table-odd: #2a3d4a;
  --bg-table-even: #3a3a3a;
  --bg-descriptive: #2a3d4a;
  --bg-feat-header: #8b2e2e;
  --bg-monster: #3a3020;
  --bg-search-input: #2b3035;
  --color-search-input: #e0e0e0;
  --bg-search-results: #2d2d2d;
  --color-search-text: #e0e0e0;
  --border-search: #495057;
  --bg-blockquote: #3a3020;
  --border-blockquote: #5a4a2a;
  --bg-details: rgba(50, 50, 50, 0.3);
  --border-details: rgba(150, 150, 150, 0.3);
  --filter-img: brightness(0.85) contrast(1.1);
}

/* Apply theme variables to html first for immediate effect */
html {
  background-image: var(--bg-body-image);
  background-color: var(--bg-body-color);
  color: var(--color-text);
}

/* Apply theme variables */
body {
  background-image: var(--bg-body-image);
  background-color: var(--bg-body-color);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5 {
  color: var(--color-heading);
}

/* Link colors for dark mode */
a {
  color: var(--color-link);
}

a:hover {
  color: var(--color-link-hover);
}

/* Dark mode image adjustments */
html.dark-mode img:not(.navbar-brand img):not(#logo) {
  filter: var(--filter-img);
}

@font-face {
  font-family:SolberaImitationRemake;
  src:url('../fonts/Solbera Imitation Tweak.woff2');
  font-weight:normal;
  font-style:normal
}

@font-face {
  font-family:ScalySansRemake;
  src:url('../fonts/Scaly Sans.woff2');
  font-weight:normal;
  font-style:normal
}

@font-face {
  font-family:ScalySansSmallCapsRemake;
  src:url('../fonts/Scaly Sans Caps.woff2');
  font-weight:normal;
  font-style:normal
}

h1, h2, h3, h4, h5 {
  margin-bottom: 0;
  font-family: MrJeeves;
  font-weight: 900;
  font-variant: small-caps;
}

#logo {
  width: 400px;
  height: 50px;
  border-bottom-left-radius: 10px;
  border-top-left-radius: 10px;
}

/* Hide logo on mobile - reduce waste, maximize space */
@media (max-width: 991px) {
  .navbar-left {
    display: none;
  }
}

#main {
  height: 297mm;
}

h1 {
  font-size: 2.5em;
}

h2 {
  font-size: 2em;
  text-align: center;
  border-top: solid;
  border-bottom: solid;
  border-width: 1px;
}

h3 {
  font-size: 1.6em;
}
h4 {
  font-size: 1.4em;
}
h5 {
  font-size: 1.2em;
}

p {
  margin-bottom: 1em;
}

h1+p::first-letter {
  float:left;
  font-family:SolberaImitationRemake;
  font-style: unset;
  line-height:1em;
  font-size:3.5cm;
  padding-left:40px;
  margin-left:-40px;
  margin-top:-0.3cm;
  padding-bottom:2px;
  margin-bottom:-20px;
  background-image:linear-gradient(-45deg, #322814, #998250, #322814);
  background-clip:text;
  -webkit-background-clip:text;
  color:rgba(0,0,0,0)
}

.featuresTable+p::first-letter {
  float:left;
  font-family:SolberaImitationRemake;
  line-height:1em;
  font-size:3.5cm;
  padding-left:40px;
  margin-left:-40px;
  margin-top:-0.3cm;
  padding-bottom:2px;
  margin-bottom:-20px;
  background-image:linear-gradient(-45deg, #322814, #998250, #322814);
  background-clip:text;
  -webkit-background-clip:text;
  color:rgba(0,0,0,0)
}


table {
  margin-left: 10px;
  margin-bottom: 5px;
  /* background-image: url("../images/table.png");
  background-repeat: no-repeat;
  background-size: 100% 100%; */
  padding: 20px;
}

.td-nobreak {
  white-space: nowrap;
}

.td-center {
  text-align: center;
}

details {
  margin-top: 1px;
  margin-left: 20px;
  margin-right: 20px;
  margin-bottom: 1px;
  padding: 4px;
  border-style: double;
  border-width: 1px;
  border-color: var(--border-details);
  background-color: var(--bg-details);
  border-radius: 5px;
}

details p {
  margin-bottom: 2px;
  margin-top: 1em;
}

summary {
  color: var(--color-summary);
  cursor: pointer;
  display: list-item;
}

summary p {
  margin-bottom: 0px;
  margin-left: 10px;
  margin-top: 0px;
}

.dropdown li {
  overflow-y: scroll;
}

/* -------------------------------------------------------------------- */
/* nav bar dropdowns */
.navbar-nav a.dropdown-item {
  padding: 1px 10px;
}

/* Mobile-specific dropdown improvements */
@media (max-width: 991px) {
  .navbar-nav a.dropdown-item {
    padding: 12px 15px;
    font-size: 16px;
  }

  /* Better visual separation for subheaders on mobile */
  .navbar-nav a.dropdown-item b {
    display: block;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffc107;
  }

  .navbar-nav a.dropdown-item:first-child b {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  /* Indented sub-items more clearly */
  .navbar-nav a.dropdown-item[href*=" "] {
    padding-left: 25px;
  }
}


/* ----------------------------------------------------------------------------- */
/* bullet list into columns depending on screen size */

@media only screen and (min-width: 1025px) {
  .columns ul {
    -moz-column-count: 4;
    -moz-column-gap: 40px;
    -webkit-column-count: 4;
    -webkit-column-gap: 40px;
    column-count: 4;
    column-gap: 40px;
  }
  .columnssix ul {
    -moz-column-count: 6;
    -moz-column-gap: 40px;
    -webkit-column-count: 6;
    -webkit-column-gap: 40px;
    column-count: 6;
    column-gap: 40px;
  }
  .columnsthree ul {
    -moz-column-count: 3;
    -moz-column-gap: 30px;
    -webkit-column-count: 3;
    -webkit-column-gap: 30px;
    column-count: 3;
    column-gap: 30px;
  }
  .cursedcols ul, .columnstwo ul{
    -moz-column-count: 2;
    -moz-column-gap: 20px;
    -webkit-column-count: 2;
    -webkit-column-gap: 20px;
    column-count: 2;
    column-gap: 20px;
}
}

@media only screen and (min-width: 768px) and (max-width: 1024px) {
  .columns ul, .columnssix ul, .columnsthree ul {
      -moz-column-count: 2;
      -moz-column-gap: 20px;
      -webkit-column-count: 2;
      -webkit-column-gap: 20px;
      column-count: 2;
      column-gap: 20px;
  }
}
.columns ul, .columnsthree ul, .columnstwo ul, .columnssix ul {
  list-style: none;
  margin: 0 0 1.5em 0;
}

.columns li, .columnsthree li, .columnstwo li, .columnssix li {
  margin-bottom: 5px;
  break-inside: avoid !important;
}

.cursedcols li {
  margin-bottom: 5px;
  break-inside: avoid !important;
}

.noliststyle ul {
  list-style: none;
  margin: 0 0 1.5em 0;
}

.narrowcolumns ul, .narrowcolumns li, .narrowcolumns p {
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------------------------------------- */

.container-main {
  margin-top: 80px;
  margin-bottom: 80px;
  font-size: small;
  flex: 1; /* This makes the main content area grow to fill available space */
}

/* Legacy scroll-margin for older browsers, but html scroll-padding-top handles it better */
.internal-link {
  scroll-margin-top: 80px;
}

/* Anchors without href (used for scroll targets) should not look like links */
a.internal-link:not([href]),
a[name]:not([href]) {
  color: inherit;
  text-decoration: none;
  cursor: default;
}

.nav-tabs .nav-link {
  margin-bottom: 5px;
}

.nav-tabs .nav-link:hover {
  border-bottom: 1px solid grey;
}

.nav-tabs .nav-link.active {
  border-bottom: 2px solid #6b4fbb;
  background-color: lightgrey;
}

.skill-frame {
  background-color: var(--bg-skill-frame);
  border-image: url(../images/descriptiveBorder.png) 12 stretch;
  border-image-outset: 4px;
  border-style: double;
  border-width: 7px;
  font-family: ScalySansRemake;
  font-size: .318cm;
  line-height: 1.2em;
  margin-bottom: 5px;
  margin-left: 50px;
  margin-right: 20px;
  margin-top: 5px;
}

.skill-frame h5 {
  margin-top: 0px;
}

.skill-frame ul {
  margin-bottom: 0px;
}

.indextoc {
  margin: 10px 10px 0px 10px;
  padding: 5px;
  text-align:center
}

.toc {
  border: 1px solid var(--border-details);
  border-radius: 8px;
  float: right;
  margin: 10px 10px 0px 10px;
  padding: 5px;
  background-image: var(--bg-body-image);
  background-color: var(--bg-body-color);
}

.toc p {
  color: inherit;
  padding-left:10px;
}

.toc a {
  color: var(--color-link);
}



/* ----------------------------------------------------------------------- */
/* Class tables */

.classTable.frame {
  background-color: var(--bg-content);
  border: initial;
  border-collapse: separate;
  border-image-outset: 0.4cm 0.3cm;
  border-image-repeat: stretch;
  border-image-slice: 200;
  border-image-source: url(../images/frameBorder.png);
  border-image-width: 47px;
  border-style: solid;
  display: inline-block;
  margin-left: 10px;
  margin-top: 25px;
  margin-bottom: 25px;
  margin-right: 10px;
}

/* Force class tables to stay light mode (frameBorder.png has white center) */
html.dark-mode .classTable.frame {
  background-color: white;
  color: #000;
}

html.dark-mode .classTable.frame table {
  color: #000;
}

html.dark-mode .classTable.frame a {
  color: #0066cc;
}

html.dark-mode .classTable.frame a:hover {
  color: #0052a3;
}

html.dark-mode .classTable.frame th,
html.dark-mode .classTable.frame td {
  color: #000;
}

/* Preserve alternating row colors in light mode style */
html.dark-mode .classTable.frame table tr:nth-child(odd) td {
  background-color: #b5e2f1;
}

html.dark-mode .classTable.frame table tr:nth-child(even) td {
  background-color: white;
}

html.dark-mode .classTable.frame h1,
html.dark-mode .classTable.frame h2,
html.dark-mode .classTable.frame h3,
html.dark-mode .classTable.frame h4,
html.dark-mode .classTable.frame h5 {
  color: #58180D;
}

.classTable thead tr th {
  padding-left: 5px;
}

.halfClassTable {
  float:right;
}

.fillClassTable {
  width: 100%;
}

/* --------------------------------------------------------------------------- */
/* Archetype features tables */

.featuresTable {
  background-color: var(--bg-table-even);
  border-radius: 10px;;
  margin-left: 10px;
  margin-bottom: 0px;
  margin-right: 0px;
  margin-top: 0px;
  float:right;
}
.featuresTable h4 {
  padding: 5px;
  padding-left: 10px;
  background-color: var(--bg-feat-header);
  color: white;
  font-family: MrJeeves;
  font-size: large;
  font-size: 1.65em;
  font-weight: bold;
}

.featuresTable table {
  width: 95%;
}

.featuresTable th:first-child {
  text-align: center;
}



/* -------------------------------------------------------------------------- */

hr.classdivider {
  visibility: visible;
  height: 40px;
  margin: 0.12cm 0;
  background-image: url(../images/skull_divider.png);
  background-size: 100% 100%;
  border: none;
}

hr.dividerinfolk {
  visibility: visible;
  height: 5px;
  /* margin: 0.12cm 0; */
  margin-left: 20%;
  margin-right: 20%;
  background-image: url(../images/Decorative-Line-Black-PNG-Clipart.png);
  background-size: 100% 100%;
  border: none;
}

/* -------------------------------------------------------------------------- */

/* monster table stat color fix  */
.monster table tbody tr td {
  background-color: rgba(255, 0, 0, 0);
}

.monster.frame {
  border-style: solid;
  border-width: 7px 6px;
  background-color: var(--bg-monster);
  background-image: url(../images/parchmentBackgroundGrayscale.jpg);
  border-image: url(../images/monsterBorderFancy.png) 14 round;
  border-image-outset: 0px 2px;
  background-blend-mode: overlay;
  filter: drop-shadow(1px 4px 6px #888);
  padding: 4px 2px;
  margin-left: 50px;
  margin-right: 30px;
  max-width: 300px;
  float: left;
}

.monster {
  font-family: ScalySansRemake;
  font-size: .318cm;
  line-height: 1.2em;
  position: relative;
  padding: 0px;
  margin-bottom: 0.325cm;
  margin-left: 0px;
}

.monster hr {
  visibility: visible;
  height: 6px;
  margin: 0.12cm 0;
  background-image: url(../images/redTriangle.png);
  background-size: 100% 100%;
  border: none;
}

.multimonster.frame {
  margin: 0px;
  float: none;
}

/* --------------------------------------------------------------------------- */

/* Feat block */
.feat {
  background-color: var(--bg-table-even);
  color: var(--color-text);
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 0.95em;
  padding: 2px;
}

.feat h2 {
  padding: 5px;
  background-color: var(--bg-feat-header);
  color: white;
  font-size: large;
  font-weight: bold;
}


/* --------------------------------------------------------------------------- */

/* Info areas */
.descriptive, .infoarea {
  -webkit-box-align: center;
  font-family: ScalySansRemake;
  font-size: .318cm;
  line-height: 1.2em;
  border-style: solid;
  border-width: 7px;
  background-color: var(--bg-descriptive) !important;
  border-image: url(../images/descriptiveBorder.png) 12 stretch;
  border-image-outset: 4px;
  padding: 2px;
  filter: drop-shadow(0 0 3px #faf7ea);
  margin-bottom: 5px;
  margin-left: 5px;
  margin-top: 5px;
  margin-right: 0px;
  padding-bottom: -10px;
}

.descriptive h5, .infoarea h5 {
  font-family: ScalySansSmallCapsRemake;
  font-size: .423cm;
  font-weight: 900;
  line-height: .951em;
}

.descriptive p, .infoarea p {
  padding: 0px;
  margin: 0px
}

.infoarea {
  float: right;
  max-width: 50%;
}

.infoarea ul {
  margin-bottom: -8px;
}


.edictsbox {
  font-family: ScalySansRemake;
  font-size: .318cm;
  line-height: 1.2em;
  border-style: solid;
  border-width: 7px;
  background-color: var(--bg-descriptive) !important;
  border-image: url(../images/descriptiveBorder.png) 12 stretch;
  border-image-outset: 4px;
  padding: 2px;
  margin-left: 75px;
  margin-bottom: 5px;
}

/* Spell heading */
.spell {
  border-style: solid;
  border-width: 7px;
  background-color: var(--bg-descriptive) !important;
  border-image: url(../images/descriptiveBorder.png) 12 stretch;
  border-image-outset: 4px;
  max-width: 50%;
  padding: 2px;
  margin-left: 75px;
  margin-bottom: 5px;
}

.multispell {
  margin: 0px;
  float: none;
  max-width: unset;
  margin-left: unset;
  margin-bottom: unset;
}


/* -------------------------------------------------------------------------- */

.phb hr+blockquote {
  background-color: var(--bg-descriptive) !important;;
  background-position: center center;
  border-width: 6px;
  border-image: url(https://i.imgur.com/gtHyLi6.png);
  border-image-slice: 20 }

.phb blockquote {background-color: var(--bg-descriptive) !important;}
.phb hr+blockquote hr+ul {color: var(--color-text);}
.phb hr+blockquote table {color: var(--color-text);}

.phb hr+blockquote hr {
  filter: hue-rotate(180deg);
background-image: url(https://i.imgur.com/gtHyLi6.png)}

/* ------------------------------------------------------------------------------ */

/* Rest block */
.rest {
  float: right;
  margin-bottom: 5px;;
  margin-left: 10px;
  margin-right: 10px;
}

.restHeading {
  background-color: #1E5C05;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  color: white;
  font-family: MrJeeves;
  font-size: 1.5em;
  font-variant: small-caps;
  font-weight: bold;
  padding-left: 20px;
}

.restPad {
  padding: 0px 5px 0px 5px;
}

.restTable table{
  margin-left: 0px;
  width: 100%;
}

.restTable th:first-child {
  text-align: left;
}

.restTable th {
  background-color: var(--bg-table-even);
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  color: var(--color-text);
  font-size: 1.1em;
}


.restTable td {
  font-size: 0.95em;
  background-color: var(--bg-table-even) !important;
  color: var(--color-text);
}

.multirest {
  margin: 0px;
  float: none;
}

/* ----------------------------------------------------------------------------- */

/* Tables */
table tr:nth-child(odd) td {background-color: var(--bg-table-odd);}

/* styled Tables */
.sTable {
  background-color: var(--bg-table-odd);
  color: white;
  border-radius: 8px;
  margin-bottom: 15px;
  border-bottom: solid;
}

.sTable h4 { padding: 8px 0px 6px 10px ; }

.sTable th {
  background-color: var(--bg-table-even);
  color: var(--color-text);
}

.sTable td {
  font-size: 0.95em;
}

.sTable tr:nth-child(odd) td {
  background-color: var(--bg-table-even);
  color: var(--color-text);
}

.sTable tr:nth-child(even) td {
  background-color: var(--bg-content);
  color: var(--color-text);
}

/* Bootstrap table-striped styling for light and dark modes */
.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.05);
}

.table-striped tbody tr:nth-of-type(even) {
  background-color: transparent;
}

/* Dark mode table-striped styling */
html.dark-mode .table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--bg-table-odd) !important;
}

html.dark-mode .table-striped tbody tr:nth-of-type(even) {
  background-color: var(--bg-table-even) !important;
}

html.dark-mode .table-striped tbody tr td {
  color: var(--color-text) !important;
}

/* DataTables dynamic classes (used by spells/equipment pages) */
html.dark-mode table.dataTable tbody tr.odd {
  background-color: var(--bg-table-odd) !important;
}

html.dark-mode table.dataTable tbody tr.even {
  background-color: var(--bg-table-even) !important;
}

html.dark-mode table.dataTable tbody tr.odd td,
html.dark-mode table.dataTable tbody tr.even td {
  color: var(--color-text) !important;
}

/* Specific override for contentTable (spells/equipment pages) */
html.dark-mode #contentTable tbody tr td {
  color: var(--color-text) !important;
}

html.dark-mode #contentTable.dataTable tbody tr {
  color: var(--color-text) !important;
}

html.dark-mode table.table-striped tbody tr,
html.dark-mode table.table-hover tbody tr {
  color: var(--color-text) !important;
}

/* Quote blocks */

blockquote {
  font: 14px/20px italic Times, serif;
  padding: 8px;
  background-color: var(--bg-blockquote);
  border-top: 1px solid var(--border-blockquote);
  border-bottom: 1px solid var(--border-blockquote);
  background-position: top left;
  background-repeat: no-repeat;
  text-indent: 23px;
  max-width: 500px;
  margin: 5px;
  margin-left: 50px;
  color: var(--color-text);
}

blockquote p {
  margin: 0px;
}


.centerimg {
  text-align:center;
}

/* Search functionality styles */
#search-container {
  position: relative;
  margin-right: 20px;
}

#site-search-input {
  width: 250px;
  padding: 8px 12px;
  border: 1px solid var(--border-search);
  border-radius: 4px;
  background-color: var(--bg-search-input);
  color: var(--color-search-input);
  transition: all 0.3s ease;
}

#site-search-input:focus {
  outline: none;
  border-color: #80bdff;
  background-color: #2b3035;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#site-search-input::placeholder {
  color: #adb5bd;
}

/* Loading state animation - subtle pulse for d20 emoji */
#site-search-input:not(.search-ready)::placeholder {
  animation: searchPulse 2s ease-in-out infinite;
}

/* Ready state - subtle glow */
#site-search-input.search-ready {
  border-color: #28a745;
}

#site-search-input.search-ready:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.15);
}

@keyframes searchPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#search-results {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 400px;
  max-height: 500px;
  overflow-y: auto;
  background-color: var(--bg-search-results);
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1050;
  margin-top: 5px;
}

.search-result-item {
  display: block;
  padding: 6px 15px;
  text-decoration: none;
  color: var(--color-search-text);
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85em;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: #f8f9fa;
}

html.dark-mode .search-result-item:hover {
  background-color: #3a3d42;
}

.search-result-collection {
  display: inline;
  font-size: 0.75em;
  font-weight: 600;
  color: #6c757d;
  text-transform: capitalize;
  margin-right: 8px;
}

.search-result-title {
  display: inline;
  color: var(--color-search-text);
}

.search-result-match {
  font-size: 0.75em;
  color: #6c757d;
  font-style: italic;
}

.search-no-results {
  padding: 15px;
  text-align: center;
  color: #6c757d;
}

@media (max-width: 768px) {
  #site-search-input {
    width: 200px;
  }

  #search-results {
    width: 300px;
  }
}

/* Mobile navigation improvements */
@media (max-width: 991px) {
  /* Hide search by default on mobile */
  #search-container {
    display: none !important;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    width: 100%;
    padding: 10px;
    background-color: var(--bg-search-input);
    border-bottom: 1px solid var(--border-search);
    z-index: 1040;
  }

  #search-container.show {
    display: flex !important;
  }

  #site-search-input {
    width: 100%;
    flex: 1;
  }

  #search-results {
    width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
  }

  /* Touch-optimized dropdowns */
  .dropdown-menu {
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
  }

  .dropdown-item {
    padding: 12px 15px;
    font-size: 16px; /* Prevent iOS zoom */
  }

  /* Better spacing in navbar */
  .navbar-nav {
    width: 100%;
  }

  .navbar-collapse {
    max-height: 80vh;
    overflow-y: auto;
  }

  /* Stack search toggle and dark mode button vertically on mobile */
  .navbar-collapse {
    display: flex;
    flex-direction: column;
  }

  .navbar-collapse .navbar-nav {
    order: 1;
  }

  .navbar-collapse #mobile-search-toggle {
    order: 2;
    width: 100%;
    text-align: center;
    padding: 12px;
    margin: 5px 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
  }

  .navbar-collapse #dark-mode-toggle {
    order: 3;
    width: 100%;
    text-align: center;
    padding: 12px;
    margin: 5px 0;
  }
}

#dark-mode-toggle {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: 15px;
  padding: 6px 12px;
  transition: all 0.3s ease;
  line-height: 1;
}

#dark-mode-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

#dark-mode-toggle:active {
  transform: scale(0.95);
}

  #dark-mode-toggle {
    margin-left: 10px;
    padding: 4px 8px;
    font-size: 1rem;
  }
}
