/* === FILTERS === */
#filters {
  display: flex;
  gap: 0.5em;
}

.filter-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.3em;
  flex-grow: 1;
  min-width: 0;
}

.filter-input {
  flex-grow: 1;
  min-width: 0;
  width: auto;
  padding: 0.4em 0.6em;
  padding-right: 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  background-color: var(--bg-tab);
  color: var(--text-main);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease;
}

.filter-input:focus {
  outline: none;
  background-color: var(--bg-panel);
  box-shadow: 0 0 6px var(--bg-button);
}

/* === THEME SELECTOR === */
.theme-selector {
  min-width: 160px;
  cursor: pointer;
  margin-left: 1rem;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
  color: var(--text-main);
  transition: background 0.3s ease, color 0.3s ease, border 0.3s ease;
}

.theme-selector-mobile {
  display: none;
}

/* === ENTRY CARDS === */
.entry-card {
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: var(--padding);
  box-shadow: var(--shadow);
  margin-bottom: 2em;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
@media (max-width: 768px) {
  .entry-card {
    margin-bottom: 0.5em;
  }
}

.entry-card {
  padding: var(--entry-card-padding);
  margin-bottom: var(--entry-card-margin-bottom);
}

/* === TABS (Responsive) === */
.entry-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 0.6rem;
  border-bottom: 2px solid var(--tab-border);
  background: var(--bg-tab);
  padding: 0.4rem 0.4rem 0 0.4rem;
  border-radius: var(--radius) var(--radius) 0 0;
  user-select: none;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.entry-tabs::-webkit-scrollbar {
  height: 6px;
}

.entry-tabs::-webkit-scrollbar-thumb {
  background-color: rgba(100, 100, 100, 0.3);
  border-radius: 3px;
}

.entry-tabs::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 30px;
  background: linear-gradient(to left, var(--bg-tab), transparent);
  pointer-events: none;
  display: none;
}

.entry-tabs button {
  flex: 0 0 auto;
  background: var(--bg-button);
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-subtle);
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  white-space: nowrap;
}

.entry-tabs button:hover {
  background: var(--tab-hover-bg);
  color: var(--tab-hover-text);
}

.entry-tabs button.active {
  background: var(--bg-tab-active);
  color: var(--text-main);
  box-shadow: none;
  border-bottom: 2px solid var(--bg-tab-active);
  position: relative;
  top: 2px;
}

.entry-tabs {
  padding: var(--entry-tabs-padding-top) 0.4rem 0 0.4rem;
}

/* === TAB BODY + SIDE SUPPORT === */
.entry-tab-content {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 1.5rem;
  align-items: flex-start;
  border: 1px solid var(--tab-border);
  border-top: none;
  background: var(--bg-panel);
  padding: 1rem 1.25rem;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  min-height: 5rem;
  color: var(--text-main);
}
.entry-tab-content {
  padding: var(--entry-tab-content-padding);
}

.tab-panel {
  display: none;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 1.5rem;
  width: 100%;
}

.tab-panel.active {
  display: flex;
}

/* Main (left) content area */
.entry-main {
  flex: 1 1 auto;
  min-width: 0;
}

/* Side (right) content area */
.entry-side {
  flex: 0 0 200px;
  max-width: 300px;
  padding-left: 1rem;
  border-left: 1px var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.entry-side .entry-field {
  flex-direction: column;
  align-items: flex-end;
}

/* Responsive fallback */
@media (max-width: 768px) {
  .entry-tabs {
    padding: 0.5rem;
    gap: 0.4rem;
    scrollbar-width: thin;
  }

  .entry-tabs button {
    font-size: 1rem;
    padding: 0.6rem 1rem;
    min-width: 44px;
    min-height: 44px;
  }

  .entry-tab-content,
  .tab-panel {
    flex-direction: column;
  }

  .entry-main {
    flex: 1 1 100%;
  }

  .entry-side {
    display: none;
  }
}

/* === ENTRY FIELDS === */
.entry-field {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 0;
  align-items: center;
}

.entry-field.newline {
  display: block;
  margin-top: 1em;
}

.entry-field {
  padding: var(--entry-field-padding-y) 0;
}

label[title] {
  cursor: pointer;
  text-decoration: underline dotted #999;
  text-color: var(--text-main);
}

.entry-label {
  font-weight: 700;
  color: var(--text-subtle);
  margin-right: 0.75rem;
  flex-shrink: 0;
  min-width: 130px;
}

.entry-side .entry-label {
  margin-right: 0rem;
  min-width: 0px;
}

.entry-field.no-title > .entry-label {
  display: none;
}

.entry-value {
  color: var(--text-main);
  flex: 1;
}

/* === ENTRY IMAGES === */
.entry-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: zoom-in;
  margin-top: 0.25rem;
  display: block;
}

/* Optional enhancements for side images */
.entry-side .entry-image {
  max-width: 100%;
  height: auto;
  /* border: 1px solid var(--border-color); */
  border-radius: 6px;
  box-shadow: var(--shadow);
}

/* === IMAGE POPUP === */
.image-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.image-popup-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.image-popup-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  color: #eee;
  cursor: pointer;
  font-weight: bold;
}

.image-popup-close:hover {
  color: #fff;
}

/* === QR FLOATING BOX === */
.qr-floating-box {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  padding: 1rem;
  border: 1px solid #aaa;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  text-align: center;
}

.qr-box canvas {
  margin-top: 1rem;
}

.qr-close {
  position: absolute;
  top: 4px;
  right: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--text-muted);
}

.qr-close:hover {
  color: var(--text);
}

/* === BUTTONS === */
.copy-button,
.qr-toggle {
  background: #333;
  color: #eee;
  border: 1px solid #555;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  margin: 0.5rem 0.5rem 0 0;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.copy-button:hover,
.qr-toggle:hover {
  background: #444;
  color: #fff;
}

/* === Links === */
.entry-link {
  color: var(--highlight-color);
  cursor: help;
}

.entry-link:hover {
  text-decoration: underline wavy;
}

/* === GLOSSARY TOOLTIP === */
.glossary-term {
  color: var(--highlight-color);
  cursor: help;
}

.glossary-term:hover {
  text-decoration: underline wavy;
}

#glossary-tooltip {
  position: fixed;
  background-color: var(--bg-body, #fff);
  border: 1px solid var(--border-color, #ccc);
  box-shadow: var(--shadow, 0 4px 12px rgba(0, 0, 0, 0.15));
  padding: 0.75em 1em;
  max-width: 45vw;
  font-size: 0.95em;
  border-radius: 8px;
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 0;
  transform: scale(0.95);
  line-height: 1.4;
  color: var(--text-main, #000);
}

#glossary-tooltip.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

@media (max-width: 768px) {
  #glossary-tooltip {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
    max-width: 90vw;
    font-size: 1em;
  }
}

.category-badge {
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: bold;
  background: #333;
  color: #fff;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
