/*
 * Marker – Highlight & Share v1.1.0
 * Frontend CSS — fully namespaced under #mkr-toolbar / .mkr-*
 * Theme colours injected via CSS variables from PHP (wp_add_inline_style)
 * No external fonts. No resets. Zero interference with theme styles.
 */

/* ─── CSS variable defaults (overridden inline by PHP) ───────────────────── */
#mkr-toolbar {
	--mkr-bg:         #1c1c1e;
	--mkr-text:       #ffffff;
	--mkr-accent:     #FFEB3B;
	--mkr-accent-fg:  #1c1c1e;
	--mkr-hover:      rgba(255,255,255,0.10);
	--mkr-sep:        rgba(255,255,255,0.12);
	--mkr-muted:      rgba(255,255,255,0.38);
	--mkr-shadow:     0 4px 24px rgba(0,0,0,0.24), 0 1px 4px rgba(0,0,0,0.16);
	--mkr-del:        #fca5a5;
	--mkr-del-hover:  rgba(239,68,68,0.14);
}

/* ─── Highlighted mark ───────────────────────────────────────────────────────
 * display:inline  — prevents full-width block stretching on paragraphs.
 * All typography properties explicitly inherit — never overrides theme fonts.
 * box-decoration-break:clone — consistent background across line breaks.
 ─────────────────────────────────────────────────────────────────────────── */
mark.mkr-hl {
	display: inline !important;
	border-radius: 2px;
	padding: 0 1px;
	margin: 0;
	cursor: pointer;
	color: inherit !important;
	font-size: inherit !important;
	font-family: inherit !important;
	font-weight: inherit !important;
	font-style: inherit !important;
	line-height: inherit !important;
	letter-spacing: inherit !important;
	text-decoration: inherit !important;
	vertical-align: baseline !important;
	box-shadow: none !important;
	border: none !important;
	outline: none;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	transition: filter 0.1s ease;
}

mark.mkr-hl:hover { filter: brightness(0.86); }

/* ─── Toolbar wrapper ────────────────────────────────────────────────────── */
#mkr-toolbar {
	position: fixed;
	z-index: 2147483646;
	top: 0;
	left: 0;
	display: none;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	pointer-events: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 13px;
	line-height: 1;
}

#mkr-toolbar.mkr-visible {
	display: flex;
	pointer-events: all;
	animation: mkr-pop 0.17s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes mkr-pop {
	from { opacity: 0; transform: scale(0.86) translateY(4px); }
	to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

/* ─── Pill ───────────────────────────────────────────────────────────────── */
.mkr-pill {
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 5px 7px;
	background: var(--mkr-bg);
	border-radius: 10px;
	box-shadow: var(--mkr-shadow);
	user-select: none;
	white-space: nowrap;
}

/* ─── Swatches ───────────────────────────────────────────────────────────── */
.mkr-swatches {
	display: flex;
	align-items: center;
	gap: 4px;
	padding-right: 5px;
}

.mkr-swatch {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid transparent;
	cursor: pointer;
	padding: 0;
	margin: 0;
	outline: none;
	flex-shrink: 0;
	transition: transform 0.13s ease, border-color 0.1s;
	background-clip: padding-box;
	line-height: 1;
}

.mkr-swatch:hover        { transform: scale(1.22); }
.mkr-swatch.mkr-on       { border-color: var(--mkr-text); transform: scale(1.15); }

/* ─── Separator ──────────────────────────────────────────────────────────── */
.mkr-sep {
	width: 1px;
	height: 18px;
	background: var(--mkr-sep);
	margin: 0 3px;
	flex-shrink: 0;
}

/* ─── Toolbar buttons ────────────────────────────────────────────────────── */
.mkr-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 5px 9px;
	border-radius: 7px;
	border: none;
	background: transparent;
	color: var(--mkr-text);
	font-family: inherit;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.1s, color 0.1s;
	white-space: nowrap;
	line-height: 1;
	box-shadow: none;
	outline: none;
	text-decoration: none;
	margin: 0;
	opacity: 0.88;
}

.mkr-btn:hover        { background: var(--mkr-hover); opacity: 1; }
.mkr-btn:focus-visible { outline: 2px solid var(--mkr-sep); outline-offset: 1px; }

/* Highlight primary button */
.mkr-hl-btn {
	background: var(--mkr-accent);
	color: var(--mkr-accent-fg);
	font-weight: 700;
	padding: 5px 11px;
	opacity: 1;
}

.mkr-hl-btn:hover { background: var(--mkr-accent); filter: brightness(1.08); opacity: 1; }

/* Delete button */
.mkr-del-btn           { color: var(--mkr-del); opacity: 1; }
.mkr-del-btn:hover     { background: var(--mkr-del-hover); }

/* ─── Sub-panel (share) ──────────────────────────────────────────────────── */
.mkr-panel {
	background: var(--mkr-bg);
	border-radius: 10px;
	box-shadow: var(--mkr-shadow);
	padding: 11px 12px;
	width: 280px;
	animation: mkr-pop 0.17s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.mkr-panel-title {
	margin: 0 0 9px;
	font-size: 10px;
	font-weight: 700;
	color: var(--mkr-muted);
	text-transform: uppercase;
	letter-spacing: 0.09em;
}

/* Share grid */
.mkr-share-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.mkr-share-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: 7px;
	border: none;
	color: #fff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.1s, transform 0.1s;
	white-space: nowrap;
	line-height: 1;
	outline: none;
	text-decoration: none;
}

.mkr-share-btn:hover  { opacity: 0.84; }
.mkr-share-btn:active { transform: scale(0.96); }
.mkr-share-btn:focus-visible { outline: 2px solid rgba(255,255,255,0.5); outline-offset: 1px; }

/* ─── Context menu ───────────────────────────────────────────────────────── */
.mkr-ctx {
	animation: mkr-pop 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.mkr-toast {
	position: fixed;
	bottom: 22px;
	left: 50%;
	transform: translateX(-50%) translateY(12px);
	background: #1c1c1e;
	color: rgba(255,255,255,0.9);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 13px;
	font-weight: 500;
	padding: 8px 18px;
	border-radius: 100px;
	box-shadow: 0 4px 20px rgba(0,0,0,0.22);
	z-index: 2147483647;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.16s, transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
	white-space: nowrap;
}

.mkr-toast.mkr-show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
	.mkr-btn span       { display: none; }
	.mkr-btn            { padding: 5px 7px; }
	.mkr-share-btn span { display: none; }
	.mkr-share-btn      { padding: 7px 8px; }
	.mkr-panel          { width: calc(100vw - 24px); }
}

/* ─── Image button ───────────────────────────────────────────────────────── */
.mkr-img-btn {
	background: var(--mkr-accent) !important;
	color: var(--mkr-accent-fg) !important;
	font-weight: 700 !important;
	padding: 5px 11px !important;
	opacity: 1 !important;
}
.mkr-img-btn:hover { filter: brightness(1.08); }

/* ─── Modal overlay ──────────────────────────────────────────────────────── */
.mkr-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.72);
	z-index: 2147483645;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	animation: mkr-fade 0.18s ease both;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

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

.mkr-modal-box {
	background: #1c1c1e;
	border-radius: 16px;
	width: 100%;
	max-width: 720px;
	max-height: 92vh;
	overflow-y: auto;
	box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3);
	animation: mkr-slide-up 0.2s cubic-bezier(0.34,1.2,0.64,1) both;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

.mkr-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px 14px;
	border-bottom: 1px solid rgba(255,255,255,0.08);
}

.mkr-modal-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: rgba(255,255,255,0.92);
}

.mkr-modal-close {
	width: 28px; height: 28px;
	border-radius: 50%;
	border: none;
	background: rgba(255,255,255,0.08);
	color: rgba(255,255,255,0.6);
	font-size: 18px;
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	transition: background 0.1s, color 0.1s;
	padding: 0; line-height: 1;
}
.mkr-modal-close:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* ─── Style tab switcher ─────────────────────────────────────────────────── */
.mkr-img-switcher {
	display: flex;
	gap: 6px;
	padding: 14px 20px 0;
	flex-wrap: wrap;
}

.mkr-style-tab {
	padding: 6px 14px;
	border-radius: 100px;
	border: 1.5px solid rgba(255,255,255,0.12);
	background: transparent;
	color: rgba(255,255,255,0.5);
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.14s;
	white-space: nowrap;
}
.mkr-style-tab:hover    { border-color: rgba(255,255,255,0.3); color: rgba(255,255,255,0.8); }
.mkr-style-tab.mkr-tab-on { background: #FFEB3B; border-color: #FFEB3B; color: #1c1c1e; }

/* ─── Canvas preview ─────────────────────────────────────────────────────── */
.mkr-canvas-wrap {
	padding: 16px 20px;
	display: flex;
	justify-content: center;
}

.mkr-canvas {
	width: 100%;
	max-width: 680px;
	height: auto;
	border-radius: 10px;
	display: block;
	box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ─── Modal actions ──────────────────────────────────────────────────────── */
.mkr-modal-actions {
	display: flex;
	gap: 10px;
	padding: 0 20px 20px;
	justify-content: flex-end;
	flex-wrap: wrap;
}

.mkr-modal-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 20px;
	border-radius: 9px;
	border: none;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 700;
	cursor: pointer;
	transition: opacity 0.12s, transform 0.1s;
	white-space: nowrap;
}
.mkr-modal-btn:active { transform: scale(0.97); }

.mkr-modal-btn-primary   { background: #FFEB3B; color: #1c1c1e; }
.mkr-modal-btn-primary:hover { opacity: 0.88; }

.mkr-modal-btn-secondary { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.88); }
.mkr-modal-btn-secondary:hover { background: rgba(255,255,255,0.15); }
