/*============================================================
  CITEKIT – Block & Format Editor Styles
============================================================*/

/* ── BIBLIOGRAPHY BLOCK ─────────────────────────────────── */

.citekit-bibliography-block {
	border: 1px dashed #d1d5db;
	border-radius: 8px;
	padding: 16px 20px;
	background: #f9fafb;
}

.ck-bibliography-editor-preview {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #374151;
}

.ck-bibliography-editor-icon {
	display: flex;
	align-items: center;
	color: #2F6FA3;
	flex-shrink: 0;
}

.ck-bibliography-editor-label {
	font-size: 14px;
	font-weight: 600;
	color: #111827;
	flex: 1;
}

.ck-bibliography-editor-style {
	font-size: 12px;
	color: #6b7280;
	background: #e5e7eb;
	padding: 2px 8px;
	border-radius: 4px;
}

/* ── TOOLBAR POPOVER ────────────────────────────────────── */

.ck-toolbar-popover .components-popover__content {
	min-width: 300px;
	max-width: 360px;
	padding: 0;
}

.ck-popover-inner {
	padding: 14px 16px 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ck-popover-title {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #6b7280;
	padding-bottom: 8px;
	border-bottom: 1px solid #f3f4f6;
}

.ck-popover-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.ck-popover-actions {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 8px;
	padding-top: 8px;
	border-top: 1px solid #f3f4f6;
}

/* ── INSPECTOR SIDEBAR PANELS ───────────────────────────── */

.ck-sidebar-fields {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ck-sidebar-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

/* ── REFERENCE SUGGESTION DROPDOWN ─────────────────────── */

.ck-suggestions {
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	overflow: hidden;
	margin-top: -4px;
	margin-bottom: 2px;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0,0,0,.09);
}

.ck-suggestion-row {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 100%;
	text-align: left;
	background: none;
	border: none;
	border-bottom: 1px solid #f3f4f6;
	padding: 7px 10px;
	cursor: pointer;
	transition: background 0.1s;
}

.ck-suggestion-row:last-child {
	border-bottom: none;
}

.ck-suggestion-row:hover {
	background: #eff6ff;
}

.ck-suggestion-id {
	font-size: 11px;
	font-weight: 600;
	color: #1d4ed8;
	font-family: ui-monospace, monospace;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ck-suggestion-meta {
	font-size: 11px;
	color: #6b7280;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════
   INLINE CITATION [n] AND TOOLTIP [t] TOKENS IN THE EDITOR
   ══════════════════════════════════════════════════════════

   Architecture:
   • Tokens are stored as registered RichText format spans in the block HTML.
   • CSS counters on the editor writing-flow root auto-number citations [1][2]…
     across all blocks without any JavaScript.
   • The span's own text content (U+FFFC object-replacement char inserted by
     wp.richText.insertObject) is hidden with font-size:0 so only the ::before
     pseudo-element is visible.
*/

/* Counter resets — see the combined counter-reset block below where ck-fn is added */

/* ── Citation token [n] ─────────────────────────────────── */

.ck-cite-token {
	display: inline !important;
	font-size: 0 !important;      /* hide U+FFFC replacement char */
	cursor: pointer !important;
	counter-increment: ck-cite;
	-webkit-user-select: none;
	user-select: none;
}

.ck-cite-token::before {
	content: '[' counter(ck-cite) ']';
	display: inline-flex;
	align-items: center;
	background: #dbeafe;
	color: #1d4ed8;
	border-radius: 4px;
	padding: 0 5px;
	font-size: 11px !important;
	font-weight: 700;
	font-family: Verdana, sans-serif;
	margin: 0 1px;
	vertical-align: baseline;
	line-height: 1.6;
	cursor: pointer;
}

.ck-cite-token:hover::before {
	background: #bfdbfe;
}

/* ── Tooltip token [t] ──────────────────────────────────── */

.ck-tip-token {
	display: inline !important;
	font-size: 0 !important;
	cursor: pointer !important;
	-webkit-user-select: none;
	user-select: none;
}

.ck-tip-token::before {
	content: '[t]';
	display: inline-flex;
	align-items: center;
	background: #f3e8ff;
	color: #7c3aed;
	border-radius: 4px;
	padding: 0 5px;
	font-size: 11px !important;
	font-weight: 700;
	font-family: Verdana, sans-serif;
	margin: 0 1px;
	vertical-align: baseline;
	line-height: 1.6;
	cursor: pointer;
}

.ck-tip-token::after {
	content: '\2020';   /* † */
	color: #7c3aed;
	font-size: 10px !important;
	font-weight: 700;
	vertical-align: super;
	margin-left: 1px;
	cursor: pointer;
}

.ck-tip-token:hover::before {
	background: #e9d5ff;
}

/* ── Footnote token ─────────────────────────────────────── */

.block-editor-writing-flow {
	counter-reset: ck-cite ck-fn;
}

.ck-fn-token {
	display: inline !important;
	font-size: 0 !important;
	cursor: pointer !important;
	counter-increment: ck-fn;
	-webkit-user-select: none;
	user-select: none;
}

.ck-fn-token::before {
	content: '[f]';
	display: inline-flex;
	align-items: center;
	background: #dcfce7;
	color: #166534;
	border-radius: 4px;
	padding: 0 5px;
	font-size: 11px !important;
	font-weight: 700;
	font-family: Verdana, sans-serif;
	margin: 0 1px;
	vertical-align: baseline;
	line-height: 1.6;
	cursor: pointer;
}

.ck-fn-token::after {
	content: counter(ck-fn);
	color: #166534;
	font-size: 10px !important;
	font-weight: 700;
	vertical-align: super;
	margin-left: 1px;
	cursor: pointer;
}

.ck-fn-token:hover::before {
	background: #bbf7d0;
}

/* ── Footnotes block editor preview ─────────────────────── */

.citekit-footnotes-block {
	border: 1px dashed #d1d5db;
	border-radius: 8px;
	padding: 16px 20px;
	background: #f9fafb;
}

.ck-footnotes-editor-preview {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #374151;
}

.ck-footnotes-editor-icon {
	display: flex;
	align-items: center;
	color: #166534;
	flex-shrink: 0;
}

.ck-footnotes-editor-label {
	font-size: 14px;
	font-weight: 600;
	color: #111827;
	flex: 1;
}

.ck-footnotes-editor-note {
	font-size: 12px;
	color: #6b7280;
	background: #e5e7eb;
	padding: 2px 8px;
	border-radius: 4px;
}
