:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #121722;
  --bg-card: #182030;
  --bg-card-hover: #1f293d;
  --border-color: #263248;
  --border-hover: #3b4d6d;
  --accent: #7c3aed;
  --accent-hover: #9333ea;
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --badge-cbz: #059669;
  --badge-cbr: #d97706;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.dark-theme {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
.app-header {
  height: 64px;
  background: rgba(18, 23, 34, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.comic-logo-emblem {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 8px rgba(255, 42, 95, 0.45));
}

.logo:hover .comic-logo-emblem {
  transform: scale(1.12) rotate(-3deg);
  filter: drop-shadow(0 0 14px rgba(255, 42, 95, 0.75));
}

.logo-title {
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-accent {
  background: linear-gradient(135deg, #ff2a5f 0%, #ffb703 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-badge {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(79, 70, 229, 0.4);
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  font-family: var(--font-mono);
}

/* Header Search Bar (Always visible at the very top sticky header) */
.header-center-search {
  flex: 1;
  max-width: 480px;
  min-width: 220px;
  margin: 0 16px;
}

.search-bar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(13, 17, 26, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 12px 6px 14px;
  gap: 10px;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) inset;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-bar-wrap:focus-within {
  border-color: var(--accent);
  background: rgba(10, 14, 22, 1);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25), 0 2px 8px rgba(0, 0, 0, 0.4) inset;
}

.search-bar-wrap .search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.search-bar-wrap:focus-within .search-icon {
  color: var(--accent-light, #818cf8);
}

.search-bar-wrap input {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  font-size: 0.88rem;
  flex: 1;
  min-width: 0;
  padding: 0;
}

.search-bar-wrap input::placeholder {
  color: #64748b;
  font-weight: 400;
}

.search-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
  margin-left: auto;
  transition: all 0.15s ease;
}

.search-clear-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  transform: scale(1.1);
}

.search-clear-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(192, 132, 252, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  border-color: rgba(216, 180, 254, 0.7);
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.55);
  color: #ffffff;
  filter: brightness(1.12);
  transform: translateY(-1px);
}

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

.btn-primary {
  background: var(--accent-gradient) !important;
  color: white !important;
  border: 1px solid rgba(192, 132, 252, 0.4) !important;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35) !important;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
  border-color: rgba(216, 180, 254, 0.7) !important;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.55) !important;
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-secondary {
  background: linear-gradient(135deg, #6b21a8 0%, #7c3aed 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(192, 132, 252, 0.4) !important;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3) !important;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #7e22ce 0%, #9333ea 100%) !important;
  border-color: rgba(216, 180, 254, 0.7) !important;
  box-shadow: 0 4px 14px rgba(147, 51, 234, 0.5) !important;
  color: #ffffff !important;
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn-purple, .btn-refresh-meta, #btnSummaryToggleRead, #popoverToggleReadBtn, #readerMarkReadBtn, .btn-mark-read, .btn-mark-unread,
.popover-actions .btn, #summaryModal .modal-footer .btn, #btnSummaryClose, #btnSummaryResetMeta, #btnSummaryComicInfo, #btnSummaryRead, #btnSummaryFetchMeta, #btnSummaryEditMeta,
#popoverReadBtn, #popoverSummaryBtn, #popoverCloseBtn, #popoverAddToCollectionBtn,
#btnEditResetMeta, #lookupOnlineBtn, #btnCancelFetchSource, #btnExecuteFetchSource,
#btnResetFetchTitle, #btnResetFetchMetadata {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(192, 132, 252, 0.4) !important;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35) !important;
}

.btn-purple:hover, .btn-refresh-meta:hover, #btnSummaryToggleRead:hover, #popoverToggleReadBtn:hover, #readerMarkReadBtn:hover, .btn-mark-read:hover, .btn-mark-unread:hover,
.popover-actions .btn:hover, #summaryModal .modal-footer .btn:hover, #btnSummaryClose:hover, #btnSummaryResetMeta:hover, #btnSummaryComicInfo:hover, #btnSummaryRead:hover, #btnSummaryFetchMeta:hover, #btnSummaryEditMeta:hover,
#popoverReadBtn:hover, #popoverSummaryBtn:hover, #popoverCloseBtn:hover, #popoverAddToCollectionBtn:hover,
#btnEditResetMeta:hover, #lookupOnlineBtn:hover, #btnCancelFetchSource:hover, #btnExecuteFetchSource:hover,
#btnResetFetchTitle:hover, #btnResetFetchMetadata:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
  border-color: rgba(216, 180, 254, 0.7) !important;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.55) !important;
  color: #ffffff !important;
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn-purple:active, .btn-refresh-meta:active, #btnSummaryToggleRead:active, #popoverToggleReadBtn:active, #readerMarkReadBtn:active, .btn-mark-read:active, .btn-mark-unread:active,
.popover-actions .btn:active, #summaryModal .modal-footer .btn:active, #btnResetFetchTitle:active, #btnResetFetchMetadata:active, #btnSummaryComicInfo:active {
  transform: translateY(0);
}

.btn-purple:disabled, #btnSummaryComicInfo:disabled, #btnSummaryFetchMeta:disabled, #btnSummaryResetMeta:disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  transform: none !important;
  filter: grayscale(0.2) !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.btn-purple svg, .btn-refresh-meta svg, #btnSummaryToggleRead svg, #popoverToggleReadBtn svg, #readerMarkReadBtn svg {
  width: 14px;
  height: 14px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

/* Sub-nav & Navigation Bar */
.sub-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(15, 21, 32, 0.85);
  backdrop-filter: blur(8px);
  gap: 14px;
  flex-wrap: wrap;
}

.sub-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-back-btn, #btnNavBack, .reader-back-btn, #closeReaderBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%) !important;
  border: 1px solid rgba(192, 132, 252, 0.4) !important;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35) !important;
  color: #ffffff !important;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-back-btn:hover, #btnNavBack:hover, .reader-back-btn:hover, #closeReaderBtn:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
  border-color: rgba(216, 180, 254, 0.7) !important;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.55) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

.nav-back-btn:active, #btnNavBack:active, .reader-back-btn:active, #closeReaderBtn:active {
  transform: translateY(0);
}

.nav-back-btn svg, .reader-back-btn svg {
  width: 14px;
  height: 14px;
  stroke: #ffffff;
}

.nav-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.bc-item {
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.bc-item:hover {
  color: #c7d2fe;
}

.bc-item.bc-active {
  color: var(--text-main);
  font-weight: 700;
}

.bc-sep {
  color: var(--text-dim);
  font-size: 0.85rem;
}


.sub-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.view-toggles {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-toggle-btn svg {
  width: 14px;
  height: 14px;
}

.view-toggle-btn.active {
  background: rgba(79, 70, 229, 0.3);
  color: #e0e7ff;
  border-color: rgba(79, 70, 229, 0.4);
}

.type-toggles {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.type-toggle-btn {
  display: flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.type-toggle-btn:hover {
  color: var(--text-main);
}

.type-toggle-btn.active {
  background: rgba(79, 70, 229, 0.35);
  color: #e0e7ff;
  border-color: rgba(79, 70, 229, 0.5);
}

.stats-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.filter-chips {
  display: flex;
  gap: 8px;
}

.chip {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip.active, .chip:hover {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  border-color: var(--accent);
}

/* Series Detail Header */
.series-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: rgba(24, 32, 48, 0.4);
  border-bottom: 1px solid var(--border-color);
  animation: fadeIn 0.2s ease;
}

.series-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.series-header-info h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  background: linear-gradient(90deg, #f8fafc, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.series-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Container */
.main-container {
  flex: 1;
  padding: 20px 24px;
  position: relative;
}

.comics-grid, .comic-grid, .series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

/* Comic Card & Series Card - Uniform, clean, compact tiles */
.comic-card, .series-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.comic-card:hover, .series-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px -4px rgba(79, 70, 229, 0.3), var(--shadow-hover);
}

.cover-wrapper {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 100%;
  background: #0d111a;
  overflow: hidden;
  border-top-left-radius: calc(var(--radius-md) - 1px);
  border-top-right-radius: calc(var(--radius-md) - 1px);
}

.cover-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.comic-card:hover .cover-wrapper img,
.series-card:hover .cover-wrapper img {
  transform: scale(1.04);
}

.series-count-badge {
  position: absolute;
  top: 6px;
  right: 38px;
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  z-index: 2;
}

.series-format-badges {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  z-index: 2;
}

.series-format-badges .badge-format {
  position: static;
}

.issue-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  z-index: 2;
}

.badge-format {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  z-index: 2;
}

.badge-format.cbz {
  background: var(--badge-cbz);
  color: white;
}

.badge-format.cbr {
  background: var(--badge-cbr);
  color: white;
}

/* Blue Unread Triangle for Comics and Series Tiles */
.tile-unread-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-top: 18px solid #2563eb;
  border-right: 18px solid transparent;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* On comic cards, position format badge next to unread corner triangle so heart button can sit top-right */
.comic-card .badge-format {
  left: 20px;
  right: auto;
}

/* Heart Favorite Button (Top Right of Comic Tile) */
.comic-fav-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(10, 13, 20, 0.78);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  color: rgba(255, 255, 255, 0.75);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.comic-fav-btn:hover {
  transform: scale(1.18);
  background: rgba(15, 23, 42, 0.95);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.comic-fav-btn svg {
  width: 15px;
  height: 15px;
  transition: transform 0.15s ease, fill 0.2s ease, stroke 0.2s ease;
  pointer-events: none;
}

.comic-fav-btn.is-favorite {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.65);
}

.comic-fav-btn.is-favorite svg {
  fill: #ef4444;
  stroke: #ef4444;
  filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.7));
}

.series-fav-btn {
  z-index: 6;
}

.type-toggle-btn[data-type="favorites"].active svg,
.type-toggle-btn[data-type="favorites"]:hover svg {
  stroke: #ef4444;
}

.type-toggle-btn[data-type="favorites"].active svg path {
  fill: #ef4444;
}

/* Page count badge on bottom-right of comic tile */
.comic-pages-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f1f5f9;
  font-size: 0.64rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* Progress bar at bottom of tile cover */
.card-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.6);
  z-index: 4;
}

.card-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  border-radius: 0 2px 2px 0;
}

.card-read-badge {
  position: absolute;
  top: 6px;
  right: 36px;
  background: rgba(16, 185, 129, 0.9);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
}

/* Read status badge inside hover popover */
.read-status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.read-status-badge.status-unread {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.read-status-badge.status-in-progress {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.read-status-badge.status-read {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.read-status-badge:hover {
  background: rgba(124, 58, 237, 0.35) !important;
  color: #d8b4fe !important;
  border-color: rgba(167, 139, 250, 0.6) !important;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

.card-details {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  gap: 4px;
}

.card-meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Floating Hover Popover / Summary Card */
.comic-hover-popover {
  position: fixed;
  z-index: 1000;
  width: 500px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 36px);
  background: rgba(18, 24, 38, 0.97);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 24px 50px -8px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.1);
  pointer-events: auto;
  transition: opacity 0.15s ease, transform 0.15s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.comic-hover-popover::-webkit-scrollbar {
  width: 5px;
}
.comic-hover-popover::-webkit-scrollbar-track {
  background: transparent;
}
.comic-hover-popover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

.popover-content {
  display: flex;
  padding: 18px;
  gap: 16px;
  min-height: fit-content;
}

.popover-cover-wrap {
  width: 120px;
  flex-shrink: 0;
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  background: #0d111a;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.popover-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popover-format-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  background: rgba(0,0,0,0.7);
  color: white;
}

.popover-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.popover-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 8px;
  word-break: break-word;
}

.popover-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.meta-tag {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.popover-summary-container {
  flex: 1;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 6px;
}

.popover-summary-container::-webkit-scrollbar {
  width: 4px;
}
.popover-summary-container::-webkit-scrollbar-track {
  background: transparent;
}
.popover-summary-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.summary-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #a5b4fc;
  margin-bottom: 5px;
}

.popover-summary-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #cbd5e1;
  word-break: break-word;
}

.popover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.popover-actions .btn {
  white-space: nowrap;
  padding: 6px 13px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(192, 132, 252, 0.4) !important;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35) !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

.popover-actions .btn:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
  border-color: rgba(216, 180, 254, 0.7) !important;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.55) !important;
  color: #ffffff !important;
  filter: brightness(1.12);
  transform: translateY(-1px);
}

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

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin: auto 0;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

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

.modal-body {
  padding: 24px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.tab-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  padding-bottom: 8px;
  flex-shrink: 0;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tab-buttons::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tab-btn.active {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Forms */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* Library items */
.libraries-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lib-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lib-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.lib-path {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.lib-actions {
  display: flex;
  gap: 6px;
}

/* In-Browser Reader */
.reader-modal {
  position: fixed;
  inset: 0;
  background: #05070a;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.reader-header {
  height: 54px;
  background: rgba(10, 13, 20, 0.95);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.reader-title-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.reader-back-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%) !important;
  border: 1px solid rgba(192, 132, 252, 0.4) !important;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35) !important;
  color: #ffffff !important;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.reader-back-btn:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
  border-color: rgba(216, 180, 254, 0.7) !important;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.55) !important;
  transform: translateY(-1px);
}

.reader-back-btn svg {
  width: 14px;
  height: 14px;
  stroke: #ffffff;
}

.reader-comic-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.reader-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reader-page-indicator {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.reader-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

.reader-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 80px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  z-index: 10;
}

.reader-nav-btn:hover {
  background: rgba(79, 70, 229, 0.7);
}

.prev-btn {
  left: 20px;
}

.next-btn {
  right: 20px;
}

.reader-zoom-bar {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  gap: 4px;
}

.reader-zoom-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.reader-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.reader-zoom-badge {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  min-width: 44px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.reader-zoom-reset-btn {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reader-zoom-reset-btn:hover {
  background: var(--accent);
  color: white;
}

.reader-image-container {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.reader-image-container img {
  max-height: 94vh;
  max-width: 90vw;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  border-radius: 4px;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

.reader-loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #a0aec0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.5px;
  background: rgba(10, 13, 20, 0.75);
  backdrop-filter: blur(8px);
  padding: 24px 32px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 10;
  pointer-events: none;
}

.reader-loading-spinner .spinner-circle {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent, #3b82f6);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reader-footer {
  height: 48px;
  background: rgba(10, 13, 20, 0.95);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 40px;
}

.reader-footer input[type=range] {
  width: 100%;
  max-width: 600px;
  accent-color: var(--accent);
}

/* Reader Swipe Up Hint for iPad and Tablets */
.reader-swipe-hint {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 14, 30, 0.88);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #c084fc;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  animation: bounceUpHint 2.4s infinite ease-in-out;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.reader-swipe-hint.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
}

@keyframes bounceUpHint {
  0%, 100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -6px);
  }
}

/* Chapter Markers Drawer & Sheet */
.reader-chapter-drawer {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.reader-chapter-drawer.open {
  pointer-events: auto;
}

.chapter-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.reader-chapter-drawer.open .chapter-drawer-backdrop {
  opacity: 1;
}

.chapter-drawer-sheet {
  position: relative;
  z-index: 10;
  background: #0f131c;
  border-top: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 20px 20px 0 0;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: pan-y;
}

.reader-chapter-drawer.open .chapter-drawer-sheet {
  transform: translateY(0);
}

.chapter-drawer-handle-bar {
  width: 100%;
  padding: 10px 0 4px 0;
  display: flex;
  justify-content: center;
  cursor: grab;
}

.chapter-drawer-handle {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.25);
  transition: background 0.2s ease;
}

.chapter-drawer-handle-bar:hover .chapter-drawer-handle {
  background: rgba(168, 85, 247, 0.6);
}

.chapter-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 10px;
}

.chapter-drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chapter-drawer-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.chapter-drawer-status {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: #c084fc;
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
}

.chapter-drawer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chapter-drawer-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px;
  border-radius: 8px;
  gap: 4px;
}

.chapter-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chapter-tab-btn.active {
  background: #9333ea;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4);
}

.chapter-drawer-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
  max-height: calc(75vh - 80px);
}

.chapter-markers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
}

.chapter-marker-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.chapter-marker-card:hover, .chapter-marker-card:active {
  transform: translateY(-3px);
  border-color: #a855f7;
  background: rgba(147, 51, 234, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px rgba(168, 85, 247, 0.3);
}

.chapter-marker-card.active-chapter {
  border-color: #c084fc;
  border-width: 2px;
  background: rgba(147, 51, 234, 0.2);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.5);
}

.chapter-marker-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #000;
  overflow: hidden;
}

.chapter-marker-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.chapter-marker-card:hover .chapter-marker-thumb {
  transform: scale(1.05);
}

.chapter-marker-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.chapter-marker-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chapter-marker-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-marker-page-str {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chapter-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  gap: 10px;
}

.chapter-page-item {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #000;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chapter-page-item:hover {
  border-color: #a855f7;
  transform: scale(1.04);
  z-index: 2;
}

.chapter-page-item.active-page {
  border: 2px solid #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

.chapter-page-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chapter-page-num {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
}

/* Touch & Tablet Optimizations */
@media (pointer: coarse), (max-width: 1024px) {
  .reader-viewport {
    touch-action: none;
  }
  .reader-image-container img {
    touch-action: none;
    -webkit-touch-callout: none;
  }
  .reader-nav-btn {
    width: 52px;
    height: 96px;
    font-size: 1.8rem;
    opacity: 0.7;
  }
  .reader-chapter-drawer .chapter-drawer-sheet {
    max-height: 80vh;
  }
  .chapter-markers-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
  }
}

/* Empty State */
.empty-state {
  margin: 80px auto;
  text-align: center;
  max-width: 440px;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Settings Modal & Controls */
.btn-settings-top {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-color: rgba(255, 255, 255, 0.1);
}

.modal-lg {
  max-width: 680px;
  width: 90vw;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section-header {
  margin-bottom: 12px;
}

.settings-section-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.setting-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: 0.2s ease;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s ease;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.form-select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.form-select:focus {
  border-color: var(--accent);
}

.setting-info-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.folder-selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.toolbar-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toolbar-actions {
  display: flex;
  gap: 6px;
}

.root-folders-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.folder-checkbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.folder-checkbox-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-hover);
}

.folder-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  color: var(--text-main);
}

.folder-checkbox-label input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.folder-comic-count {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.exclusion-warning-banner {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #fde047;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.45;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Modal Sizes */
.modal-xl {
  max-width: 980px;
  width: 95%;
}

.modal-sm {
  max-width: 380px;
  width: 90%;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* Settings Tabs Navigation - Always Visible & No Scrollbars */
.settings-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: rgba(10, 14, 22, 0.75);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.settings-tabs-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.settings-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.83rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.settings-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text-main);
}

.settings-tab-btn.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.35) 0%, rgba(124, 58, 237, 0.4) 100%);
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.3);
}

.settings-tab-pane {
  display: none;
}

.settings-tab-pane.active {
  display: block;
}

.subtab-pane {
  display: none;
}

.subtab-pane.active {
  display: block;
}

.settings-pane-header {
  margin-bottom: 16px;
}

.settings-pane-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.flex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* User Profile Badge in Header */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 4px 12px 4px 10px;
  border-radius: var(--radius-md);
  margin-left: 8px;
}

.user-avatar-icon {
  font-size: 1.1rem;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-meta-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-meta-role {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a5b4fc;
}

.btn-logout {
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 4px 8px;
  margin-left: 4px;
}

.btn-logout:hover {
  color: #ef4444;
}

/* Users Table */
.table-responsive {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.users-table th {
  padding: 10px 14px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.users-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.users-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Role Badges */
.role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.04em;
}

.role-badge-admin {
  background: rgba(124, 58, 237, 0.2);
  color: #c084fc;
  border: 1px solid rgba(124, 58, 237, 0.4);
}

.role-badge-editor {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.role-badge-reader {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* User Form Library Access Checklist */
.libraries-access-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.lib-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.lib-checkbox-item input[type=checkbox] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.specific-libs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 20px;
  border-left: 2px solid var(--border-color);
  margin-top: 4px;
}

/* Login Modal */
.login-backdrop {
  z-index: 1000;
  backdrop-filter: blur(16px);
}

.login-header {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding-bottom: 8px;
}

.login-prompt {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-block {
  width: 100%;
}

/* ========================================================
   Interactive Scan Progress Bar & Scanner Banner
   ======================================================== */
.scan-progress-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border-bottom: 1px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  padding: 12px 160px 12px 24px;
  position: relative;
  z-index: 40;
  animation: slideDownBanner 0.25s ease-out;
}

@keyframes slideDownBanner {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-progress-banner {
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md, 8px);
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.85);
  box-shadow: none;
}

.scan-progress-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scan-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scan-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.scanner-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(165, 180, 252, 0.25);
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.scan-lib-badge {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.scan-status-msg {
  font-size: 0.84rem;
  color: #e2e8f0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scan-percent-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  flex-shrink: 0;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
  border-radius: 9999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.progress-bar-fill.indeterminate {
  width: 35% !important;
  animation: indeterminateBar 1.5s infinite ease-in-out;
}

@keyframes indeterminateBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(150%); }
  100% { transform: translateX(350%); }
}

.scan-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.76rem;
  color: var(--text-dim, #94a3b8);
}

.scan-counts {
  font-weight: 500;
  white-space: nowrap;
}

.scan-current-file {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

/* ========================================================
   Header Total Books Badge
   ======================================================== */
.total-books-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.2);
  margin-left: 6px;
  transition: all 0.2s ease;
}

.total-books-badge:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.55);
}

.total-books-badge .badge-icon {
  width: 15px;
  height: 15px;
  stroke: #818cf8;
}

/* ========================================================
   Hover Popover File Path & Name Display
   ======================================================== */
.popover-file-details {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm, 6px);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 10px 0;
}

.file-detail-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.74rem;
  line-height: 1.35;
  min-width: 0;
}

.file-detail-label {
  font-weight: 700;
  color: #a5b4fc;
  flex-shrink: 0;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.file-detail-val {
  font-family: 'JetBrains Mono', monospace;
  color: #e2e8f0;
  font-size: 0.71rem;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ========================================================
   Indented Library Tree & Root Folder Scanning Controls
   ======================================================== */
.library-tree-card {
  background: var(--card-bg, #1a1e29);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md, 8px);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.library-tree-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.tree-lib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(30, 35, 48, 0.6);
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
  flex-wrap: wrap;
  gap: 12px;
}

.tree-lib-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tree-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, color 0.2s ease;
}

.tree-toggle-btn.collapsed svg {
  transform: rotate(-90deg);
}

.tree-toggle-btn:hover {
  color: #c7d2fe;
}

.tree-lib-icon {
  font-size: 1.25rem;
}

.tree-lib-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tree-lib-name {
  font-weight: 700;
  font-size: 1rem;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-lib-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  color: #94a3b8;
  word-break: break-all;
}

.tree-lib-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-badge-total {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
}

.tree-folders-container {
  padding: 8px 18px 16px 42px;
  position: relative;
}

.tree-folders-container::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 20px;
  left: 30px;
  width: 2px;
  background: rgba(99, 102, 241, 0.25);
}

.tree-folder-node {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  margin-top: 6px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm, 6px);
  gap: 12px;
  transition: all 0.15s ease;
}

.tree-folder-node:hover {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(99, 102, 241, 0.3);
}

.tree-folder-node::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -12px;
  width: 12px;
  height: 2px;
  background: rgba(99, 102, 241, 0.25);
}

.tree-folder-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tree-folder-icon {
  font-size: 1rem;
}

.tree-folder-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-folder-count {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.tree-folder-excluded {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.tree-folder-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ========================================================
   Delete Library Confirmation Modal
   ======================================================== */
.modal-header-danger {
  border-bottom: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.modal-header-danger h2 {
  color: #f87171 !important;
}

.delete-warning-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm, 6px);
  padding: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #fca5a5;
}

.delete-warning-box strong {
  color: #ffffff;
}

.delete-path-preview {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  margin: 6px 0;
  word-break: break-all;
}

.delete-count-preview {
  margin: 6px 0;
  color: #f1f5f9;
}

.delete-note {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 8px;
  border-top: 1px dashed rgba(239, 68, 68, 0.2);
  padding-top: 8px;
}

.delete-checkbox-card {
  margin-top: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm, 6px);
  padding: 12px 14px;
}

.confirm-check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.confirm-check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #ef4444;
  cursor: pointer;
}

.confirm-check-text {
  font-size: 0.84rem;
  color: #f1f5f9;
  font-weight: 500;
  line-height: 1.4;
}

.btn-danger {
  background: #dc2626;
  color: white;
  border: 1px solid #ef4444;
  padding: 8px 16px;
  border-radius: var(--radius-sm, 6px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ========================================================
   Metadata Settings Tab
   ======================================================== */
.metadata-settings-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.metadata-lib-card {
  background: var(--card-bg, #1a1e29);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md, 8px);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meta-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 12px;
}

.meta-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meta-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
}

.meta-card-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: center;
}

.meta-control-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-control-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-status-stamp {
  font-size: 0.78rem;
  color: #cbd5e1;
  font-family: 'JetBrains Mono', monospace;
}

.meta-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  justify-content: flex-end;
}

/* ========================================================
   Collections & Reading Lists Styles
   ======================================================== */
.collections-view {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
}

.collections-header-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.collections-banner-text h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.collections-banner-text p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.collection-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.collection-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 10px;
}

.collection-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.collection-section-title .section-icon {
  font-size: 1.25rem;
}

.collection-section-title h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
}

.collection-badge-count {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(79, 70, 229, 0.4);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  font-family: var(--font-mono);
}

.collection-badge-count.shared {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.collection-empty-notice {
  grid-column: 1 / -1;
  background: rgba(15, 23, 42, 0.4);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Collection Card */
.collection-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  position: relative;
}

.collection-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px -4px rgba(79, 70, 229, 0.3), var(--shadow-hover);
}

.collection-cover-preview {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 100%;
  background: #0f131c;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-left-radius: calc(var(--radius-md) - 1px);
  border-top-right-radius: calc(var(--radius-md) - 1px);
}

.collection-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.collection-card:hover .collection-cover-img {
  transform: scale(1.04);
}

.collection-cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 1.8rem;
}

.collection-cover-overlay {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 2;
}

.collection-badge-pill {
  padding: 2px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.badge-shared-pill {
  background: rgba(16, 185, 129, 0.85);
  color: #ffffff;
}

.badge-private-pill {
  background: rgba(71, 85, 105, 0.85);
  color: #e2e8f0;
}

.badge-books-count {
  background: rgba(0, 0, 0, 0.78);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.collection-card-content {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.collection-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.collection-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.collection-author-meta {
  font-size: 0.70rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-card-actions {
  display: flex;
  gap: 2px;
}

.collection-card-actions .btn {
  padding: 1px 4px;
  font-size: 0.75rem;
}

/* Collection Detail / Reading List View */
.collection-detail-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.collection-detail-hero {
  background: linear-gradient(135deg, rgba(20, 27, 41, 0.95) 0%, rgba(13, 17, 26, 0.95) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.collection-detail-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 700px;
}

.collection-hero-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.collection-hero-title-row h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
}

.collection-badge-shared {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
}

.collection-badge-private {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(100, 116, 139, 0.4);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
}

.collection-hero-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.collection-hero-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.collection-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Comic Card inside Collection Detail: Remove Button */
.comic-card .card-remove-coll-btn {
  position: absolute;
  top: 6px;
  right: 38px;
  left: auto;
  width: 26px;
  height: 26px;
  background: rgba(239, 68, 68, 0.85);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.comic-card:hover .card-remove-coll-btn {
  opacity: 1;
}

.comic-card .card-remove-coll-btn:hover {
  background: #dc2626;
  transform: scale(1.15);
}

/* Right-Click Context Menu */
.context-menu {
  position: fixed;
  z-index: 2500;
  background: rgba(18, 24, 38, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: 6px 0;
  min-width: 200px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  user-select: none;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}

.context-menu-item:hover {
  background: rgba(79, 70, 229, 0.25);
  color: #ffffff;
}

.context-menu-item svg {
  width: 15px;
  height: 15px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.context-menu-item:hover svg {
  color: #818cf8;
}

#ctxMenuMarkRead:hover, #ctxMenuMarkUnread:hover {
  background: rgba(124, 58, 237, 0.28) !important;
  color: #d8b4fe !important;
}

#ctxMenuMarkRead:hover svg, #ctxMenuMarkUnread:hover svg {
  color: #c084fc !important;
}

.context-menu-item.has-submenu .submenu-arrow {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.context-submenu {
  position: absolute;
  left: 100%;
  top: -6px;
  background: rgba(18, 24, 38, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: 6px 0;
  min-width: 210px;
  max-width: 260px;
  display: none;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
}

.context-menu-item.has-submenu:hover .context-submenu {
  display: block;
}

.context-submenu-header {
  padding: 6px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.ctx-collections-list {
  max-height: 220px;
  overflow-y: auto;
}

.context-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.ctx-coll-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 0.82rem;
}

.ctx-coll-choice .choice-count {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.ctx-coll-choice.has-comic {
  color: #34d399;
}

/* Quick Add to Collection Modal */
.quick-add-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.quick-add-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-add-item:hover {
  background: rgba(79, 70, 229, 0.18);
  border-color: var(--accent);
}

.quick-add-item.already-added {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

/* Picker Modal Comics Grid */
.picker-comics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px;
}

.picker-comic-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.picker-comic-thumb {
  width: 44px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  background: #111;
  flex-shrink: 0;
}

.picker-comic-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.picker-comic-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-comic-meta {
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* Actions for scan progress banner (Stop & Close buttons on right) */
.scan-banner-actions {
  position: absolute;
  top: 10px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.btn-stop-scan-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 1px solid rgba(248, 113, 113, 0.5) !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
  transition: all 0.15s ease;
}

.btn-stop-scan-banner:hover {
  background: #b91c1c !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.6);
  transform: translateY(-1px);
}

.btn-stop-scan-banner:active {
  transform: translateY(0);
}

.scan-banner-close-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.scan-banner-close-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Purple More Button in hover popover */
.btn-more-summary, .btn-more-purple {
  display: inline-block;
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(192, 132, 252, 0.5) !important;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  margin-left: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  vertical-align: middle;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.35);
}
.btn-more-summary:hover, .btn-more-purple:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
  border-color: rgba(216, 180, 254, 0.75) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.5);
}
.btn-more-summary:active, .btn-more-purple:active {
  transform: translateY(0);
}

/* Hover duplicates box */
.popover-duplicates-box {
  margin-top: 6px;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: rgba(147, 51, 234, 0.1);
  border: 1px solid rgba(147, 51, 234, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}
.hover-duplicates-title {
  font-weight: 600;
  color: #c084fc;
  margin-bottom: 3px;
}
.hover-duplicates-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 80px;
  overflow-y: auto;
}
.hover-duplicates-list li {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 1px 0;
  font-size: 0.7rem;
}

/* Badge for duplicate copies on comic cards */
.badge-duplicate {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(147, 51, 234, 0.85);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}

/* Scan Settings UI styles */
.scan-controls-card {
  padding: 20px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.scan-task-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scan-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.task-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.scan-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.scan-type-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-scan {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
}
.badge-metadata {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #e9d5ff;
}
.progress-bar-fill.meta-fill {
  background: linear-gradient(90deg, #9333ea, #c084fc);
}
.btn-xs {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Scan Errors & Queued Scans Tables */
.scan-errors-table-wrap, .queued-scans-table-wrap {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}
.data-table th {
  background: rgba(30, 41, 59, 0.95);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border-color);
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  vertical-align: middle;
}
.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
.scan-error-type-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-weight: 600;
}

/* Full Summary Modal */
.summary-modal-layout {
  display: flex;
  gap: 24px;
}
.summary-modal-cover-wrap {
  width: 180px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #0d111a;
}
.summary-modal-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.summary-modal-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.summary-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  background: rgba(15, 23, 42, 0.6);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
}
.meta-item {
  display: flex;
  gap: 6px;
  overflow: hidden;
}
.meta-label {
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.summary-synopsis-section h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.summary-modal-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-main);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.summary-duplicates-box {
  padding: 8px 12px;
  background: rgba(147, 51, 234, 0.1);
  border: 1px solid rgba(147, 51, 234, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* Context Menu Checkmarks for Collections */
.ctx-collection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease;
  font-size: 0.82rem;
}
.ctx-collection-item:hover {
  background: rgba(99, 102, 241, 0.18);
}
.ctx-check-icon {
  width: 15px;
  height: 15px;
  color: #818cf8;
  display: none;
}
.ctx-collection-item.is-member .ctx-check-icon {
  display: inline-block;
}

/* Reader Top-Right Favorite Button */
.reader-fav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  transition: all 0.2s ease;
  margin-left: 8px;
  flex-shrink: 0;
}
.reader-fav-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}
.reader-fav-btn.favorited {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}
.reader-fav-btn.favorited svg {
  fill: #ef4444;
  stroke: #ef4444;
}
.reader-fav-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.15s ease;
}
.reader-fav-btn:active svg {
  transform: scale(0.88);
}

/* Reader Page Jump Box */
.reader-page-indicator-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.reader-page-indicator.clickable {
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  padding: 4px 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.reader-page-indicator.clickable:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}
.reader-page-jump-box {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
  z-index: 1000;
}
.reader-page-jump-box .jump-label {
  font-size: 0.8rem;
  color: #cbd5e1;
  white-space: nowrap;
}
.reader-page-jump-box .jump-input {
  width: 64px;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.85rem;
  text-align: center;
}
.reader-page-jump-box .jump-input:focus {
  outline: none;
  border-color: #6366f1;
}

/* Quick Add Collections Checkboxes */
.quick-add-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.quick-add-item:hover {
  background: var(--bg-hover);
  border-color: #6366f1;
}
.quick-add-item.already-added {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.35);
}
.quick-add-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #6366f1;
}

/* Collection Breadcrumbs Bar */
.collection-breadcrumbs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.collection-breadcrumbs-bar .bc-item {
  cursor: pointer;
  color: #818cf8;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.collection-breadcrumbs-bar .bc-item:hover {
  text-decoration: underline;
}
.collection-breadcrumbs-bar .bc-sep {
  color: var(--text-dim);
  opacity: 0.45;
  font-size: 0.85rem;
}
.collection-breadcrumbs-bar .bc-active {
  color: var(--text-main);
  font-weight: 600;
  cursor: default;
}

/* ========================================================
   Vertical Alphabet Quick-Jump Sidebar & HUD Overlay
   ======================================================== */
.alphabet-sidebar {
  position: fixed;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 5px 2px;
  z-index: 120;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  user-select: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.alpha-jump-btn {
  background: none;
  border: none;
  color: var(--text-dim, #94a3b8);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  padding: 1px 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.alpha-jump-btn:hover,
.alpha-jump-btn:active,
.alpha-jump-btn.active {
  color: #ffffff;
  background: #7c3aed;
  transform: scale(1.35);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.6);
}

.alphabet-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.94);
  border: 2px solid #818cf8;
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.6);
  color: #ffffff;
  font-size: 3rem;
  font-weight: 800;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  z-index: 9999;
  pointer-events: none;
  animation: fadeToast 0.6s ease-out forwards;
}

@keyframes fadeToast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.65); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

.jump-highlight {
  animation: jumpHighlightPulse 1.2s ease-out !important;
}

@keyframes jumpHighlightPulse {
  0% {
    box-shadow: 0 0 0 4px #a855f7, 0 0 24px #a855f7 !important;
    transform: scale(1.04) !important;
  }
  65% {
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.5), 0 0 12px rgba(168, 85, 247, 0.4) !important;
    transform: scale(1.01) !important;
  }
  100% {
    box-shadow: none !important;
    transform: scale(1) !important;
  }
}

/* Cover filter toggle */
.cover-toggle-wrap {
  display: flex;
  align-items: center;
  margin-left: 6px;
}
.cover-toggle-wrap .type-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cover-toggle-wrap .type-toggle-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

/* ========================================================
   Search Results Pagination
   ======================================================== */
.search-pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin: 28px 0 20px 0;
  padding: 14px 20px;
  background: rgba(26, 22, 48, 0.85);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md, 10px);
  border: 1px solid rgba(139, 92, 246, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.pagination-info {
  font-size: 0.88rem;
  color: #a5b4fc;
}

.pagination-info strong {
  color: #f1f5f9;
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-page-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-sm, 6px);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-page-nav:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.3);
  color: #ffffff;
  border-color: rgba(139, 92, 246, 0.55);
  transform: translateY(-1px);
}

.btn-page-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-page-num {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm, 6px);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-page-num:hover:not(.active) {
  background: rgba(139, 92, 246, 0.2);
  color: #ffffff;
  border-color: rgba(139, 92, 246, 0.4);
}

.btn-page-num.active {
  background: #8b5cf6;
  color: #ffffff;
  font-weight: 700;
  border-color: #8b5cf6;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.5);
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 36px;
  color: #64748b;
  font-size: 0.9rem;
  user-select: none;
}

@media (max-width: 640px) {
  .search-pagination-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
}

/* Source Card Selector in Fetch Metadata Modal */
.source-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.source-card:hover {
  border-color: rgba(192, 132, 252, 0.6);
  background: rgba(124, 58, 237, 0.08);
  transform: translateY(-1px);
}

.source-card.active, .source-card:has(input[type="radio"]:checked) {
  border-color: #a855f7 !important;
  background: rgba(124, 58, 237, 0.16) !important;
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.28) !important;
}

.source-card input[type="radio"] {
  accent-color: #9333ea;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  cursor: pointer;
}

/* Fetch Metadata Preview Card */
.fetch-metadata-preview-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  transition: all 0.2s ease;
}

.fetch-metadata-preview-card:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(255, 255, 255, 0.06);
}

.fetch-preview-main {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

#fetchPreviewCover {
  width: 80px;
  height: 118px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.fetch-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

#fetchPreviewTitle {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  word-break: break-word;
}

.fetch-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 5px 10px;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.fetch-preview-grid .meta-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.fetch-preview-grid .meta-field strong {
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
}

.fetch-preview-grid .meta-field span {
  font-size: 0.79rem;
  color: #f1f5f9;
  word-break: break-word;
}

.fetch-preview-synopsis-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 9px;
}

.fetch-preview-synopsis-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}

#fetchPreviewSummary {
  font-size: 0.81rem;
  color: #e2e8f0;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 9px 12px;
  max-height: 130px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

#btnResetFetchTitle, #btnResetFetchMetadata {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

/* Top Right Info Notification Container & Card */
.top-right-notification-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 48px);
}

.purple-info-popup {
  pointer-events: auto;
  background: linear-gradient(135deg, rgba(26, 16, 44, 0.96) 0%, rgba(48, 20, 82, 0.96) 100%);
  border: 1px solid rgba(168, 85, 247, 0.55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 24px rgba(147, 51, 234, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  padding: 14px 16px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideInFromTopRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.purple-info-popup::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #9333ea, #c084fc, #a855f7);
}

.purple-info-popup.popup-hiding {
  animation: slideOutToTopRight 0.3s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes slideInFromTopRight {
  0% {
    opacity: 0;
    transform: translateX(60px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideOutToTopRight {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(60px) scale(0.95);
  }
}

.purple-info-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.purple-info-popup-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(147, 51, 234, 0.35);
  color: #e9d5ff;
  border: 1px solid rgba(192, 132, 252, 0.4);
}

.purple-info-popup-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(192, 132, 252, 0.25);
  color: #e9d5ff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
}

.purple-info-popup-close:hover {
  background: rgba(168, 85, 247, 0.5);
  border-color: rgba(192, 132, 252, 0.6);
  color: #ffffff;
  transform: scale(1.08);
}

.purple-info-popup-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.35;
  word-break: break-word;
}

.purple-info-popup-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid #a855f7;
}

.purple-info-popup-operation {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #c084fc;
}

.purple-info-popup-source {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #e9d5ff;
}

.purple-info-popup-msg {
  font-size: 0.76rem;
  color: #cbd5e1;
  line-height: 1.35;
}

/* ========================================================
   Notifications Header Button & Dropdown Menu
   ======================================================== */
.notifications-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

#btnHeaderNotifications {
  position: relative;
  transition: all 0.2s ease;
}

.notifications-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ec4899;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 9999px;
  border: 2px solid #0f172a;
  box-shadow: 0 2px 6px rgba(236, 72, 153, 0.4);
  pointer-events: none;
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: 90vw;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(168, 85, 247, 0.15);
  z-index: 3000;
  overflow: hidden;
  animation: notifDropdownFade 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifDropdownFade {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notifications-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.notifications-dropdown-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #f1f5f9;
}

.notifications-dropdown-title svg {
  color: #a855f7;
}

.notifications-count-chip {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  padding: 1px 7px;
  border-radius: 9999px;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.btn-clear-notifs {
  color: #94a3b8;
  transition: color 0.15s ease;
}

.btn-clear-notifs:hover {
  color: #ef4444;
}

.notifications-dropdown-body {
  max-height: 420px;
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 85, 247, 0.3) transparent;
}

.notifications-dropdown-body::-webkit-scrollbar {
  width: 5px;
}

.notifications-dropdown-body::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 4px;
}

.notifications-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
  cursor: pointer;
}

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

.notification-item:hover {
  background: rgba(168, 85, 247, 0.08);
}

.notification-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.notification-item-icon.type-comicinfo {
  background: rgba(147, 51, 234, 0.2);
  color: #c084fc;
  border: 1px solid rgba(147, 51, 234, 0.3);
}

.notification-item-icon.type-metadata {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.notification-item-icon.type-info {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.notification-item-content {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item-msg {
  font-size: 0.77rem;
  color: #cbd5e1;
  line-height: 1.35;
  margin-bottom: 4px;
}

.notification-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: #94a3b8;
}

.notification-item-source-badge {
  background: rgba(255, 255, 255, 0.06);
  color: #c084fc;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.notification-item-time {
  margin-left: auto;
  font-size: 0.68rem;
  color: #64748b;
  white-space: nowrap;
}

/* ========================================================
   Summary Modal Update Timestamps Strip
   ======================================================== */
.summary-status-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  margin: 10px 0 12px 0;
  font-size: 0.82rem;
}

.summary-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.summary-status-label {
  color: var(--text-dim, #94a3b8);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.summary-status-label svg {
  color: #a855f7;
  flex-shrink: 0;
}

.summary-status-val {
  color: var(--text-main, #f1f5f9);
  font-weight: 500;
  font-size: 0.8rem;
  text-align: right;
}

/* ========================================================
   Collection Read Order Toolbar & Reordering
   ======================================================== */
.collection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.collection-view-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
}

.collection-view-tabs .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.collection-order-hints {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.coll-order-hint-text {
  font-size: 0.8rem;
  color: var(--text-dim, #94a3b8);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.coll-order-hint-text svg {
  color: #a855f7;
}

.coll-sort-select {
  font-size: 0.78rem;
  padding: 4px 10px;
  height: 32px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text-main, #f1f5f9);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.coll-sort-select:hover,
.coll-sort-select:focus {
  border-color: #a855f7;
}

/* Comic Card in Read Order Mode */
.coll-order-card {
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, opacity 0.2s ease;
  user-select: none;
  overflow: visible !important;
}

.coll-order-card[draggable="true"] {
  cursor: grab;
}

.coll-order-card[draggable="true"]:active {
  cursor: grabbing;
}

.coll-read-order-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  background: linear-gradient(135deg, #9333ea, #6366f1);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(147, 51, 234, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2);
  pointer-events: none;
  letter-spacing: 0.5px;
}

/* Card Order Action Bar */
.card-order-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
}

.card-order-num-label {
  color: var(--text-dim, #94a3b8);
  font-size: 0.74rem;
}

.card-order-num-label strong {
  color: #c084fc;
  font-size: 0.8rem;
}

.card-order-arrows {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-order-arrow {
  width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(147, 51, 234, 0.2);
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: 5px;
  color: #e9d5ff;
  cursor: pointer;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-order-arrow:hover:not(:disabled) {
  background: #9333ea;
  border-color: #a855f7;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4);
}

.btn-order-arrow:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-order-arrow:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted, #64748b);
}

.card-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--text-dim, #94a3b8);
  cursor: grab;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
}

.card-drag-handle:hover {
  opacity: 1;
  color: #c084fc;
}

/* Drag and Drop States & Perpendicular Purple Insertion Line */
.coll-order-card.is-dragging {
  opacity: 0.3;
  transform: scale(0.96);
  border: 2px dashed #a855f7 !important;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.4) !important;
}

/* Perpendicular Purple Line Indicator */
.drop-line-indicator {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 12px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 500;
}

.drop-line-indicator.drop-line-left {
  left: -14px;
}

.drop-line-indicator.drop-line-right {
  right: -14px;
}

.coll-order-card.drag-insert-before > .drop-line-left {
  display: flex !important;
}

.coll-order-card.drag-insert-after > .drop-line-right {
  display: flex !important;
}

.drop-line-bar {
  width: 4px;
  flex: 1;
  background: linear-gradient(180deg, #d8b4fe 0%, #a855f7 30%, #9333ea 70%, #d8b4fe 100%);
  border-radius: 4px;
  box-shadow: 0 0 12px #a855f7, 0 0 22px rgba(168, 85, 247, 0.8), 0 0 3px #ffffff;
  animation: pulseDropLine 1.2s ease-in-out infinite alternate;
}

.drop-line-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid #a855f7;
  box-shadow: 0 0 10px #a855f7, 0 0 18px rgba(168, 85, 247, 0.8);
  flex-shrink: 0;
}

@keyframes pulseDropLine {
  0% {
    box-shadow: 0 0 8px #a855f7, 0 0 16px rgba(168, 85, 247, 0.6), 0 0 2px #ffffff;
  }
  100% {
    box-shadow: 0 0 14px #a855f7, 0 0 26px rgba(168, 85, 247, 0.95), 0 0 4px #ffffff;
  }
}

.coll-order-card.drag-insert-before {
  box-shadow: -4px 0 16px rgba(168, 85, 247, 0.35);
  border-left-color: #a855f7;
}

.coll-order-card.drag-insert-after {
  box-shadow: 4px 0 16px rgba(168, 85, 247, 0.35);
  border-right-color: #a855f7;
}

/* Strictly disable hover card while dragging and dropping */
body.is-dragging-active #comicHoverCard {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* --- Panels (iPad/Tablet) Download Integration Styles --- */
.reader-panels-btn,
#btnSummaryPanelsDownload,
#popoverPanelsBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(192, 132, 252, 0.45) !important;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35) !important;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.reader-panels-btn:hover,
#btnSummaryPanelsDownload:hover,
#popoverPanelsBtn:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
  border-color: rgba(216, 180, 254, 0.7) !important;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.55) !important;
  transform: translateY(-1px);
}

.reader-panels-btn:active,
#btnSummaryPanelsDownload:active,
#popoverPanelsBtn:active {
  transform: translateY(0);
}

#ctxMenuPanelsDownload {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c084fc;
}

#ctxMenuPanelsDownload svg {
  color: #c084fc;
  stroke: #c084fc;
}

#ctxMenuPanelsDownload:hover {
  background: rgba(147, 51, 234, 0.2);
  color: #e9d5ff;
}

#panelsDownloadModal .modal-dialog {
  background: #0d121f;
  border: 1px solid rgba(168, 85, 247, 0.35);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(147, 51, 234, 0.25);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#panelsDownloadModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 22px;
}

#panelsDownloadModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.panels-steps-box ol li strong {
  font-weight: 600;
}

/* --- Summary Tab Styles (Admin First Tab) --- */
.summary-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #c084fc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.summary-section-title svg {
  color: #c084fc;
}

.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.summary-card {
  background: rgba(24, 32, 48, 0.65);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.summary-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-card-icon {
  font-size: 1rem;
}

.summary-card-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-card-value-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary-card-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
  word-break: break-all;
}

.summary-card-value.mono-val {
  font-size: 0.85rem;
  line-height: 1.3;
}

.btn-copy-summary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-copy-summary:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: #a855f7;
  color: #ffffff;
}

.btn-copy-summary.copied {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
  color: #4ade80;
}

.summary-card-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Ports Summary Table */
.ports-summary-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.ports-summary-table th {
  background: rgba(10, 14, 22, 0.6);
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
}

.ports-summary-table td {
  padding: 12px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(38, 50, 72, 0.5);
  vertical-align: middle;
}

.ports-summary-table tr:last-child td {
  border-bottom: none;
}

.ports-summary-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.port-num-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.92rem;
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 6px;
  padding: 2px 8px;
}

.proto-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.proto-badge-https {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.proto-badge-http {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.service-name-cell strong {
  color: var(--text-main);
  font-weight: 600;
}

.desc-cell {
  max-width: 320px;
}

.service-desc-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: block;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.status-badge-active {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge-stopped {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.btn-outline-summary-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-outline-summary-link:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: #a855f7;
  color: #ffffff;
}

/* System Stats Row */
.summary-system-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.stat-mini-pill {
  background: rgba(18, 24, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-mini-pill .pill-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.stat-mini-pill .pill-value {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 700;
}





