/*
 * Cryptaforge Theme for Crypta (Refactored)
 * Dark-mode now handled purely by CSS variables.
 * All component rules read from variables so we only override tokens
 * in the @media (prefers-color-scheme: dark) block.
 */

/* ==========================================
   CSS CUSTOM PROPERTIES (Variables)
   ========================================== */

:root {
  --link-color: #e6713b;

  /* Priority colors for tables */
  --priority-0: #ffb7b7;
  --priority-0-alt: #e69e9e;
  --priority-1: #ffcea7;
  --priority-1-alt: #e6b58e;
  --priority-2: #ffeba7;
  --priority-2-alt: #e6d28e;
  --priority-3: #ddffa7;
  --priority-3-alt: #c4e68e;
  --priority-4: #a7ffbc;
  --priority-4-alt: #8ee6a3;
  --priority-5: #a7fff8;
  --priority-5-alt: #8ee6df;
  --priority-6: #a7caff;
  --priority-6-alt: #8eb1e6;

  /* Infobox colors */
  --infobox-warning: #f5a623;
  --infobox-alert: #e74c3c;
  --infobox-error: #e74c3c;
  --infobox-query: #9b59b6;
  --infobox-success: #27ae60;

  /* Spacing and layout */
  --content-max-width: 1200px;
  --content-padding: 24px;
  --navbar-height: 40px;
  --border-radius: 6px;
  --transition-speed: 0.2s;
  --shadow-base: 0 2px 8px rgba(0, 0, 0, 0.3);

  /* Typography */
  --font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --font-size-base: 16px;
  --font-size-small: 14px;
  --font-size-tiny: 12px;
  --line-height: 1.5;

  /* Additional colors used throughout the theme */
  --white: #ffffff;
  --gray-light: #f5f5f5;
  --gray-medium: #e8e8e8;
  --gray-border: #ddd;
  --gray-text: #666;
  --gray-muted: #999;
  --gray-border-medium: #ccc;
  --gray-border-light: #eee;
  --gray-text-light: #bbb;
  --blue-accent: #4a90e2;

  /* Button colors */
  --button-primary: #ff6b35;
  --button-primary-hover: #e55a2e;
  --button-primary-active: #d34a27;

  /* Gradient colors */
  --gradient-start: #f5f5f5;
  --gradient-end: #f9f9f9;

  /* Semi-transparent overlays */
  --overlay-light: rgba(0, 0, 0, 0.2);
  --overlay-subtle: rgba(0, 0, 0, 0.1);

  /* Additional specific colors */
  --accent-hover-dark: #d45a1f;
  --gray-nav: #e2e2e2;

  /* ================================
     THEME ABSTRACTIONS (new tokens)
     These make light/dark purely token-driven
     ================================ */
  /* Menus (dropdowns) */
  --menu-shadow: none; /* can be real shadow in dark */

  /* Inputs / textareas */
  --input: var(--text-primary);

  /* Cards / panels (e.g., bookmark tiles, plugin panels) */
  --card-bg: var(--white);
  --panel-bg: var(--white);

  /* Theme toggle hover */
  --theme-toggle-hover-bg: rgba(0, 0, 0, 0.05);

  /* Bookmarks */
  --bookmarks-box: var(--navbar-bg);
  --desc-color: var(--gray-text);
  --bookmark-row-hover: #f8f8f8;

  /* Configuration */
  --config-li-alt-bg: var(--gray-border-light);
}

/* ==========================================
   DARK THEME TOKENS (variables only)
   ========================================== */
:root[data-theme="dark"] {
  /* Base surfaces & text */
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-tertiary: #2a2a2a;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-muted: #808080;
  --border-color: #3a3a3a;

  /* Accent & links */
  --accent-color: #ff8c5a;
  --accent-hover: #ff7644;
  --link-color: #ff8c5a;

  /* Component variables that differed in dark rules */
  --navbar-bg: var(--bg-secondary);
  --navbar-border: var(--border-color);
  --navbar-text: var(--accent-hover);
  --nav-link: var(--accent-color);
  --nav-link-hover: var(--accent-color);

  --status-bar-bg: var(--bg-secondary);
  --status-bar-border: var(--border-color);

  /* Dropdown menus */
  --menu-bg: var(--bg-tertiary);
  --menu-border: var(--border-color);
  --menu-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Inputs / cards / panels */
  --input-bg: var(--bg-tertiary);
  --input-disabled: #6a6a6a;
  --input-disabled-bg: #2a2a2a;
  --input-disabled-border: #3a3a3a;
  --card-bg: transparent;
  --panel-bg: var(--bg-secondary);

  /* Progress bar */
  --progressbar-bg: var(--bg-tertiary);
  --progressbar-gradient: none;
  --progressbar-border: 1px solid var(--border-color);
  --progressbar-box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1);

  /* Infobox */
  --infobox-header: var(--text-primary);
  --infobox-alert-bg: rgba(231, 76, 60, 0.1);
  --infobox-warning-bg: rgba(245, 166, 35, 0.1);
  --infobox-information-bg: rgba(74, 144, 226, 0.1);
  --infobox-information: #4a90e2;

  /* Bookmarks */
  --bookmarks-box: var(--text-primary);
  --desc-color: var(--text-secondary);
  --bookmark-row-hover: rgba(255, 255, 255, 0.1);

  /* Buttons */
  --button-primary: #cc5a2e; /* darker base */
  --button-primary-hover: var(--accent-color);
  --button-primary-active: var(--accent-hover);

  /* Activelink colors for dark mode */
  --activelink-placeholder-bg: #2a2a2a;
  --activelink-placeholder-border: #3a3a3a;
  --activelink-placeholder-hover-bg: #242424;
  --activelink-placeholder-hover-border: #808080;
  --activelink-loading-bg: rgba(74, 144, 226, 0.15);
  --activelink-loading-border: rgba(74, 144, 226, 0.4);
  --activelink-loading-hover-bg: rgba(74, 144, 226, 0.25);
  --activelink-loading-text: #4a90e2;

  /* Extra */
  --shadow-dark: rgba(0, 0, 0, 0.3);
  --theme-toggle-hover-bg: rgba(255, 255, 255, 0.08);

  /* Error backgrounds for dark theme */
  --error-bg-light: rgba(231, 76, 60, 0.1);

  /* Configuration */
  --config-li-alt-bg: rgba(255, 255, 255, 0.05);

  /* Dismiss buttons for dark mode - more subtle styling */
  --dismiss-btn-bg: rgba(255, 255, 255, 0.08);
  --dismiss-btn-color: #888;
  --dismiss-btn-border: rgba(255, 255, 255, 0.15);
  --dismiss-btn-hover-bg: rgba(255, 255, 255, 0.12);
  --dismiss-btn-hover-color: #aaa;
  --dismiss-btn-hover-border: rgba(255, 255, 255, 0.25);
}

  /* ==========================================
     LIGHT THEME TOKENS (explicit override)
     ========================================== */
:root[data-theme="light"] {
  /* Base surfaces & text - explicit light theme values */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f7;
  --bg-tertiary: #f0f0f0;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #808080;
  --border-color: #e5e5e5;

  /* Accent & links */
  --accent-color: #e6713b;
  --accent-hover: #d4521a;
  --link-color: #e6713b;

  /* Component variables for light mode */
  --navbar-bg: #1a1a1a;
  --navbar-border: #333;
  --navbar-text: #bbb;
  --nav-link: var(--text-primary);
  --nav-link-hover: var(--text-primary);

  --status-bar-bg: #fff;
  --status-bar-border: #eee;

  --infobox-header: var(--navbar-bg);
  --infobox-information: #4a90e2;
  --infobox-alert-bg: rgba(231, 76, 60, 0.1);
  --infobox-warning-bg: rgba(245, 166, 35, 0.1);
  --infobox-information-bg: rgba(74, 144, 226, 0.1);

  /* Dropdown menus */
  --menu-bg: var(--white);
  --menu-border: var(--overlay-light);
  --menu-shadow: none;

  /* Inputs / cards / panels */
  --input-bg: var(--white);
  --input-disabled: #a0a0a0;
  --input-disabled-bg: #f5f5f5;
  --input-disabled-border: #e0e0e0;
  --card-bg: var(--white);
  --panel-bg: var(--white);

  /* Progress bar */
  --progressbar-bg: var(--bg-secondary);
  --progressbar-gradient: linear-gradient(
      to bottom,
      var(--gradient-start),
      var(--gradient-end)
  );
  --progressbar-border: none;
  --progressbar-box-shadow: inset 0 1px 2px var(--overlay-subtle);

  /* Theme toggle hover */
  --theme-toggle-hover-bg: rgba(0, 0, 0, 0.05);

  /* Activelink colors for light mode */
  --activelink-placeholder-bg: #f5f5f5;
  --activelink-placeholder-border: #ddd;
  --activelink-placeholder-hover-bg: #e8e8e8;
  --activelink-placeholder-hover-border: #ccc;
  --activelink-loading-bg: #f0f8ff;
  --activelink-loading-border: #b3d9ff;
  --activelink-loading-hover-bg: #e6f3ff;
  --activelink-loading-hover-border: #99ccff;
  --activelink-loading-text: #4a90e2;

  /* Error backgrounds for light theme */
  --error-bg-light: #f0e8e8;

  /* Configuration */
  --config-li-alt-bg: var(--gray-border-light);
}

/* ==========================================
   PAGE COMPONENTS (migrated from index.html)
   ========================================== */

/* Navbar logo uses project logo */
.logo-link {
  background-image: url('images/crypta_logo.png');
  border-radius: 4px;
  background-color: transparent;
}

/* Ensure navbar is flush to the top */
#navbar { top: 0; }

/* Layout containers */
main#content {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 80px var(--content-padding) 120px;
  display: flex;
  flex-direction: column;
  gap: 120px;
}

section {
  display: grid;
  gap: 32px;
}

/* Hero section */
.hero {
  position: relative;
  padding: 48px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 107, 53, 0.12), rgba(74, 144, 226, 0.12));
  box-shadow: var(--shadow-base);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.hero-lede {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  max-width: 540px;
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 360px;
}

.hero-kpis { display: grid; gap: 12px; }
.hero-kpis li {
  list-style: none;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-base);
}

.cta-group { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }

.download-select { display: flex; flex-direction: column; gap: 8px; }
.download-select label { font-size: 0.85rem; color: var(--text-muted); }
.download-select select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--input);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Reserve space for custom arrow */
  padding-right: 2.5em;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%),
    linear-gradient(to right, var(--border-color), var(--border-color));
  background-position:
    calc(100% - 18px) 52%,
    calc(100% - 12px) 52%,
    calc(100% - 2.5em) 50%;
  background-size:
    6px 6px,
    6px 6px,
    1px 60%;
  background-repeat: no-repeat;
}

/* Ensure the specific dropdown gets the arrow even if global select styles override earlier block */
#download-package {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2.5em;
  background-color: var(--input-bg);
  color: var(--input);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%),
    linear-gradient(to right, var(--border-color), var(--border-color));
  background-position:
    calc(100% - 18px) 52%,
    calc(100% - 12px) 52%,
    calc(100% - 2.5em) 50%;
  background-size:
    6px 6px,
    6px 6px,
    1px 60%;
  background-repeat: no-repeat;
}

/* Buttons */
.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 999px;
  background: var(--button-primary);
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  transition: transform var(--transition-speed) ease, background var(--transition-speed) ease;
}
.button-primary:hover,
.button-primary:focus,
.button-primary:active,
.button-primary:visited { color: var(--white); }
.button-primary:hover { background: var(--button-primary-hover); transform: translateY(-1px); }

.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  text-decoration: none;
}

/* Improve secondary button contrast in light mode */
:root[data-theme="light"] .button-secondary { border-color: var(--gray-border-medium); }
:root[data-theme="light"] .button-secondary:hover { border-color: var(--accent-color); }

/* Gallery */
.gallery { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.gallery figure { margin: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--border-color); background: var(--card-bg); box-shadow: var(--shadow-base); }
.gallery img { width: 100%; display: block; }

/* Section headings & cards */
.section-heading { display: flex; flex-direction: column; gap: 12px; max-width: 680px; }
.section-heading span { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.cards { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { padding: 28px; border-radius: 16px; border: 1px solid var(--border-color); background: var(--card-bg); box-shadow: var(--shadow-base); display: grid; gap: 20px; }
.card h3 { margin: 0; font-size: 1.1rem; }
.card ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }

/* Small callout inline note */
.release-note { border-left: 4px solid var(--button-primary); padding-left: 16px; }

/* Footer */
footer {
  margin: 0 auto;
  max-width: var(--content-max-width);
  padding: 0 var(--content-padding) 80px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 991px) {
  main#content { padding-top: 48px; gap: 80px; }
  .hero { padding: 32px; }
  footer { padding-bottom: 60px; }
}

/* ==========================================
   BASE RESET & TYPOGRAPHY
   ========================================== */

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family), serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: var(--line-height);
  font-size: var(--font-size-base);
  font-weight: 400;
}

/* Lists */
ul#navlist {
  margin: 0;
  padding: 0;
  list-style: none;
  display: inline-flex;
}

ul.config,
ul.subnavlist,
ul.subnavlist-selected,
ul.subnavlist > li,
ul.subnavlist-selected > li {
  padding-left: inherit;
  list-style-type: none;
}

/* ==========================================
   NAVIGATION SYSTEM
   ========================================== */

/* Main Navigation Container */
#navbar {
  position: relative;
  top: 0; /* remove unintended top gap */
  left: 0;
  float: none;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  background-color: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  box-shadow: var(--shadow-base);
  padding-right: 20px;
  min-height: var(--navbar-height);
  line-height: var(--navbar-height);
}

/* Container for navlist and theme toggle to keep them grouped and centered */
#navbar #navlist {
  display: inline-flex;
}

/* Ensure theme toggle appears as part of the navigation group */
#navbar .theme-toggle {
  display: inline-flex;
}

/* Logo link styling */
.logo-link {
  display: inline-block;
  width: var(--navbar-height);
  height: var(--navbar-height);
  margin-right: 20px;
  background-image: url('images/crypta_logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: opacity var(--transition-speed) ease;
}

.logo-link:hover {
  opacity: 0.8;
}

/* Sticky Navigation */
div#page div#navbar {
  position: sticky;
  top: 0;
}

/* Navigation Links */
#navbar,
#navlist,
#navbar li {
  min-height: var(--navbar-height);
  line-height: var(--navbar-height);
}

#navbar a {
  padding-left: 5px;
  padding-right: 5px;
}

#navlist li a {
  padding-bottom: 5px;
  text-align: left;
}

#navbar #navlist li a {
  font-size: var(--font-size-base);
  color: var(--navbar-text);
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  transition: color var(--transition-speed) ease;
}

/* Top Level Menu Items */
li.navlist-selected,
li.navlist-not-selected {
  position: relative !important;
  display: inline-block !important;
  margin: 0 1.5em 0 1.5em !important;
  padding: 0 0 0 0 !important;
}

/* Dropdown Menus */
ul.subnavlist,
ul.subnavlist-selected {
  display: none;
  position: absolute !important;
  top: 2.5em;
  left: -1.5em !important;
  z-index: 20 !important;
  margin: 0 !important;
  padding: 0 0 0 0 !important;
  text-align: left !important;
}

ul.subnavlist:hover,
li.navlist-not-selected:hover ul.subnavlist,
li.navlist-selected:hover ul.subnavlist-selected {
  display: block;
}

/* Second Level Navigation */
#navbar #navlist .subnavlist,
#navbar #navlist .subnavlist-selected,
#navbar #navlist .subnavlist-not-selected {
  background-color: var(--menu-bg);
  border: 1px solid var(--menu-border);
  border-radius: 0;
  box-shadow: var(--menu-shadow);
  vertical-align: middle;
  width: 250px;
}

#navbar #navlist li ul,
#navbar #navlist li ul li,
#navbar #navlist li ul li a {
  font-size: var(--font-size-small);
  color: var(--nav-link);
  text-transform: none;
}

#navbar ul#navlist li ul li {
  text-align: left;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--menu-border);
  position: relative;
}

#navbar ul#navlist li ul li a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0.75em;
  height: 3em;
  white-space: nowrap;
}

#navbar ul#navlist li ul {
  background-color: var(--menu-bg);
  border: 1px solid var(--menu-border);
  border-radius: 0;
  box-shadow: var(--menu-shadow);
}

/* Navigation Hover Effects */
#navbar ul#navlist li a:hover,
#navbar ul#navlist li.navlist-not-selected a:hover {
  background: none;
}

#navbar ul#navlist li ul li:hover {
  color: var(--nav-link-hover);
  text-decoration: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-color);
}

#navbar ul#navlist li a {
  display: inline;
}

ul#navlist li ul li:first-child,
ul#navlist li ul li:last-child {
  border-radius: 0;
}

/* Hamburger Menu */
#hamburger-box {
  position: relative;
  z-index: 10;
  float: right;
  width: 30px;
  height: 30px;
  margin-right: 10px;
  margin-top: 11px;
  transform: rotate(0deg);
  -webkit-transition: 0.5s ease-in-out;
  -o-transition: 0.5s ease-in-out;
  -moz-transition: 0.5s ease-in-out;
  transition: 0.5s ease-in-out;
  cursor: pointer;
}

#hamburger-box span {
  position: absolute;
  left: 0;
  display: block;
  width: 100%;
  height: 3px;
  background: var(--white);
  opacity: 1;
  transform: rotate(0deg);
  -webkit-transition: 0.25s ease-in-out;
  -o-transition: 0.25s ease-in-out;
  -moz-transition: 0.25s ease-in-out;
  transition: 0.25s ease-in-out;
}

#hamburger-box span:nth-child(1) {
  top: 0;
}
#hamburger-box span:nth-child(2),
#hamburger-box span:nth-child(3) {
  top: 8px;
}
#hamburger-box span:nth-child(4) {
  top: 16px;
}

#hamburger-box.active span:nth-child(1) {
  top: 16px;
  left: 50%;
  width: 0;
}
#hamburger-box.active span:nth-child(2) {
  transform: rotate(45deg);
}
#hamburger-box.active span:nth-child(3) {
  transform: rotate(-45deg);
}
#hamburger-box.active span:nth-child(4) {
  top: 18px;
  left: 50%;
  width: 0;
}

/* ==========================================
   LAYOUT & CONTENT STRUCTURE
   ========================================== */

/* Main Content Area */
div#content {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--content-padding) var(--content-padding) 80px;
  background: transparent;
}

/* Hidden Elements */
#topbar,
div#selected-subnavbar {
  display: none;
}

/* ==========================================
   FORMS & INPUT ELEMENTS
   ========================================== */

/* Text Inputs */
input,
select {
  margin: 8px 8px 8px 0;
  padding: 12px 16px;
  color: var(--input);
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: border-color var(--transition-speed) ease;
  font-size: var(--font-size-small);
  font-family: var(--font-family), monospace;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: none;
}

/* Disabled form controls */
input:disabled,
select:disabled,
textarea:disabled {
  color: var(--input-disabled) !important;
  background-color: var(--input-disabled-bg) !important;
  border-color: var(--input-disabled-border) !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

input[type="text"] {
  max-width: 800px;
  width: 100%;
  box-sizing: border-box;
}

textarea {
  max-width: 50%;
  width: 100%;
  margin: 8px 8px 8px 0;
  padding: 12px 16px;
  color: var(--input);
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: border-color var(--transition-speed) ease;
  font-size: var(--font-size-small);
  font-family: var(--font-family), monospace;
  box-sizing: border-box;
}

/* Buttons */
input[type="submit"],
input[type="reset"],
button {
  margin: 8px 8px 8px 0;
  padding: 8px 16px;
  color: var(--white);
  background: var(--button-primary);
  border: 1px solid var(--button-primary);
  border-radius: 0;
  font-weight: 600;
  font-size: var(--font-size-small);
  letter-spacing: 0;
  box-shadow: none;
  transition: all var(--transition-speed) ease;
  cursor: pointer;
  font-family: var(--font-family), monospace;
}

input[type="submit"]:hover,
input[type="reset"]:hover,
button:hover {
  background: var(--button-primary-hover);
  border-color: var(--button-primary-hover);
}

input[type="submit"]:active,
input[type="reset"]:active,
button:active {
  background: var(--button-primary-active);
  border-color: var(--button-primary-active);
}

/* Delete Notification Buttons */
button[name="dismiss-user-alert"],
input[name="dismiss-user-alert"] {
  padding: 6px 12px !important;
  font-size: var(--font-size-tiny) !important;
  background: var(--gray-light) !important;
  color: var(--gray-text) !important;
  border: 1px solid var(--gray-border) !important;
  font-weight: 400 !important;
  border-radius: 0 !important;
  margin: 4px !important;
}

button[name="dismiss-user-alert"]:hover,
input[name="dismiss-user-alert"]:hover {
  background: var(--gray-medium) !important;
  color: var(--text-primary) !important;
  border-color: var(--gray-text-light) !important;
}

/* Dark mode overrides for dismiss buttons */
:root[data-theme="dark"] button[name="dismiss-user-alert"],
:root[data-theme="dark"] input[name="dismiss-user-alert"] {
  background: var(--dismiss-btn-bg) !important;
  color: var(--dismiss-btn-color) !important;
  border: 1px solid var(--dismiss-btn-border) !important;
}

:root[data-theme="dark"] button[name="dismiss-user-alert"]:hover,
:root[data-theme="dark"] input[name="dismiss-user-alert"]:hover {
  background: var(--dismiss-btn-hover-bg) !important;
  color: var(--dismiss-btn-hover-color) !important;
  border-color: var(--dismiss-btn-hover-border) !important;
}

/* ==========================================
   INFOBOXES & STATUS ELEMENTS
   ========================================== */

/* General Infobox Styling */
.infobox-header,
.infobox-content {
  padding-right: 2ex;
  padding-bottom: 0.5em;
  padding-left: 0;
  font-family: var(--font-family), monospace;
}

.infobox-content {
  overflow: hidden;
}

.infobox-content p > i:first-child {
  font-size: var(--font-size-small);
  color: var(--desc-color);
  font-style: normal;
}

.infobox-content input[name="search"] {
  max-width: 800px;
}

/* Infobox Header Styling */
div.infobox-header {
  margin: 24px 0 16px;
  padding: 0 0 0 20px;
  font-style: normal;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--infobox-header);
  line-height: 1.2;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid var(--button-primary);
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
  position: relative;
  overflow: visible;
  text-decoration: none;
}

div.infobox-header:before {
  display: none;
}

/* Specific Infobox Types */
div.infobox-information div.infobox-header {
  background: none;
  color: var(--text-primary);
  border-left: 4px solid var(--infobox-information) !important;
  padding-left: 20px;
  line-height: 1.2;
}

div.infobox-warning div.infobox-header {
  background: none;
  color: var(--text-primary);
  border-left: 4px solid var(--infobox-warning);
  padding-left: 20px;
  line-height: 1.2;
}

div.infobox-alert {
  background-color: var(--error-bg-light);
  padding-top: 15px;
}

div.infobox-alert div.infobox-header {
  background: none;
  color: var(--text-primary);
  border-left: 4px solid var(--infobox-alert);
  padding-left: 20px;
  margin-top: 0;
  line-height: 1.2;
}

div.infobox-error {
  background-color: var(--error-bg-light);
}

div.infobox-error div.infobox-header {
  background: none;
  color: var(--text-primary);
  border-left: 4px solid var(--infobox-error);
  padding-left: 20px;
  line-height: 1.2;
}

div.infobox-query div.infobox-header {
  background: none;
  color: var(--text-primary);
  border-left: 4px solid var(--infobox-query);
  padding-left: 20px;
  line-height: 1.2;
}

div.infobox-success div.infobox-header {
  background: none;
  color: var(--text-primary);
  border-left: 4px solid var(--infobox-success);
  padding-left: 20px;
  line-height: 1.2;
}

/* Dismiss Alerts Container */
div.dismiss-all-alerts-container {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

/* STATUS BAR styles removed (unused on this site) */

/* Progress Bar */
div.progressbar {
  width: 8.864em;
  border-style: solid;
  border-width: 1px;
  position: relative;
  height: 20px;
  overflow: hidden;
  background-color: var(--progressbar-bg);
  background-image: var(--progressbar-gradient);
  background-repeat: repeat-x;
  border-radius: 4px;
  border: var(--progressbar-border);
  box-shadow: var(--progressbar-box-shadow);
}

div.progressbar,
div.progressbar-done,
div.progressbar-min,
div.progressbar-failed,
div.progressbar-failed2 {
  float: left;
  height: 1.227em;
}

div.progress_fraction_finalized,
div.progress_fraction_not_finalized {
  position: absolute;
  left: 0.333em;
}

div.progress_fraction_finalized {
  font-weight: bold;
}

div.progress_fraction_not_finalized {
  font-style: italic;
}

div.progressbar .progressbar-done {
  height: 100%;
  background-color: var(--accent-color);
  background-image: linear-gradient(
    to bottom,
    var(--accent-color),
    var(--accent-hover)
  );
  background-repeat: repeat-x;
}

div.progressbar .progressbar-min {
  height: 100%;
}

div.progressbar .progress_fraction_finalized {
  font-size: var(--font-size-tiny);
  font-weight: bold;
  color: var(--text-primary);
  text-align: center;
  line-height: 20px;
}

/* ==========================================
   LINKS & TYPOGRAPHY
   ========================================== */

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

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

/* Headers and Text Elements */
.bookmarks-header-text {
  margin: 24px 0 16px 0;
  padding: 0;
  font-size: var(--font-size-base);
  font-weight: 700;
  line-height: 1.4;
  color: var(--infobox-header);
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
  position: relative;
  overflow: visible;
}

.bookmarks-header-text:hover {
  color: var(--infobox-header);
}

.bookmarks-header-text:before {
  display: none;
}

/* ==========================================
   CONFIGURATION ELEMENTS
   ========================================== */

.configprefix {
  margin: 24px 0 16px;
  padding: 0 0 0 23px;
  font-style: normal;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--infobox-header);
  line-height: 1.4;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  text-decoration: underline;
}

.config li {
  margin-left: 0;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  list-style-type: none;
  display: flex;
  flex-wrap: wrap;
}

.config li:nth-of-type(2n) {
  background: var(--config-li-alt-bg);
}

.config li input,
.config li select {
  float: right;
  margin-right: 1ex;
}

.config input[alt="SimpleToadletServer.cssOverride"] {
  width: 60ex;
}

.config input[alt="NodeUpdateManager.updateURI"],
.config input[alt="NodeUpdateManager.revocationURI"] {
  width: 108ex;
}

.config li:after {
  display: block;
  clear: both;
}

.config .configshortdesc {
  margin-left: 23px;
  font-size: 100%;
  color: var(--accent-color);
}

.config .configlongdesc {
  display: block;
  margin-left: 36px;
}

.config li a {
  -webkit-flex-basis: 100%;
  flex-basis: 100%;
  line-height: var(--line-height);
}

.config li span:last-child {
  max-width: -webkit-calc(100% - 300px);
  max-width: -moz-calc(100% - 300px);
  max-width: calc(100% - 300px);
  -webkit-align-self: flex-start;
  align-self: flex-start;
  -webkit-box-ordinal-group: 2;
  -ms-flex-order: 1;
  -moz-box-ordinal-group: 2;
  order: 1;
  line-height: 1.3;
}

.config li .config {
  margin-left: auto;
  -webkit-box-ordinal-group: 3;
  -ms-flex-order: 2;
  -moz-box-ordinal-group: 3;
  order: 2;
}

/* ==========================================
   TABLES & DATA DISPLAY
   ========================================== */

/* General Table Styling */
table.plugins,
table.requests {
  padding: 0.5ex;
  border-collapse: collapse;
}

table.requests,
table.queue {
  width: 100%;
}

table.requests td,
table.queue td {
  height: 3em;
}

/* Priority Legend */
table.queue {
  width: 100%;
  height: 40px;
  border-collapse: collapse;
}

table.queue td {
  margin: 0;
  font-size: var(--font-size-base);
  text-align: center;
  text-transform: uppercase;
  border: none;
}

/* General Table Row Styling */
table tbody tr:nth-child(2n) {
  background-color: var(--overlay-subtle);
}

/* Priority Colors */
td.priority0,
tr.priority0 {
  background-color: var(--priority-0);
}
td.priority1,
tr.priority1 {
  background-color: var(--priority-1);
}
td.priority2,
tr.priority2 {
  background-color: var(--priority-2);
}
td.priority3,
tr.priority3 {
  background-color: var(--priority-3);
}
td.priority4,
tr.priority4 {
  background-color: var(--priority-4);
}
td.priority5,
tr.priority5 {
  background-color: var(--priority-5);
}
td.priority6,
tr.priority6 {
  background-color: var(--priority-6);
}

/* Priority Colors - Alternating Rows */
table tbody tr.priority0:nth-child(2n) {
  background-color: var(--priority-0-alt);
}
table tbody tr.priority1:nth-child(2n) {
  background-color: var(--priority-1-alt);
}
table tbody tr.priority2:nth-child(2n) {
  background-color: var(--priority-2-alt);
}
table tbody tr.priority3:nth-child(2n) {
  background-color: var(--priority-3-alt);
}
table tbody tr.priority4:nth-child(2n) {
  background-color: var(--priority-4-alt);
}
table tbody tr.priority5:nth-child(2n) {
  background-color: var(--priority-5-alt);
}
table tbody tr.priority6:nth-child(2n) {
  background-color: var(--priority-6-alt);
}

/* File Browser */
table.directory-listing {
  width: 100%;
}

table.directory-listing td:nth-of-type(2) {
  width: 100%;
}

table.directory-listing th,
table.directory-listing td {
  padding: 0.5ex;
}

table.directory-listing input {
  margin: 0;
}

/* Bookmarks system removed (unused) */

/* ==========================================
   SEARCH & FORMS
   ========================================== */

#searchbar div {
  float: left;
  margin: 1em 0.5em 1em 0;
  line-height: var(--line-height);
}

#searchbar input[type="text"] {
  height: auto;
  font-size: 13.33333px;
}

#searchbar input[type="checkbox"] {
  margin-right: 0.5em;
}

#searchbar .index-bookmark-list,
#searchbar .options-list {
  padding: 0;
}

#searchbar input.index-bookmark-delete {
  position: relative;
  bottom: 2px;
  width: 11px;
  height: 11px;
}

/* Queue Download Form */
#queueDownloadForm textarea {
  max-width: 60%;
  width: 100%;
  margin-top: 1em;
}

#queueDownloadForm input[type="radio"] {
  margin-right: 0.5em;
}

#queueDownloadForm input[type="checkbox"] {
  margin-right: 1em;
  margin-left: 0.5em;
}

/* Queue Insert Form */
#queueInsertForm {
  line-height: var(--line-height);
}

#queueInsertForm input[type="radio"] {
  margin-right: 0.5em;
  margin-bottom: 0;
}

#queueInsertForm input[type="checkbox"] {
  margin-right: 0.5em;
}

/* Filter Preview Form */
#filterPreviewForm input[type="radio"] {
  margin-right: 0.5em;
}

/* Add Peer Form */
#addPeerForm textarea {
  max-width: 60%;
  width: 100%;
  margin-top: 1em;
}

/* SSK Extra Form */
#sskExtraForm input[type="text"] {
  margin: -0.3em 0 1em 0.4em;
}

#sskExtraForm tbody tr td {
  padding: 1em 0 1em;
}

/* CHK Extra Form */
#chkExtraForm input[type="text"] {
  margin: -0.3em 0 1em 0.4em;
}

#chkExtraForm tbody tr td {
  padding: 1em 0 1em;
}

/* ==========================================
   PLUGIN-SPECIFIC STYLES
   ========================================== */

/* Sone Plugin */
.reply,
.click-to-show {
  -webkit-border-radius: var(--border-radius);
  -moz-border-radius: var(--border-radius);
  border-radius: var(--border-radius);
}

body[id*="Sone"] {
  background-color: var(--blue-accent);
}

#sone #notification-area {
  margin-top: 0;
}

#sone {
  padding-top: 1em;
  background-color: var(--panel-bg);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#page div#content {
  top: 0 !important;
  margin-top: 0;
}

/* ==========================================
   PAGE-SPECIFIC STYLES
   ========================================== */

/* Freemail Inbox */
#page-_Freemail_Inbox .container {
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: -moz-box;
  display: flex;
  min-height: -webkit-calc(100vh - 130px);
  min-height: -moz-calc(100vh - 130px);
  min-height: calc(100vh - 130px);
  padding-top: 20px;
  box-sizing: border-box;
}

#page-_Freemail_Inbox .messagelist {
  width: -webkit-calc(100% - 80px);
  width: -moz-calc(100% - 80px);
  width: calc(100% - 80px);
  padding-left: 1em;
  border-left: 1px solid var(--gray-border-medium);
}

#page-_Freemail_Inbox .aside {
  width: 80px;
  line-height: var(--line-height);
}

#page-_Freemail_Inbox .aside a {
  text-decoration: none;
}

#page-_Freemail_Inbox .aside a:hover {
  text-decoration: underline;
}

#page-_Freemail_Inbox .aside .actions a {
  display: block;
  float: left;
  margin: 0.5em 0.25em 0.5em 0;
  padding: 0.5em 0.5em 0.5em 0.5em;
  clear: both;
  font: 400 13.3333px Arial, sans-serif;
  text-decoration: none;
  color: var(--white);
  background-color: var(--accent-color);
  border-radius: var(--border-radius);
  border: none;
}

#page-_Freemail_Inbox .aside .actions a:hover {
  background-color: var(--accent-hover);
  cursor: pointer;
}

#page-_Freemail_Inbox table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

#page-_Freemail_Inbox table td {
  padding: 10px;
}

#page-_Freemail_Inbox table th {
  padding: 0 10px 5px;
}

#page-_Freemail_Inbox table td input[type="checkbox"] {
  margin-right: 0;
}

/* Freemail Message */
#page-_Freemail_Message .container {
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: -moz-box;
  display: flex;
  min-height: -webkit-calc(100vh - 130px);
  min-height: -moz-calc(100vh - 130px);
  min-height: calc(100vh - 130px);
  padding-top: 20px;
  box-sizing: border-box;
}

#page-_Freemail_Message .message {
  width: -webkit-calc(100% - 80px);
  width: -moz-calc(100% - 80px);
  width: calc(100% - 80px);
  padding-left: 1em;
  border-left: 1px solid var(--gray-border-medium);
}

#page-_Freemail_Message .folderlist {
  width: 80px;
  line-height: var(--line-height);
}

#page-_Freemail_Message .folderlist a {
  text-decoration: none;
}

#page-_Freemail_Message .folderlist a:hover {
  text-decoration: underline;
}

#page-_Freemail_Message .folderlist .actions a {
  display: block;
  float: left;
  clear: both;
  margin: 0.5em 0.25em 0.5em 0;
  padding: 0.5em 0.5em 0.5em 0.5em;
  font: 400 13.3333px Arial, sans-serif;
  color: var(--white);
  text-decoration: none;
  background-color: var(--accent-color);
  border: none;
  border-radius: var(--border-radius);
}

#page-_Freemail_Message .folderlist .actions a:hover {
  background-color: var(--accent-hover);
  cursor: pointer;
}

#page-_Freemail_Message table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

#page-_Freemail_Message table td {
  padding: 10px;
}

#page-_Freemail_Message table th {
  padding: 0 10px 5px;
}

#page-_Freemail_Message table td input[type="checkbox"] {
  margin-right: 0;
}

#page-_Freemail_Message .message-headers p {
  margin: 0.5em 0;
  word-break: break-all;
}

#page-_Freemail_Message .message-content p {
  word-break: break-all;
}

#page-_Freemail_Message .message-headers {
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--gray-border-medium);
}

/* New Message */
#newMessage {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

#newMessage .infobox-content {
  padding-right: 0;
}

#newMessage .infobox-content > div {
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: -moz-box;
  display: flex;
}

#newMessage .infobox-content input[type="image"] {
  margin-right: 0;
}

#newMessage textarea {
  width: 100%;
  max-width: 100%;
  margin: 1em 0 1em 0;
  padding: 0.5em 0.5em 0.5em 0.5em;
  background-color: var(--input-bg);
  border: 1px solid var(--gray-border-medium);
  box-sizing: border-box;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
}

/* Freemail Outbox */
#page-_Freemail_Outbox #content {
  padding-top: 20px;
}

#page-_Freemail_Outbox table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

#page-_Freemail_Outbox table td {
  padding: 10px;
}

#page-_Freemail_Outbox table th {
  padding: 0 10px 5px;
}

/* Stats Page */
#page-_stats_ #content .column > tbody > tr {
  display: table-row;
}

#page-_stats_ #content .column > tbody > tr:first-child {
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: -moz-box;
  display: flex;
}

#page-_stats_ #content div.infobox > div.infobox-content table {
  display: table;
  overflow-x: initial;
  white-space: normal;
}

#page-_stats_ #content div.infobox > div.infobox-content table td {
  padding: 2px;
  word-break: break-all;
}

/* Stats (fproxy) Page */
#page-_stats_.fproxy-page #content .column > tbody > tr {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  clear: both;
}

#page-_stats_.fproxy-page #content .column > tbody > tr > td {
  display: block;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-all;
  white-space: normal;
}

#page-_stats_.fproxy-page #content .column > tbody > tr:first-child {
  display: grid !important;
  /* The first row has exactly two cells: Node Version Information and Current Activity.
     Use two equal columns so they span the full width instead of leaving a third empty track. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

#page-_stats_.fproxy-page #content .column > tbody > tr:first-child table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

#page-_stats_.fproxy-page #content .column > tbody > tr:first-child table td {
  padding: 10px;
}

#page-_stats_.fproxy-page #content .column > tbody > tr:first-child table th {
  padding: 0 10px 5px;
}

#page-_stats_ .infobox-content ul {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: normal;
  box-sizing: border-box;
}

#page-_stats_ .infobox-content ul li {
  overflow-wrap: break-word;
  word-wrap: break-word;
  max-width: 100%;
  white-space: normal;
  word-break: break-all;
}

#page-_stats_ .infobox .infobox-content ul li {
  word-break: break-all !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  hyphens: auto;
  line-height: 1.2;
  max-width: 100% !important;
  white-space: normal !important;
}

#page-_stats_.fproxy-page #content .column {
  max-width: 100% !important;
  overflow: hidden;
  table-layout: fixed;
}

#page-_stats_.fproxy-page #content .column > tbody > tr > td * {
  max-width: 100%;
  word-break: break-all;
  overflow-wrap: break-word;
}

/* Security Levels Page */
#page-_seclevels_ .config li {
  margin-left: 24px;
}

#page-_seclevels_ .config li input,
#page-_seclevels_ .config li select {
  float: left;
  margin: 0 0.5em 0 0;
}

#page-_seclevels_ #configFormSecLevels table + i {
  display: block;
  float: left;
  width: 100%;
  clear: both;
}

/* Other Pages */
.column > tbody > tr {
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: -moz-box;
  display: flex;
}

.darknet_connections {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.darknet_connections td {
  padding: 10px;
}

.darknet_connections th {
  padding: 0 10px 5px;
}

.connectivity-port table,
.connectivity-ip table,
.plugins,
.translation > table,
.infobox-content > div > table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.connectivity-port table td,
.connectivity-ip table td,
.plugins td,
.translation > table td,
.infobox-content > div > table td {
  padding: 10px;
}

.connectivity-port table th,
.connectivity-ip table th,
.plugins th,
.translation > table th,
.infobox-content > div > table th {
  padding: 0 10px 5px;
}

#page-_plugins_ .infobox-normal .infobox-content,
#page-_friends_ .infobox-normal .infobox-content,
#page-_downloads_ .infobox-information .infobox-content,
#page-_downloads_ #grouped-downloads .infobox-content,
#page-_uploads_ .infobox-information .infobox-content,
#page-_chat_ .infobox-information .infobox-content,
#page-_addfriend_ .infobox-information .infobox-content,
.infobox-alert .infobox-content,
#filterForm .infobox-content,
#queue-legend .infobox-content,
.requests_in_progress .infobox-content,
#insert-queue .infobox-content,
#filter-file .infobox-content,
#freesite-insert .infobox-content,
#page-_alerts_ .infobox-content,
#connectivity-summary .infobox-content,
#page-_addfriend_ .infobox-normal .infobox-content {
  margin-left: 23px;
}

#page-_addfriend_ pre {
  text-align: justify;
  white-space: pre-wrap;
  word-wrap: break-word;
}

#page-_plugins_ table.plugins {
  display: table;
  overflow-x: initial;
  white-space: normal;
}

#page-_plugins_ table.plugins td {
  padding: 5px;
  word-break: break-all;
}

#page-_plugins_ .plugin-group {
  margin: 1em 0;
}

#page-_plugins_ .plugin-group-title {
  margin: 24px 0 16px;
  padding: 0;
  font-style: normal;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--infobox-header);
  line-height: 1.4;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  text-decoration: underline;
}

#masterPasswordForm label {
  margin: 0 10px 0 0;
}

#page-_translation_ table.translation {
  display: table;
  overflow-x: initial;
  white-space: normal;
}

#page-_translation_ table.translation td {
  padding: 2px;
  width: 33.333%;
  word-break: break-all;
}

/* ==========================================
   THEME-SPECIFIC STYLING
   ========================================== */

/* Light mode activelink placeholder styling */
.activelink-placeholder,
.activelink-loading {
  background-color: var(--activelink-placeholder-bg) !important;
  border: 1px solid var(--activelink-placeholder-border) !important;
  color: var(--gray-muted) !important;
  transition: opacity var(--transition-speed) ease !important;
}

.activelink-placeholder:hover,
.activelink-loading:hover {
  background-color: var(--activelink-placeholder-hover-bg) !important;
  border-color: var(--activelink-placeholder-hover-border) !important;
  opacity: 0.8 !important;
}

/* Loading placeholder with distinct styling */
.activelink-loading {
  background-color: var(--activelink-loading-bg) !important;
  border: 1px solid var(--activelink-loading-border) !important;
  color: var(--activelink-loading-text) !important;
}

.activelink-loading:hover {
  background-color: var(--activelink-loading-hover-bg) !important;
  border-color: var(--activelink-loading-hover-border) !important;
}

/* Pulse animation for loading placeholders */
@keyframes pulse {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.02);
  }
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
}

/* Light mode bookmark title styling - make them orange */
.bookmark-title,
.bookmark-title-updated,
a.bookmark-title,
a.bookmark-title-updated,
.infobox-content .bookmark-title,
.infobox-content .bookmark-title-updated {
  color: var(--accent-color) !important;
}

.bookmark-title:hover,
.bookmark-title-updated:hover,
a.bookmark-title:hover,
a.bookmark-title-updated:hover {
  color: var(--accent-hover-dark) !important;
}

/* Theme Toggle Button */
.theme-toggle {
  cursor: pointer;
  font-size: 20px;
  color: var(--accent-color);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--navbar-height);
  height: var(--navbar-height);
  border-radius: 4px;
  transition: background var(--transition-speed) ease;
  margin-left: 12px;
  position: relative;
  --theme-toggle-hover-bg: rgba(255, 255, 255, 0.1);
}

.theme-toggle:hover {
  background: var(--theme-toggle-hover-bg);
}

.theme-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}

/* Icons for theme toggle */
/* Default (in case JS hasn't set data-icon yet) */
.theme-toggle .theme-toggle-icon::before { content: "☾"; }
/* Show sun icon when current theme is dark (to switch to light) */
.theme-toggle[data-icon="light"] .theme-toggle-icon::before {
  content: "☀";
}
/* Show moon icon when current theme is light (to switch to dark) */
.theme-toggle[data-icon="dark"] .theme-toggle-icon::before {
  content: "☾";
}

/* ==========================================
   RESPONSIVE DESIGN & MEDIA QUERIES
   ========================================== */

/* Large Screens (1500px and below) */
@media (max-width: 1500px) {
  /* Page Stats (fproxy) */
  #page-_stats_.fproxy-page #content .column > tbody > tr > td {
    display: block;
    /* avoid legacy float-based layout inside grid */
    float: none;
  }

  /* Keep two columns for the first row on large screens */
  #page-_stats_.fproxy-page #content .column > tbody > tr:first-child {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
  }

  #page-_stats_.fproxy-page #content .column > tbody > tr:first-child > td {
    width: auto;
    padding-right: 15px;
    box-sizing: border-box;
  }

  /* Page Status Statistics */
  #page-_stats_ #content div.infobox > div.infobox-content table tr th {
    word-break: break-all;
  }

  #page-_stats_ #content div.infobox > div.infobox-content table tr th,
  #page-_stats_ #content div.infobox > div.infobox-content table tr td {
    width: 5.8%;
  }
}

/* Tablets (991px and below) */
@media (max-width: 991px) {
  /* Navigation */
  div#page div#navbar {
    position: relative;
  }

  #navlist {
    position: absolute;
    top: var(--navbar-height);
    left: 0;
    z-index: 1;
    width: 100%;
    padding: 0;
    background: var(--navbar-bg);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-50em);
    -webkit-transition: all 0.3s ease-in-out 0s, visibility 0s linear 0.3s,
      z-index 0s linear 0.01s;
    -o-transition: all 0.3s ease-in-out 0s, visibility 0s linear 0.3s,
      z-index 0s linear 0.01s;
    -moz-transition: all 0.3s ease-in-out 0s, visibility 0s linear 0.3s,
      z-index 0s linear 0.01s;
    transition: all 0.3s ease-in-out 0s, visibility 0s linear 0.3s,
      z-index 0s linear 0.01s;
  }

  /* Keep two columns on tablet widths for the first stats row */
  #page-_stats_.fproxy-page #content .column > tbody > tr:first-child {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  #navlist.active {
    z-index: 1;
    visibility: visible;
    opacity: 1;
    transform: translateY(0%);
    -webkit-transition-delay: 0s, 0s, 0.3s;
    -moz-transition-delay: 0s, 0s, 0.3s;
    -o-transition-delay: 0s, 0s, 0.3s;
    transition-delay: 0s, 0s, 0.3s;
  }

  #navbar,
  #navlist,
  #navbar li {
    display: block !important;
    margin: 0 !important;
  }

  #navbar ul#navlist li a {
    display: block;
    width: 100%;
    padding: 0;
    text-align: center;
  }

  #navbar #navlist .subnavlist,
  #navbar #navlist .subnavlist-selected,
  #navbar #navlist .subnavlist-not-selected {
    position: static !important;
    display: block;
    width: 100%;
    border: none !important;
  }

  #navbar ul#navlist li ul li a {
    margin: 0;
    padding: 0;
  }

  #navbar ul#navlist li ul li {
    text-align: center;
    border-bottom: none;
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-radius: 0;
  }

  #navbar ul#navlist li ul {
    -webkit-border-radius: 0 !important;
    -moz-border-radius: 0 !important;
    border-radius: 0 !important;
  }

  #navbar ul#navlist li a:hover,
  #navbar ul#navlist li.navlist-not-selected a:hover {
    background: none;
  }

  #navbar ul#navlist li ul li:hover {
    background: none;
    -webkit-filter: none;
    filter: none;
  }

  #navbar ul#navlist li a:hover {
    color: var(--gray-muted);
  }

  #navbar ul#navlist li ul li a:hover {
    color: var(--text-primary);
  }

  #navbar ul#navlist li.navlist-selected a {
    color: var(--white);
  }

  #navbar ul#navlist li.navlist-selected ul.subnavlist-selected li a {
    color: var(--text-primary);
  }

  #navbar,
  ul#navlist,
  li.navlist-selected,
  ul.subnavlist-selected,
  li.submenuitem-selected {
    background: var(--gray-nav);
  }

  ul.subnavlist,
  ul.subnavlist-selected {
    display: block;
  }

  ul.subnavlist:hover,
  li.navlist-not-selected:hover ul.subnavlist,
  li.navlist-selected:hover ul.subnavlist-selected {
    display: block;
  }

  #navbar ul#navlist li.navlist-selected ul.subnavlist-selected {
    position: absolute !important;
    top: 0;
    left: 0 !important;
    z-index: 1;
    width: 100%;
    padding: 0;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-2em);
    -webkit-transition: all 0.3s;
    -o-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;
  }

  #navbar ul#navlist li.navlist-selected.active ul.subnavlist-selected {
    position: static !important;
    top: 100%;
    z-index: 1;
    visibility: visible;
    opacity: 1;
    transform: translateY(0%);
  }

  #navbar ul#navlist li.navlist-not-selected ul.subnavlist {
    position: absolute !important;
    top: 0;
    left: 0 !important;
    z-index: 1;
    width: 100%;
    padding: 0;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-2em);
    -webkit-transition: all 0.3s;
    -o-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;
  }

  #navbar ul#navlist li.navlist-not-selected.active ul.subnavlist {
    position: static !important;
    top: 100%;
    z-index: 1;
    visibility: visible;
    opacity: 1;
    transform: translateY(0%);
  }

  /* General */
  .config input[type="text"] {
    width: 100% !important;
  }

  /* Page Stats (fproxy) */
  #page-_stats_.fproxy-page #content .column > tbody > tr:first-child > td {
    width: 100%;
    padding-right: 5px;
  }

  /* Page Seclevels */
  #page-_seclevels_ #configFormSecLevels table,
  #page-_seclevels_ #configFormSecLevels table tbody,
  #page-_seclevels_ #configFormSecLevels table tbody tr td {
    display: block;
    width: 100%;
  }

  #page-_seclevels_ #configFormSecLevels table tbody tr {
    display: block;
    width: 100%;
    clear: both;
  }

  #page-_seclevels_ #configFormSecLevels table tbody tr td input {
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
  }

  #page-_seclevels_ #configFormSecLevels table + i > p {
    margin: 0;
  }

  /* Page Status Statistics */
  #page-_stats_ #content div.infobox > div.infobox-content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  #page-_stats_ #content div.infobox > div.infobox-content table tr th,
  #page-_stats_ #content div.infobox > div.infobox-content table tr td {
    width: auto;
  }

  /* Others */
  #page-_plugins_ table.plugins {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  #masterPasswordForm label {
    margin: 0 0 5px;
    display: block;
  }

  #masterPasswordForm input[type="password"] {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  #page-_translation_ table.translation tr td:nth-child(1),
  #page-_translation_ table.translation tr td:nth-child(2) {
    width: 25%;
  }

  #page-_translation_ table.translation tr td:nth-child(3) {
    width: 50%;
  }

  #page-_uploads_,
  #request-table-form-completed-upload-file-advanced,
  table.requests {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  #page-_uploads_,
  #request-table-form-completed-upload-file-advanced,
  table.requests,
  th {
    padding: 2px 5px;
  }

  #page-_uploads_,
  #request-table-form-completed-upload-file-advanced,
  table.requests,
  td {
    padding: 2px 5px;
  }

  #page-_downloads_,
  #request-table-form-failed-download-file-unknownmime-advanced,
  table.requests {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  #page-_downloads_,
  #request-table-form-failed-download-file-unknownmime-advanced,
  table.requests,
  th {
    padding: 2px 5px;
  }

  #page-_downloads_,
  #request-table-form-failed-download-file-unknownmime-advanced,
  table.requests,
  td {
    padding: 2px 5px;
  }
}

/* Mobile (700px and below) */
@media (max-width: 700px) {
  /* Base */
  textarea {
    max-width: 100%;
  }

  /* Move the content window to the left side of the screen */
  div#content {
    padding-bottom: 6em;
  }

  /* Bookmarks */
  #bookmarks table tbody {
    padding: 0;
  }

  /* Infoboxes */
  .infobox-content {
    padding: 0.5em;
  }

  /* Search Bar */
  #searchbar form[name="searchform"] > div {
    clear: both;
    margin: 20px 0 0 !important;
  }

  /* Queue Download Form */
  #queueDownloadForm textarea {
    max-width: 100%;
  }

  /* Add Peer Form */
  #addPeerForm textarea {
    max-width: 100%;
  }

  /* Config */
  .config li {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    flex-direction: column;
  }

  .config li span:last-child {
    max-width: 100%;
  }

  /* SSK Extra Form */
  #sskExtraForm input[type="text"] {
    margin: 0;
  }
  #sskExtraForm tbody tr td {
    padding: 0.5em 0.3em;
  }

  /* CHK Extra Form */
  #chkExtraForm input[type="text"] {
    margin: 0;
  }
  #chkExtraForm tbody tr td {
    padding: 0.5em 0.3em;
  }

  /* Page Freemail Inbox */
  #page-_Freemail_Inbox .container {
    min-height: auto;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    flex-direction: column;
  }

  #page-_Freemail_Inbox .aside {
    width: 100%;
    padding-bottom: 1em;
  }

  #page-_Freemail_Inbox .messagelist {
    width: 100%;
    margin-left: 0;
    padding-top: 0.5em;
    padding-left: 0;
    border-top: 1px solid var(--gray-border-medium);
    border-left: 0;
  }

  /* Page Freemail Message */
  #page-_Freemail_Message .container {
    min-height: auto;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    flex-direction: column;
  }

  #page-_Freemail_Message .folderlist {
    width: 100%;
    padding-bottom: 1em;
  }

  #page-_Freemail_Message .message {
    width: 100%;
    margin-left: 0;
    padding-top: 0.5em;
    padding-left: 0;
    border-top: 1px solid var(--gray-border-medium);
    border-left: 0;
  }

  /* Page Stats (fproxy) */
  /* Stack to one column on small screens */
  #page-_stats_.fproxy-page #content .column > tbody > tr:first-child {
    grid-template-columns: 1fr;
  }
  #page-_stats_.fproxy-page #content .column > tbody > tr:first-child table {
    max-width: 300px;
  }

  /* Others */
  .column > tbody > tr {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    flex-direction: column;
  }

  #page-_WebOfTrust_LogIn select {
    width: 100%;
  }

  #page-_KeyUtils_About .infobox-content p nobr {
    white-space: pre-wrap;
  }

  #page-_uploads_ #queue-legend td {
    font-size: var(--font-size-small);
    word-break: break-all;
  }

  #page-_downloads_ #queue-legend td {
    font-size: var(--font-size-small);
    word-break: break-all;
  }
}

/* Small Mobile (420px and below) */
@media (max-width: 420px) {
  /* Move the content window to the left side of the screen */
  div#content {
    padding-bottom: 8em;
  }

  /* Page Stats (fproxy) */
  #page-_stats_.fproxy-page #content .column > tbody > tr {
    max-width: 300px;
    overflow: auto;
  }

  #page-_stats_.fproxy-page #content .column > tbody > tr:first-child {
    max-width: 100%;
    overflow: visible;
  }

  /* Others */
  #page-_WebOfTrust_LogIn input,
  #page-_WebOfTrust_LogIn select {
    width: 100%;
  }

  #page-_KeyUtils_About .infobox-content p {
    white-space: pre-wrap;
    word-break: break-all;
  }

  #page-_uploads_ #queue-legend td {
    font-size: 10px;
  }
  #page-_downloads_ #queue-legend td {
    font-size: 10px;
  }
}
