/* ============================================================================
   Zotero Citation Popup
   Floating popup for citation metadata, PDF viewer, and web preview.
   Triggered by hover + click on \cite{} commands in Monaco Editor.
   Accent: Amber/Gold rgba(234, 179, 8, *)
   ========================================================================== */

.zotero-citation-popup {
	position: fixed;
	background: rgba(18, 18, 18, 0.94);
	backdrop-filter: blur(20px) saturate(1.4);
	-webkit-backdrop-filter: blur(20px) saturate(1.4);
	border: 1px solid rgba(234, 179, 8, 0.18);
	border-radius: 12px;
	padding: 10px 14px 10px 14px;
	box-shadow:
		0 8px 40px rgba(0, 0, 0, 0.5),
		0 2px 12px rgba(0, 0, 0, 0.3),
		0 0 0 1px rgba(234, 179, 8, 0.06),
		inset 0 1px 0 rgba(255, 255, 255, 0.04);
	width: 480px;
	min-width: 380px;
	max-width: calc(100vw - 16px);
	height: 420px;
	min-height: 200px;
	max-height: calc(100vh - 16px);
	max-height: calc(100dvh - 16px);
	overflow: visible;
	z-index: 31000;
	opacity: 0;
	transform: translateY(6px) scale(0.96);
	transition:
		opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
		transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
	pointer-events: none;
	will-change: opacity, transform;
	display: flex;
	flex-direction: column;
}

.zotero-citation-popup.visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.zotero-citation-popup.zotero-citation-popup-detached {
	position: fixed !important;
	left: 0 !important;
	top: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	max-height: none !important;
	border-radius: 0;
	border-left: none;
	border-right: none;
	border-bottom: none;
	opacity: 1 !important;
	transform: none !important;
	pointer-events: auto !important;
}

.zotero-citation-popup.zotero-citation-popup-detached .zotero-citation-popup-header {
	cursor: default;
}

.zotero-citation-popup.zotero-citation-popup-detached .zotero-citation-popup-resize-handle {
	display: none;
}

/* Amber gradient accent line */
.zotero-citation-popup::before {
	content: '';
	position: absolute;
	top: 0;
	left: 16px;
	right: 16px;
	height: 1.5px;
	background: linear-gradient(90deg,
		transparent,
		rgba(234, 179, 8, 0.5) 20%,
		rgba(234, 179, 8, 0.7) 50%,
		rgba(234, 179, 8, 0.5) 80%,
		transparent);
	border-radius: 1px;
}

/* Subtle glow on bottom edge */
.zotero-citation-popup::after {
	content: '';
	position: absolute;
	bottom: -1px;
	left: 20%;
	right: 20%;
	height: 1px;
	background: linear-gradient(90deg,
		transparent,
		rgba(234, 179, 8, 0.12),
		transparent);
}

/* ── Header row ── */

.zotero-citation-popup-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
	cursor: grab;
	user-select: none;
	flex-shrink: 0;
}

.zotero-citation-popup-header:active {
	cursor: grabbing;
}

.zotero-citation-popup-label {
	font-size: 0.65rem;
	font-weight: 600;
	color: rgba(234, 179, 8, 0.6);
	text-transform: uppercase;
	letter-spacing: 0.8px;
	line-height: 1;
	user-select: none;
}

/* Connection status dot */
.zotero-citation-popup-status {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	margin-left: 6px;
	flex-shrink: 0;
	transition: background 0.3s;
}

.zotero-citation-popup-status.connected {
	background: rgba(78, 201, 176, 0.8);
	box-shadow: 0 0 4px rgba(78, 201, 176, 0.4);
}

.zotero-citation-popup-status.disconnected {
	background: rgba(241, 158, 158, 0.6);
}

/* Source badge (BBT / Web API / .bib) */
.zotero-citation-popup-source-badge {
	font-size: 0.55rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	padding: 1px 6px;
	border-radius: 4px;
	margin-left: 8px;
	flex-shrink: 0;
	text-transform: uppercase;
	line-height: 1.4;
}

.zotero-citation-popup-source-badge.source-bbt {
	color: rgba(78, 201, 176, 1);
	background: rgba(78, 201, 176, 0.12);
	border: 1px solid rgba(78, 201, 176, 0.25);
}

.zotero-citation-popup-source-badge.source-web {
	color: rgba(130, 170, 255, 1);
	background: rgba(130, 170, 255, 0.12);
	border: 1px solid rgba(130, 170, 255, 0.25);
}

.zotero-citation-popup-source-badge.source-bib {
	color: rgba(234, 179, 8, 0.9);
	background: rgba(234, 179, 8, 0.1);
	border: 1px solid rgba(234, 179, 8, 0.2);
}

.zotero-citation-popup-citekey {
	font-size: 0.6rem;
	color: rgba(255, 255, 255, 0.3);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 4px;
	padding: 1px 5px;
	letter-spacing: 0.3px;
	user-select: none;
	max-width: 180px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ── Action buttons ── */

.zotero-citation-popup-actions {
	display: flex;
	gap: 4px;
	margin-left: auto;
}

.zotero-citation-popup-btn {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 4px;
	color: rgba(234, 179, 8, 0.7);
	font-size: 0.72rem;
	padding: 2px 6px;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
	line-height: 1.2;
}

.zotero-citation-popup-btn:hover {
	background: rgba(234, 179, 8, 0.15);
	color: rgba(234, 179, 8, 1);
	border-color: rgba(234, 179, 8, 0.25);
}

.zotero-citation-popup-btn.active {
	background: rgba(234, 179, 8, 0.2);
	border-color: rgba(234, 179, 8, 0.35);
	color: rgba(234, 179, 8, 1);
}

/* ── Tab bar ── */

.zotero-citation-popup-tabs {
	display: flex;
	gap: 2px;
	margin-bottom: 8px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	padding-bottom: 0;
	flex-shrink: 0;
}

.zotero-citation-popup-tab {
	background: transparent;
	border: none;
	border-bottom: 2px solid transparent;
	color: rgba(255, 255, 255, 0.4);
	font-size: 0.7rem;
	font-weight: 500;
	padding: 4px 10px;
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s;
	letter-spacing: 0.3px;
}

.zotero-citation-popup-tab:hover {
	color: rgba(255, 255, 255, 0.7);
}

.zotero-citation-popup-tab.active {
	color: rgba(234, 179, 8, 0.9);
	border-bottom-color: rgba(234, 179, 8, 0.7);
}

/* ── Tab content area ── */

.zotero-citation-popup-body {
	flex: 1;
	overflow: hidden;
	position: relative;
	min-height: 0;
}

.zotero-citation-popup-tab-content {
	display: none;
	height: 100%;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: rgba(234, 179, 8, 0.2) transparent;
}

.zotero-citation-popup-tab-content.active {
	display: flex;
	flex-direction: column;
}

.zotero-citation-popup-tab-content::-webkit-scrollbar {
	width: 4px;
}

.zotero-citation-popup-tab-content::-webkit-scrollbar-thumb {
	background: rgba(234, 179, 8, 0.2);
	border-radius: 2px;
}

.zotero-citation-popup-tab-content::-webkit-scrollbar-track {
	background: transparent;
}

/* ── Info tab: Metadata ── */

.zotero-meta-title {
	font-size: 0.88rem;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.92);
	line-height: 1.35;
	margin-bottom: 6px;
}

.zotero-meta-authors {
	font-size: 0.72rem;
	color: rgba(234, 179, 8, 0.7);
	margin-bottom: 4px;
	line-height: 1.3;
}

.zotero-meta-row {
	display: flex;
	align-items: baseline;
	gap: 6px;
	font-size: 0.68rem;
	color: rgba(255, 255, 255, 0.5);
	margin-bottom: 3px;
}

.zotero-meta-row-label {
	color: rgba(255, 255, 255, 0.3);
	font-weight: 500;
	min-width: 50px;
	flex-shrink: 0;
}

.zotero-meta-row-value {
	color: rgba(255, 255, 255, 0.65);
}

.zotero-meta-doi {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: rgba(234, 179, 8, 0.1);
	border: 1px solid rgba(234, 179, 8, 0.2);
	border-radius: 4px;
	padding: 1px 6px;
	font-size: 0.62rem;
	color: rgba(234, 179, 8, 0.8);
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

.zotero-meta-doi:hover {
	background: rgba(234, 179, 8, 0.2);
	border-color: rgba(234, 179, 8, 0.4);
	color: rgba(234, 179, 8, 1);
}

.zotero-meta-abstract {
	font-size: 0.68rem;
	color: rgba(255, 255, 255, 0.5);
	line-height: 1.5;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	max-height: 140px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: rgba(234, 179, 8, 0.15) transparent;
}

.zotero-meta-abstract::-webkit-scrollbar {
	width: 3px;
}

.zotero-meta-abstract::-webkit-scrollbar-thumb {
	background: rgba(234, 179, 8, 0.15);
	border-radius: 2px;
}

.zotero-meta-abstract-label {
	font-weight: 600;
	color: rgba(255, 255, 255, 0.35);
	font-size: 0.6rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
}

/* ── Action buttons row ── */

.zotero-meta-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.zotero-meta-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 6px;
	color: rgba(255, 255, 255, 0.6);
	font-size: 0.66rem;
	padding: 4px 10px;
	cursor: pointer;
	transition: all 0.15s;
}

.zotero-meta-action-btn:hover {
	background: rgba(234, 179, 8, 0.12);
	border-color: rgba(234, 179, 8, 0.25);
	color: rgba(234, 179, 8, 0.9);
}

.zotero-meta-action-btn .action-icon {
	font-size: 0.8rem;
}

/* ── PDF tab ── */

.zotero-pdf-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.zotero-pdf-toolbar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 0;
	margin-bottom: 4px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	flex-shrink: 0;
}

.zotero-pdf-toolbar-btn {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.5);
	font-size: 0.68rem;
	padding: 2px 6px;
	cursor: pointer;
	transition: all 0.12s;
	line-height: 1.2;
}

.zotero-pdf-toolbar-btn:hover {
	background: rgba(234, 179, 8, 0.12);
	color: rgba(234, 179, 8, 0.9);
	border-color: rgba(234, 179, 8, 0.2);
}

.zotero-pdf-toolbar-btn:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.zotero-pdf-page-info {
	font-size: 0.62rem;
	color: rgba(255, 255, 255, 0.4);
	user-select: none;
}

.zotero-pdf-page-input {
	width: 28px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 3px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.62rem;
	text-align: center;
	padding: 1px 2px;
	outline: none;
}

.zotero-pdf-page-input:focus {
	border-color: rgba(234, 179, 8, 0.4);
}

.zotero-pdf-search {
	margin-left: auto;
	display: flex;
	gap: 4px;
	align-items: center;
}

.zotero-pdf-search-input {
	width: 100px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.62rem;
	padding: 3px 6px;
	outline: none;
}

.zotero-pdf-search-input:focus {
	border-color: rgba(234, 179, 8, 0.35);
}

.zotero-pdf-search-input.search-success {
	border-color: rgba(74, 222, 128, 0.55);
	box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.2);
}

.zotero-pdf-search-input.search-fail {
	border-color: rgba(239, 68, 68, 0.5);
	box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.zotero-pdf-search-input::placeholder {
	color: rgba(255, 255, 255, 0.2);
}

.zotero-pdf-search-counter {
	font-size: 0.58rem;
	color: rgba(255, 255, 255, 0.45);
	white-space: nowrap;
	min-width: 40px;
	text-align: center;
	user-select: none;
}

.zotero-pdf-search-nav-btn {
	padding: 2px 4px !important;
	font-size: 0.62rem !important;
	min-width: 18px;
}

.zotero-pdf-search-option-btn {
	padding: 2px 5px !important;
	font-size: 0.58rem !important;
	min-width: 20px;
	font-weight: 600;
	opacity: 0.5;
	transition: all 0.12s;
}

.zotero-pdf-search-option-btn.active {
	opacity: 1;
	background: rgba(234, 179, 8, 0.18) !important;
	border-color: rgba(234, 179, 8, 0.35) !important;
	color: rgba(234, 179, 8, 1) !important;
}

.zotero-pdf-search-highlight {
	background: rgba(234, 179, 8, 0.25) !important;
	border-radius: 2px;
}

.zotero-pdf-search-active {
	background: rgba(234, 130, 0, 0.55) !important;
	color: rgba(0, 0, 0, 0.85) !important;
	border-radius: 2px;
	outline: 2px solid rgba(234, 179, 8, 0.8);
	outline-offset: 1px;
}

.zotero-pdf-pages-container {
	flex: 1;
	overflow: auto;
	position: relative;
	background: rgba(255, 255, 255, 0.02);
	border-radius: 4px;
	min-height: 0;
	scrollbar-width: thin;
	scrollbar-color: rgba(234, 179, 8, 0.15) transparent;
}

.zotero-pdf-pages-container::-webkit-scrollbar {
	width: 4px;
	height: 4px;
}

.zotero-pdf-pages-container::-webkit-scrollbar-thumb {
	background: rgba(234, 179, 8, 0.15);
	border-radius: 2px;
}

.zotero-pdf-pages-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 8px 6px 14px 6px;
	min-width: fit-content;
}

.zotero-pdf-page {
	position: relative;
	background: #fff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
	border-radius: 2px;
	overflow: visible;
}

.zotero-pdf-page-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(20, 20, 20, 0.5);
	font-size: 0.72rem;
	background: #f2f2f2;
	user-select: none;
}

.zotero-pdf-page-canvas {
	display: block;
}

.zotero-pdf-text-layer {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 3;
	pointer-events: auto;
	user-select: text;
}

.zotero-pdf-text-layer span {
	user-select: text;
}

.zotero-pdf-match-overlay {
	position: absolute;
	border: 2px solid rgba(234, 179, 8, 0.9);
	background: rgba(234, 179, 8, 0.22);
	border-radius: 3px;
	pointer-events: none;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3) inset;
}

.zotero-pdf-match-span {
	background: rgba(234, 179, 8, 0.35) !important;
	color: rgba(0, 0, 0, 0.8) !important;
	border-radius: 2px;
}

.zotero-pdf-evidence-pin {
	position: absolute;
	z-index: 5;
	border: 1px solid rgba(52, 211, 153, 0.9);
	background: rgba(52, 211, 153, 0.25);
	border-radius: 3px;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28) inset;
}

.zotero-pdf-evidence-pin:hover {
	background: rgba(52, 211, 153, 0.35);
}

.zotero-pdf-evidence-pin.active {
	border-color: rgba(234, 179, 8, 1);
	background: rgba(234, 179, 8, 0.35);
}

.zotero-pdf-selection-toolbar {
	position: absolute;
	z-index: 25;
	display: none;
	align-items: center;
	gap: 4px;
	background: rgba(20, 20, 20, 0.97);
	border: 1px solid rgba(234, 179, 8, 0.25);
	border-radius: 6px;
	padding: 4px;
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}

.zotero-pdf-selection-toolbar button {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.78);
	font-size: 0.63rem;
	line-height: 1.15;
	padding: 4px 7px;
	cursor: pointer;
}

.zotero-pdf-selection-toolbar button:hover {
	background: rgba(234, 179, 8, 0.16);
	border-color: rgba(234, 179, 8, 0.32);
	color: rgba(234, 179, 8, 0.95);
}

.zotero-pdf-context-menu {
	position: fixed;
	z-index: 10020;
	display: none;
	flex-direction: column;
	gap: 2px;
	background: rgba(17, 17, 17, 0.98);
	border: 1px solid rgba(234, 179, 8, 0.28);
	border-radius: 7px;
	padding: 5px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

.zotero-pdf-context-menu button {
	background: transparent;
	border: 1px solid transparent;
	border-radius: 5px;
	color: rgba(255, 255, 255, 0.78);
	font-size: 0.66rem;
	padding: 5px 8px;
	text-align: left;
	cursor: pointer;
}

.zotero-pdf-context-menu button:hover {
	background: rgba(234, 179, 8, 0.14);
	border-color: rgba(234, 179, 8, 0.25);
	color: rgba(234, 179, 8, 0.95);
}

.zotero-pdf-canvas-wrapper {
	flex: 1;
	overflow: auto;
	background: rgba(255, 255, 255, 0.02);
	border-radius: 4px;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	min-height: 0;
	scrollbar-width: thin;
	scrollbar-color: rgba(234, 179, 8, 0.15) transparent;
}

.zotero-pdf-canvas-wrapper::-webkit-scrollbar {
	width: 4px;
	height: 4px;
}

.zotero-pdf-canvas-wrapper::-webkit-scrollbar-thumb {
	background: rgba(234, 179, 8, 0.15);
	border-radius: 2px;
}

.zotero-pdf-canvas {
	max-width: 100%;
}

.zotero-pdf-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 1;
	color: rgba(255, 255, 255, 0.2);
	font-size: 0.72rem;
	text-align: center;
	gap: 8px;
	padding: 20px;
}

.zotero-pdf-placeholder-icon {
	font-size: 2rem;
	opacity: 0.3;
}

.zotero-evidence-section {
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.zotero-evidence-title {
	font-size: 0.6rem;
	font-weight: 600;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	color: rgba(234, 179, 8, 0.55);
	margin-bottom: 6px;
}

.zotero-evidence-empty {
	font-size: 0.66rem;
	color: rgba(255, 255, 255, 0.36);
	font-style: italic;
}

.zotero-evidence-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.zotero-evidence-item {
	display: flex;
	flex-direction: column;
	gap: 2px;
	background: rgba(255, 255, 255, 0.02);
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 6px;
	padding: 4px;
}

.zotero-evidence-editor-row,
.zotero-evidence-pdf-row {
	display: flex;
	align-items: center;
	gap: 5px;
}

.zotero-evidence-icon {
	flex: 0 0 auto;
	font-size: 0.52rem;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.3);
	background: rgba(255, 255, 255, 0.05);
	border-radius: 3px;
	padding: 1px 4px;
	user-select: none;
	min-width: 22px;
	text-align: center;
}

.zotero-evidence-connector {
	margin-left: 12px;
	width: 1px;
	height: 6px;
	background: rgba(234, 179, 8, 0.2);
}

.zotero-evidence-jump {
	flex: 1;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 5px;
	color: rgba(255, 255, 255, 0.68);
	font-size: 0.62rem;
	text-align: left;
	padding: 3px 7px;
	cursor: pointer;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.zotero-evidence-jump-editor:hover {
	border-color: rgba(130, 170, 255, 0.3);
	background: rgba(130, 170, 255, 0.1);
	color: rgba(130, 170, 255, 0.95);
}

.zotero-evidence-jump-pdf:hover {
	border-color: rgba(234, 179, 8, 0.26);
	background: rgba(234, 179, 8, 0.1);
	color: rgba(234, 179, 8, 0.94);
}

.zotero-evidence-remove {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 4px;
	color: rgba(241, 158, 158, 0.7);
	font-size: 0.65rem;
	cursor: pointer;
}

.zotero-evidence-remove:hover {
	background: rgba(241, 158, 158, 0.14);
	border-color: rgba(241, 158, 158, 0.3);
}

/* ── Linking Banner ── */

.zotero-linking-banner {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 5px 10px;
	margin-bottom: 4px;
	background: rgba(59, 130, 246, 0.12);
	border: 1px solid rgba(59, 130, 246, 0.25);
	border-radius: 6px;
	flex-shrink: 0;
}

.zotero-linking-banner-text {
	flex: 1;
	font-size: 0.62rem;
	color: rgba(130, 170, 255, 0.9);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.zotero-linking-banner-cancel {
	flex: 0 0 auto;
	background: none;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 3px;
	color: rgba(255, 255, 255, 0.4);
	font-size: 0.6rem;
	padding: 1px 4px;
	cursor: pointer;
}

.zotero-linking-banner-cancel:hover {
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.7);
}

/* ── Citekey Selector ── */

.zotero-citekey-selector {
	display: none;
	align-items: center;
	gap: 5px;
	padding: 3px 10px;
	flex-shrink: 0;
	flex-wrap: wrap;
}

.zotero-citekey-selector-label {
	font-size: 0.58rem;
	color: rgba(255, 255, 255, 0.35);
	user-select: none;
	white-space: nowrap;
}

.zotero-citekey-selector-btn {
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.55);
	font-size: 0.58rem;
	padding: 2px 7px;
	cursor: pointer;
	max-width: 160px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: all 0.12s;
}

.zotero-citekey-selector-btn:hover {
	background: rgba(234, 179, 8, 0.1);
	border-color: rgba(234, 179, 8, 0.25);
	color: rgba(234, 179, 8, 0.9);
}

.zotero-citekey-selector-btn.active {
	background: rgba(234, 179, 8, 0.15);
	border-color: rgba(234, 179, 8, 0.35);
	color: rgba(234, 179, 8, 1);
	font-weight: 600;
}

/* Attachment selector */
.zotero-attachment-selector {
	display: none;
	align-items: center;
	gap: 5px;
	padding: 2px 10px 6px 10px;
	flex-shrink: 0;
	flex-wrap: wrap;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
	margin-bottom: 6px;
}

.zotero-attachment-selector-label {
	font-size: 0.58rem;
	color: rgba(255, 255, 255, 0.35);
	user-select: none;
	white-space: nowrap;
}

.zotero-attachment-selector-btn {
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.58);
	font-size: 0.56rem;
	padding: 2px 7px;
	cursor: pointer;
	max-width: 210px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: all 0.12s;
}

.zotero-attachment-selector-btn:hover {
	background: rgba(234, 179, 8, 0.1);
	border-color: rgba(234, 179, 8, 0.25);
	color: rgba(234, 179, 8, 0.92);
}

.zotero-attachment-selector-btn.active {
	background: rgba(234, 179, 8, 0.16);
	border-color: rgba(234, 179, 8, 0.36);
	color: rgba(234, 179, 8, 1);
	font-weight: 600;
}

.zotero-attachment-type-pdf {
	border-color: rgba(52, 211, 153, 0.22);
}

.zotero-attachment-type-html,
.zotero-attachment-type-web {
	border-color: rgba(130, 170, 255, 0.22);
}

/* ── Web tab ── */

.zotero-web-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.zotero-web-iframe {
	flex: 1;
	border: none;
	border-radius: 4px;
	background: #fff;
	min-height: 0;
}

.zotero-web-link-bar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 0;
	margin-bottom: 4px;
	flex-shrink: 0;
}

.zotero-attachment-toolbar {
	padding-top: 2px;
	margin-bottom: 6px;
}

.zotero-attachment-toolbar .zotero-pdf-search-input:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.zotero-attachment-toolbar .zotero-pdf-toolbar-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.zotero-web-url {
	font-size: 0.62rem;
	color: rgba(234, 179, 8, 0.6);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.zotero-web-url:hover {
	color: rgba(234, 179, 8, 0.9);
	text-decoration: underline;
}

.zotero-web-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 1;
	color: rgba(255, 255, 255, 0.2);
	font-size: 0.72rem;
	text-align: center;
	gap: 8px;
	padding: 20px;
}

.zotero-attachment-text-preview {
	flex: 1;
	margin: 0;
	padding: 10px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.25);
	color: rgba(255, 255, 255, 0.82);
	font-size: 0.66rem;
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-word;
	overflow: auto;
	font-family: Consolas, 'Courier New', monospace;
}

.zotero-attachment-search-highlight {
	background: rgba(234, 179, 8, 0.28);
	color: rgba(255, 255, 255, 0.92);
	border-radius: 2px;
	padding: 0 1px;
}

.zotero-attachment-search-active {
	background: rgba(234, 130, 0, 0.6);
	color: rgba(0, 0, 0, 0.9);
	outline: 1px solid rgba(234, 179, 8, 0.9);
}

.zotero-attachment-evidence-highlight {
	background: rgba(52, 211, 153, 0.28);
	color: rgba(255, 255, 255, 0.92);
	border-radius: 2px;
	padding: 0 1px;
}

.zotero-attachment-evidence-active {
	background: rgba(234, 130, 0, 0.45);
	outline: 1px solid rgba(234, 179, 8, 0.9);
}

/* ── Settings dropdown ── */

.zotero-citation-popup-settings {
	position: absolute;
	bottom: 100%;
	right: 0;
	margin-bottom: 4px;
	background: rgba(22, 22, 22, 0.97);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid rgba(234, 179, 8, 0.15);
	border-radius: 8px;
	padding: 10px 12px;
	min-width: 260px;
	z-index: 32000;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px) scale(0.97);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.zotero-citation-popup-settings.visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.zotero-citation-popup-settings-title {
	font-size: 0.62rem;
	font-weight: 600;
	color: rgba(234, 179, 8, 0.55);
	text-transform: uppercase;
	letter-spacing: 0.7px;
	margin-bottom: 8px;
	user-select: none;
}

.zotero-citation-popup-settings-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 4px 0;
	font-size: 0.72rem;
	color: rgba(255, 255, 255, 0.7);
}

.zotero-citation-popup-settings-row + .zotero-citation-popup-settings-row {
	border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Settings separator */
.zotero-citation-popup-settings-separator {
	height: 1px;
	background: rgba(255, 255, 255, 0.06);
	margin: 6px 0;
}

/* Settings section label */
.zotero-citation-popup-settings-section {
	font-size: 0.58rem;
	font-weight: 600;
	color: rgba(234, 179, 8, 0.4);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-top: 4px;
	margin-bottom: 2px;
	user-select: none;
}

/* Mini toggle switch */
.zotero-citation-popup-toggle {
	position: relative;
	display: inline-block;
	width: 30px;
	height: 16px;
	flex-shrink: 0;
}

.zotero-citation-popup-toggle input {
	opacity: 0;
	width: 0;
	height: 0;
}

.zotero-citation-popup-toggle-slider {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.2s;
}

.zotero-citation-popup-toggle-slider::before {
	content: '';
	position: absolute;
	width: 12px;
	height: 12px;
	left: 2px;
	bottom: 2px;
	background: rgba(255, 255, 255, 0.5);
	border-radius: 50%;
	transition: transform 0.2s, background 0.2s;
}

.zotero-citation-popup-toggle input:checked + .zotero-citation-popup-toggle-slider {
	background: rgba(234, 179, 8, 0.4);
}

.zotero-citation-popup-toggle input:checked + .zotero-citation-popup-toggle-slider::before {
	transform: translateX(14px);
	background: rgba(234, 179, 8, 1);
}

/* Mini select */
.zotero-citation-popup-select {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.68rem;
	padding: 2px 4px;
	outline: none;
	cursor: pointer;
	min-width: 65px;
}

.zotero-citation-popup-select:focus {
	border-color: rgba(234, 179, 8, 0.35);
}

.zotero-citation-popup-select option {
	background: #1e1e1e;
	color: #ccc;
}

/* Mini text input */
.zotero-citation-popup-input {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.62rem;
	padding: 2px 6px;
	outline: none;
	min-width: 120px;
	font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.zotero-citation-popup-input:focus {
	border-color: rgba(234, 179, 8, 0.35);
}

.zotero-citation-popup-input::placeholder {
	color: rgba(255, 255, 255, 0.2);
}

/* Field hint (below input) */
.zotero-setup-field-hint {
	font-size: 0.54rem;
	color: rgba(234, 179, 8, 0.45);
	line-height: 1.4;
	margin-top: 2px;
	padding-left: 1px;
}

.zotero-setup-field-hint strong {
	color: rgba(241, 158, 158, 0.7);
}

.zotero-setup-field-hint em {
	color: rgba(234, 179, 8, 0.6);
	font-style: normal;
}

/* ── Connection Test Button ── */

.zotero-setup-test-btn {
	width: 100%;
	padding: 5px 10px;
	background: rgba(234, 179, 8, 0.1);
	border: 1px solid rgba(234, 179, 8, 0.2);
	border-radius: 6px;
	color: rgba(234, 179, 8, 0.8);
	font-size: 0.68rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s;
}

.zotero-setup-test-btn:hover {
	background: rgba(234, 179, 8, 0.18);
	border-color: rgba(234, 179, 8, 0.35);
	color: rgba(234, 179, 8, 1);
}

.zotero-setup-test-result {
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin-top: 6px;
	font-size: 0.62rem;
}

.zotero-setup-test-result .test-pass {
	color: rgba(78, 201, 176, 0.9);
}

.zotero-setup-test-result .test-fail {
	color: rgba(241, 158, 158, 0.85);
}

.zotero-setup-test-result .test-neutral {
	color: rgba(255, 255, 255, 0.4);
}

.zotero-setup-test-result .test-pending {
	display: flex;
	align-items: center;
	gap: 6px;
	color: rgba(234, 179, 8, 0.6);
}

/* ── Setup Guide Button ── */

.zotero-setup-guide-btn {
	width: 100%;
	padding: 5px 10px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 6px;
	color: rgba(255, 255, 255, 0.5);
	font-size: 0.66rem;
	cursor: pointer;
	transition: all 0.15s;
}

.zotero-setup-guide-btn:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.15);
	color: rgba(255, 255, 255, 0.7);
}

/* ── Setup Guide Modal / Overlay ── */

.zotero-setup-guide-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 40000;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: zotero-fade-in 0.2s ease;
}

@keyframes zotero-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.zotero-setup-guide-modal {
	background: rgba(22, 22, 22, 0.98);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid rgba(234, 179, 8, 0.15);
	border-radius: 14px;
	width: 520px;
	max-width: 92vw;
	max-height: 80vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow:
		0 20px 60px rgba(0, 0, 0, 0.6),
		0 0 0 1px rgba(234, 179, 8, 0.06);
	animation: zotero-slide-up 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes zotero-slide-up {
	from { transform: translateY(12px) scale(0.97); opacity: 0; }
	to { transform: translateY(0) scale(1); opacity: 1; }
}

.zotero-setup-guide-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.zotero-setup-guide-title {
	font-size: 0.82rem;
	font-weight: 600;
	color: rgba(234, 179, 8, 0.85);
}

.zotero-setup-guide-close {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.3);
	font-size: 0.9rem;
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 4px;
	transition: all 0.12s;
}

.zotero-setup-guide-close:hover {
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.6);
}

.zotero-setup-guide-content {
	padding: 14px 18px 18px;
	overflow-y: auto;
	flex: 1;
	scrollbar-width: thin;
	scrollbar-color: rgba(234, 179, 8, 0.15) transparent;
}

.zotero-setup-guide-content::-webkit-scrollbar {
	width: 4px;
}

.zotero-setup-guide-content::-webkit-scrollbar-thumb {
	background: rgba(234, 179, 8, 0.15);
	border-radius: 2px;
}

.zotero-setup-guide-intro {
	font-size: 0.72rem;
	color: rgba(255, 255, 255, 0.5);
	line-height: 1.5;
	margin-bottom: 14px;
}

/* Guide tabs */
.zotero-setup-guide-tabs {
	display: flex;
	gap: 6px;
	margin-bottom: 14px;
}

.zotero-setup-guide-tab {
	flex: 1;
	padding: 7px 10px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 8px;
	color: rgba(255, 255, 255, 0.45);
	font-size: 0.66rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s;
	text-align: center;
}

.zotero-setup-guide-tab:hover {
	background: rgba(255, 255, 255, 0.07);
	color: rgba(255, 255, 255, 0.6);
}

.zotero-setup-guide-tab.active {
	background: rgba(234, 179, 8, 0.1);
	border-color: rgba(234, 179, 8, 0.25);
	color: rgba(234, 179, 8, 0.9);
}

/* Guide panels */
.zotero-setup-guide-panel {
	display: none;
}

.zotero-setup-guide-panel.active {
	display: block;
}

.zotero-setup-guide-badge {
	display: inline-block;
	font-size: 0.58rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	padding: 3px 10px;
	border-radius: 20px;
	margin-bottom: 14px;
}

.zotero-setup-guide-badge.bbt {
	color: rgba(78, 201, 176, 1);
	background: rgba(78, 201, 176, 0.1);
	border: 1px solid rgba(78, 201, 176, 0.2);
}

.zotero-setup-guide-badge.web {
	color: rgba(130, 170, 255, 1);
	background: rgba(130, 170, 255, 0.1);
	border: 1px solid rgba(130, 170, 255, 0.2);
}

/* Steps */
.zotero-setup-step {
	display: flex;
	gap: 12px;
	margin-bottom: 14px;
	position: relative;
}

.zotero-setup-step:not(:last-child)::after {
	content: '';
	position: absolute;
	left: 11px;
	top: 24px;
	bottom: -10px;
	width: 1px;
	background: rgba(234, 179, 8, 0.1);
}

.zotero-setup-step-num {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(234, 179, 8, 0.12);
	border: 1px solid rgba(234, 179, 8, 0.25);
	color: rgba(234, 179, 8, 0.8);
	font-size: 0.62rem;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	position: relative;
	z-index: 1;
}

.zotero-setup-step-body {
	flex: 1;
	min-width: 0;
}

.zotero-setup-step-title {
	font-size: 0.74rem;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.85);
	margin-bottom: 3px;
}

.zotero-setup-step-desc {
	font-size: 0.66rem;
	color: rgba(255, 255, 255, 0.45);
	line-height: 1.5;
	margin-bottom: 4px;
}

.zotero-setup-step-desc code {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 3px;
	padding: 1px 5px;
	font-size: 0.6rem;
	font-family: 'JetBrains Mono', 'Fira Code', monospace;
	color: rgba(234, 179, 8, 0.7);
}

.zotero-setup-step-detail {
	font-size: 0.62rem;
	color: rgba(255, 255, 255, 0.3);
	line-height: 1.5;
	margin-top: 4px;
	padding-left: 10px;
	border-left: 2px solid rgba(255, 255, 255, 0.06);
}

.zotero-setup-step-detail em {
	color: rgba(234, 179, 8, 0.6);
	font-style: normal;
}

.zotero-setup-link {
	display: inline-block;
	font-size: 0.62rem;
	color: rgba(130, 170, 255, 0.8);
	text-decoration: none;
	padding: 2px 8px;
	background: rgba(130, 170, 255, 0.06);
	border: 1px solid rgba(130, 170, 255, 0.15);
	border-radius: 4px;
	margin-top: 4px;
	transition: all 0.12s;
	cursor: pointer;
}

.zotero-setup-link:hover {
	background: rgba(130, 170, 255, 0.12);
	border-color: rgba(130, 170, 255, 0.3);
	color: rgba(130, 170, 255, 1);
}

.zotero-setup-note {
	font-size: 0.64rem;
	color: rgba(234, 179, 8, 0.55);
	background: rgba(234, 179, 8, 0.05);
	border: 1px solid rgba(234, 179, 8, 0.12);
	border-radius: 6px;
	padding: 8px 12px;
	line-height: 1.5;
	margin-top: 10px;
}

/* ── Resize handle ── */

.zotero-citation-popup-resize-handle {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 16px;
	height: 16px;
	cursor: nwse-resize;
	z-index: 2;
}

.zotero-citation-popup-resize-handle::before {
	content: '';
	position: absolute;
	bottom: 3px;
	right: 3px;
	width: 8px;
	height: 8px;
	border-right: 2px solid rgba(234, 179, 8, 0.3);
	border-bottom: 2px solid rgba(234, 179, 8, 0.3);
}

.zotero-citation-popup-resize-handle:hover::before {
	border-color: rgba(234, 179, 8, 0.6);
}

/* ── Loading state ── */

.zotero-citation-popup-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	color: rgba(234, 179, 8, 0.5);
	font-size: 0.7rem;
	padding: 20px 0;
}

.zotero-citation-popup-spinner {
	width: 10px;
	height: 10px;
	border: 1.5px solid rgba(234, 179, 8, 0.15);
	border-top-color: rgba(234, 179, 8, 0.6);
	border-radius: 50%;
	animation: zotero-spin 0.6s linear infinite;
}

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

/* ── Empty / Error states ── */

.zotero-citation-popup-empty {
	color: rgba(255, 255, 255, 0.2);
	font-size: 0.72rem;
	font-style: italic;
	text-align: center;
	padding: 20px 10px;
	user-select: none;
}

.zotero-citation-popup-error {
	color: rgba(241, 158, 158, 0.7);
	font-size: 0.68rem;
	text-align: center;
	padding: 10px;
}
