/* ============================================================
   JOURNAL SHELF LAYOUT & STYLING
   CTR = green, DTR = blue, TTJ = red
   Dark overlays with color-shift hover and subtle zoom-in
   ============================================================ */

/* ===== BASE COLOR PALETTE ===== */
:root {
  --ctr-badge: #1ebc63;                    /* bright green */
  --ctr-overlay: rgba(18, 45, 28, 0.90);   /* deep forest */
  --ctr-overlay-hover: rgba(30, 80, 50, 0.90);

  --dtr-badge: #2a6cff;                    /* bright blue */
  --dtr-overlay: rgba(20, 30, 60, 0.90);   /* dark navy */
  --dtr-overlay-hover: rgba(35, 55, 110, 0.90);

  --ttj-badge: #ff3b3b;                    /* bright red */
  --ttj-overlay: rgba(60, 20, 20, 0.90);   /* dark maroon */
  --ttj-overlay-hover: rgba(100, 25, 25, 0.90);
}

/* ===== GENERAL PAGE LAYOUT ===== */
body {
  font-family: system-ui, sans-serif;
  margin: 0;
  background: #f5f6f8;
  color: #222;
}




/* dark mode variant */
[data-theme="dark"] .sub-badge {
  background: #3d7aff;
}


/* Slight variation for dark theme */
[data-theme="dark"] .toolbar { background: #1a1a1a; border-bottom-color: rgba(255,255,255,0.08); }

/* Filters on the right */
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filters select {
  padding: 6px 8px;
  border-radius: 6px;
}


/* ===== SHELF GRID ===== */
.shelf {
  --thumb-min: 190px;
  --thumb-gap: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb-min), 1fr));
  gap: var(--thumb-gap);
  padding: 20px;

  /* Repeating seamless wood pattern */
  
  background-image:
    url("/static/images/textures/light_wood.jpg"),
    linear-gradient(rgba(255,255,255,0.4), rgba(255,255,255,0.6)); /* soft veil */

  
  background-blend-mode: lighten; /* keeps tone bright & soft */
}

/* Larger thumbnails */
.shelf.large {
  --thumb-min: 230px;
  --thumb-gap: 24px;
}

/* ===== VOLUME CARD ===== */
.volume {
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease;
  padding: 10px;
  border: 4px solid #edcaa1; /* light oak plank divider */
  border-radius: 12px;
  position: relative;
  z-index: 1; /* ensure above any background overlay */
}

.volume:hover {
  transform: translateY(-4px);
  border-width: 3px; /* makes hover smoother */
}

.cover {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  background: #ddd;
}

/* image zoom-in animation */
.cover img {
  width: 100%;
  display: block;
  transition: transform 0.35s ease;
}
.volume:hover .cover img {
  transform: scale(1.05);
}

/* ===== OVERLAY BAR ===== */
.overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: CALC(50% - 70px);
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background-color: rgba(0,20,0,0.05);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.25s ease;
  flex-direction: column;
}

.j-type {
	background-color: #00DDFF;
	color: #000000;
	width: 100%;
	text-align: center;
	padding: 0px 2px;
	border-radius: 3px;
	font-weight: normal;
}

/* ===== TOP-LEFT BADGE ===== */
.badge {
  position: absolute;
  top: CALC(50% - 20px);
  left: -2px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  padding: 4px 8px;
  border-radius: 0px 5px 5px 0px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  letter-spacing: 0.3px;
  background-color: #000020;
}

/* ===== JOURNAL COLOR ASSIGNMENTS ===== */
/* CTR (green) */
.volume[data-journal="CTR"] .overlay { background: var(--ctr-overlay); }
.volume[data-journal="CTR"]:hover .overlay { background: var(--ctr-overlay-hover); }
.volume[data-journal="CTR"] .badge   { background: var(--ctr-badge); }

/* DTR (blue) */
.volume[data-journal="DTR"] .overlay { background: var(--dtr-overlay); }
.volume[data-journal="DTR"]:hover .overlay { background: var(--dtr-overlay-hover); }
.volume[data-journal="DTR"] .badge   { background: var(--dtr-badge); }

/* TTJ (red) */
.volume[data-journal="TTJ"] .overlay { background: var(--ttj-overlay); }
.volume[data-journal="TTJ"]:hover .overlay { background: var(--ttj-overlay-hover); }
.volume[data-journal="TTJ"] .badge   { background: var(--ttj-badge); }

/* ===== TOPIC COUNT META ===== */
.meta {
  display: flex;
  justify-content: center;
  padding: 6px 2px 0 2px;
  color: #555;
}


/* ============================================================
   VISUAL SHELF EFFECT WITH EMBEDDED LIGHT WOOD TEXTURE
   ============================================================ */


/* ============================================================
   TOPIC PANEL (slide-in)
   ============================================================ */

/* ============================================================
   TOPIC PANEL (enhanced for title + meta)
   ============================================================ */

.topic-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100%;
  background: #ffffff;
  border-left: 2px solid rgba(0,0,0,0.08);
  /* box-shadow: -4px 0 12px rgba(0,0,0,0.12); */
  transform: translateX(100%);
  transition: transform 0.35s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.topic-panel.visible {
  transform: translateX(0);
  box-shadow: -4px 0 12px rgba(0,0,0,0.12)
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2a6cff;
  color: #fff;
  padding: 10px 12px;
  font-weight: 600;
}

.panel-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* individual topic entry */
.topic-row {
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
}

.topic-title {
  font-weight: 600;
  color: #2a6cff;
  text-decoration: none;
  margin-bottom: 2px;
}

.topic-title:hover {
  text-decoration: underline;
}

.topic-error {
  background-color: var(--error-bg, rgba(255, 0, 0, 0.12));
  color: var(--error-text, #c00);
}


.topic-tag {
  font-size: 11px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.topic-meta {
  font-size: 12px;
  color: #777;
  margin-top: 2px;
}

/* ====== TOPICS BUTTON IN VOLUME CARD ====== */
.topics-btn {
  display: inline-block;
  background: none;
  border: none;
  color: #2a6cff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;           /* explicit pointer cursor */
  padding: 2px 0;
  transition: color 0.2s ease, transform 0.2s ease;
  background-color: #FFFFFF;
  padding: 1px 5px;
  border-radius: 2px;
}

.topics-btn:hover {
  color: #1a49cc;            /* slightly darker on hover */
  transform: translateY(-1px);
}

.topics-btn:active {
  transform: translateY(0);
  color: #142f8f;
}

/* ============================================================
   JOURNAL FILTER BUTTONS
   ============================================================ */

.journal-buttons {
  display: inline-flex;
  gap: 6px;
  margin-right: 16px;
}

.journal-btn {
  border: none;
  outline: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
  color: #fff;
  transition: background 0.2s ease, transform 0.1s ease;
}

/* journal colors */
.journal-btn[data-journal="CTR"] { background: #1ebc63; }  /* green */
.journal-btn[data-journal="DTR"] { background: #2a6cff; }  /* blue */
.journal-btn[data-journal="TTJ"] { background: #ff3b3b; }  /* red */
.journal-btn[data-journal=""]    { background: #6b6b6b; }  /* neutral gray */

/* hover and active states */
.journal-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.journal-btn.active {
  box-shadow: 0 0 0 2px #00000022;
  transform: translateY(-1px);
}

.journal-btn:active {
  transform: translateY(0);
}

/* Search icon button in header */
.icon-button {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 6px;
  margin-left: 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: rgba(0,0,0,0.06);
}

.icon-search {
  width: 20px;
  height: 20px;
}

/* ==========================================================
   SEARCH BUTTON (uses app-theme variables)
   ========================================================== */

.btn-search {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-search svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.icon-search {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

/* ===========================
   SEARCH PANEL
   =========================== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.search-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ===========================
   SEARCH PANEL (LEFT SIDE)
   =========================== */
.search-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 460px;
  height: 100vh;
  background: #fafafa;
  border-right: 2px solid rgba(0,0,0,0.08);
  box-shadow: none;
  z-index: 901;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.search-panel.visible {
  transform: translateX(0);
}


.search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(to right, #ffffff, #f2f6ff);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.search-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.search-close {
  background: none;
  border: none;
  color: #555;
  font-size: 22px;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px 8px;
}

.search-close:hover {
  background: rgba(0,0,0,0.06);
  color: #000;
}

.search-body {
  padding: 14px 18px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-field label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.search-field input[type="text"] {
  padding: 7px 9px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.18);
  font-size: 13px;
}

.search-field input[type="text"]:focus {
  outline: none;
  border-color: #2a6cff;
  box-shadow: 0 0 0 1px rgba(42,108,255,0.35);
}

.search-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.search-btn {
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #e8e8e8;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.search-btn.primary {
  background: #2a6cff;
  border-color: #2a6cff;
  color: #fff;
}

.search-btn:hover {
  filter: brightness(1.03);
}

/* ===========================
   SEARCH PANEL: QUERY PREVIEW
   =========================== */

.search-preview {
  background: #f7f9ff;
  border: 1px solid rgba(42,108,255,0.25);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  color: #1a1a1a;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.search-preview label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #2a3a7c;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.search-preview pre {
  margin: 0;
  font-size: 13px;
  color: #222;
  white-space: pre-wrap;
}

.search-results {
  margin-top: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 6px;
}

.result-item {
  padding: 8px 6px;
  border-radius: 8px;
  background: var(--card, #fff);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.result-item:hover {
  background: var(--list-hover-bg, rgba(0,0,0,0.05));
}

.result-item .title {
  font-weight: 600;
  font-size: 13px;
}

.result-item .meta {
  font-size: 11px;
  color: var(--muted, #666);
}

.admin-btn {
	border: none;
	cursor: pointer;
	margin-left: 4px;
	border-radius: 2px;
	background-color: #FFFFFF;

	/* Center the icon */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 2px;
	line-height: 0;
}
.admin-btn svg {
	display: block;
}

.admin-topic-row:hover {
  background: var(--hover-bg);
}

/* Make the admin panel wider than the regular topic panel */
#adminPanel {
  width: 520px; /* default topic panel is likely ~360px; this adds breathing room */
}

#adminPanel.visible {
  max-width: 520px;
}


/* Grid layout for admin-topic-row */
.admin-topic-row {
  display: grid;
  grid-template-columns: 40px 1.5fr 1fr 1fr; /* wider tag column */
  column-gap: 16px; /* increased spacing between columns */
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.admin-topic-row .index {
  text-align: left;
  color: #888;
}

.admin-topic-row .tid {
  font-weight: 600;
  color: var(--text-color);
  word-break: break-word;
}

.admin-topic-row .pages,
.admin-topic-row .count {
  font-size: 0.9em;
  color: #666;
}

.panel-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.panel-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--text-color);
}

.panel-btn:hover {
  color: var(--color-accent);
}


.cover {
  position: relative;
  overflow: hidden;
}

/* Ensure wrapper takes up same space as original single image */
.thumb-wrapper {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
}

/* Ensure images are visible and sized correctly */
.thumb-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.25s ease-in-out;
}

/* Stack the two images */
.thumb-wrapper img.back {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

/* Fade effect on hover */
.cover:hover .thumb-wrapper img.back {
  opacity: 1;
}

.cover:hover .thumb-wrapper img.front {
  opacity: 0;
}
