:root {
  --bg-color: #0d0d0d;
  --text-color: #f0f0f0;
  --input-bg: #1a1a1a;
  --input-border: #333;
  --button-bg: #222;
  --button-hover: #444;
  --button-text: white;
  --accent: #ec9c23;
  --accent-hover: #ffb84d;
  --accent-text: #000;
  --highlight-tag: #292929;
  --highlight-tag-border: #444;
  --danger: #b00020;
  --success: #00c853;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  --border-radius: 12px;
  --section-bg: #111;
  --switch-bg: #444;
  --checkbox-accent: #ec9c23;
  --checkbox-border: #666;
  --scrollbar-bg: var(--section-bg);
  --scrollbar-thumb: var(--accent);
  --scrollbar-thumb-hover: var(--accent-hover);
  --scrollbar-thumb-border: var(--section-bg);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  width: 400px;
  max-height: 600px;
  overflow-y: auto;
  transition: background 0.3s ease, color 0.3s ease;
}

body.light {
  --bg-color: #f5f5f5;
  --text-color: #222;
  --input-bg: #ffffff;
  --input-border: #ccc;
  --button-bg: #e0e0e0;
  --button-hover: #d0d0d0;
  --button-text: #222;
  --accent: #ec9c23;
  --accent-text: #000;
  --highlight-tag: #f0f0f0;
  --highlight-tag-border: #d0d0d0;
  --danger: #b00020;
  --success: #00c853;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  --section-bg: #fff;
  --switch-bg: #ccc;
  --checkbox-accent: #ec9c23;
  --checkbox-border: #999;
}

.container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

h1 {
  font-size: 1.3em;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-bottom: 4px;
}

.section {
  background: var(--section-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  cursor: pointer;
  padding-left: 8px;
  padding-right: 8px;
}

.section-header:hover {
  background: var(--highlight-tag);
  border-radius: 6px;
  transition: background 0.2s ease;
}

.collapse-toggle {
  background: none !important;
  border: none !important;
  color: var(--text-color) !important;
  padding: 4px !important;
  margin: 0 !important;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.collapse-toggle:hover {
  background: var(--button-hover) !important;
  color: var(--accent) !important;
}

.collapse-toggle i {
  transition: transform 0.2s ease;
  font-size: 0.8em;
}

.section.collapsed .collapse-toggle i {
  transform: rotate(180deg);
}

.section-content {
  overflow: hidden;
  max-height: 2000px;
}

.section.collapsed .section-content {
  max-height: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section.collapsed .section-header {
  margin-bottom: 0;
}

.section h2 {
  font-size: 1em;
  margin-bottom: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--text-color);
  font-size: 0.9em;
  box-sizing: border-box;
  margin-top: 4px;
  margin-bottom: 6px;
}

textarea {
  resize: vertical;
  height: 60px;
}

input[type="color"] {
  background: none;
  border: 2px solid var(--input-border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  width: 36px;
  height: 36px;
  margin-left: 6px;
  cursor: pointer;
  padding: 0;
  transition: border 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 0;
}

input[type="color"]::-webkit-color-swatch {
  border-radius: 0;
  border: none;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

input[type="color"]::-moz-color-swatch {
  border-radius: 0;
  border: none;
  padding: 0;
  width: 100%;
  height: 100%;
}

input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--input-bg);
  border: 1px solid var(--checkbox-border);
  border-radius: 4px;
  width: 12px;
  height: 12px;
  transform: scale(1);
  cursor: pointer;
  position: relative;
}

input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 3px;
  width: 3px; 
  height: 7px;
  border: solid var(--checkbox-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:checked {
  background-color: var(--input-bg);
}

input[type="checkbox"].switch {
  appearance: none;
  width: 40px;
  height: 20px;
  background: var(--switch-bg);
  border: 0px;
  border-radius: 20px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 0.3s;
}

input[type="checkbox"].switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

input[type="checkbox"].switch:checked {
  background: var(--accent);
}

input[type="checkbox"].switch:checked::before {
  transform: translateX(20px);
}

button {
  background: var(--button-bg);
  color: var(--button-text);
  border: 1px solid var(--input-border);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9em;
}

button:hover {
  background: var(--button-hover);
}

button.danger {
  background: var(--danger);
  color: white !important;
}

button.danger:hover {
  background: #d32f2f;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.button-row.wrap {
  flex-wrap: wrap;
}

.button-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 1em;
}

.button-row input[type="checkbox"] {
  margin: 0;
  vertical-align: middle;
}

.color-row {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 8px;
}

.color-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

#wordSearch{
  width:100%;
  margin-bottom:8px;
  margin-top: 8px;
}

#wordList {
  margin-top: 8px;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 200px;
  max-height: 300px;
}

#wordList>div {
  position: absolute;
  width: calc(100% - 8px);
  left: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  box-sizing: border-box;
}

#wordList input[type="text"] {
  flex-grow: 1;
  min-width: 0;
  background-color: var(--input-bg) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--input-border) !important;
  padding: 4px 8px;
  border-radius: 4px;
}

#wordList input[type="color"] {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
  flex-shrink: 0;
}

#wordList input[type="checkbox"] {
  flex-shrink: 0;
}

input[type="file"] {
  display: none;
}

.section-header label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.section-header input[type="checkbox"] {
  margin-right: 6px;
}

#wordCount {
  font-weight: normal;
  margin-left: -8px;
  margin-right: -8px;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-color);
  border-radius: 12px;
  color: var(--fg-color);
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 16px;
}

.icon-toggles {
  display: flex;
  gap: 12px;
}

.icon-toggle {
  cursor: pointer;
  font-size: 18px;
  color: #ffa500;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.icon-toggle:hover {
  color: #ffd580;
}

.hidden-toggle {
  display: none;
}

.icon-toggle {
  cursor: pointer;
  font-size: 18px;
  color: #ffa500;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.icon-toggle:hover {
  color: #ffd580;
}

/* GLOBAL HIGHLIGHT ICON: toggle-on/off */
.global-icon::before {
  content: "\f204";
  /* fa-toggle-off (default) */
}

#globalHighlightToggle:checked+.global-icon::before {
  content: "\f205";
  /* fa-toggle-on */
}

/* THEME ICON: sun/moon */
.theme-icon::before {
  content: "\f185";
  /* fa-sun (light mode) */
}

#themeToggle:checked+.theme-icon::before {
  content: "\f186";
  /* fa-moon (dark mode) */
}

/* Font Awesome fallback settings */
.toggle-icon {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

label:has(input.switch) {
  display: flex;
  align-items: center;
  gap: 8px;
}

#wordList,
body {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--section-bg);
}

#wordList::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 8px;
  background: var(--section-bg);
  border-radius: 8px;
}

#wordList::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 8px;
  min-height: 24px;
  border: 2px solid var(--section-bg);
}

#wordList::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

#wordList::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner {
  background: var(--section-bg);
}

:root {
  --scrollbar-bg: var(--section-bg);
  --scrollbar-thumb: var(--accent);
  --scrollbar-thumb-hover: var(--accent-hover);
  --scrollbar-thumb-border: var(--section-bg);
}

html, body, #wordList {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
#wordList::-webkit-scrollbar {
  width: 8px;
  background: var(--scrollbar-bg);
  border-radius: 8px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
#wordList::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 8px;
  min-height: 24px;
  border: 2px solid var(--scrollbar-thumb-border);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
#wordList::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
#wordList::-webkit-scrollbar-corner {
  background: var(--scrollbar-bg);
}

/* Exception Panel Styles */
.exceptions-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  background: var(--input-bg);
}

.exceptions-list {
  max-height: 120px;
  overflow-y: auto;
  margin: 8px 0;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--section-bg);
}

.exception-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--highlight-tag-border);
  font-size: 12px;
}

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

.exception-domain {
  flex: 1;
  word-break: break-all;
  margin-right: 8px;
}

.exception-remove {
  background: var(--danger);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
}

.exception-remove:hover {
  background: #d00030;
}

/* Footer Styles */
.footer {
  margin-top: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--input-border);
  background: var(--section-bg);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8em;
  color: var(--text-color);
  opacity: 0.7;
}

.version {
  font-weight: 500;
}

.github-link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-color);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.github-link:hover {
  opacity: 1;
  color: var(--accent);
}