/* ============================================================
   WP Auto Load Next Post – Frontend Styles
   All class names prefixed with "wpal-" to avoid conflicts.
   ============================================================ */

/* ── Loader ─────────────────────────────────────────────────────────────── */

.wpal-loader {
	text-align: center;
	padding: 40px 20px;
	margin: 40px 0;
}

.wpal-spinner {
	width: 40px; height: 40px;
	margin: 0 auto 20px;
	border: 4px solid #f3f3f3;
	border-top-color: #667eea;
	border-radius: 50%;
	animation: wpal-spin 1s linear infinite;
}

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

.wpal-loader p { color: #666; font-size: 16px; margin: 0; }

/* ── Separator ──────────────────────────────────────────────────────────── */

.wpal-separator { margin: 60px 0; }
.wpal-separator hr { border: 0; height: 1px; background: #e0e0e0; margin: 0; }

/* ── Loaded post wrapper ────────────────────────────────────────────────── */

.wpal-loaded-post { opacity: 0; }

.wpal-fadein {
	animation: wpal-fadeInPost 0.6s ease-in forwards;
}

@keyframes wpal-fadeInPost {
	from { opacity: 0; transform: translateY(20px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ── Wheel button group ─────────────────────────────────────────────────── */

.wpal-btn-group {
	position: fixed;
	bottom: 30px;
	right: 30px;
	z-index: 99999;
	opacity: 0;
	transform: scale(.8);
	transition: opacity .3s, transform .3s cubic-bezier(.4,0,.2,1);
	pointer-events: none;
}

.wpal-btn-group.visible {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

/* ── Wheel SVG ───────────────────────────────────────────────────────────── */

.wpal-wheel-svg {
	width: 152px;
	height: 152px;
	display: block;
	filter: drop-shadow(0 4px 12px rgba(102,126,234,.4));
	transition: filter .2s;
}

.wpal-btn-group.visible:hover .wpal-wheel-svg {
	filter: drop-shadow(0 6px 18px rgba(102,126,234,.55));
}

.wpal-main-circle { fill: #667eea; }

.wpal-progress-arc {
	stroke: white;
	stroke-width: 4;
	stroke-linecap: round;
	stroke-dasharray: 0 264;
	transform-origin: 100px 100px;
	transform: rotate(-90deg);
	transition: stroke-dasharray .3s ease-out;
	opacity: .9;
}

.wpal-wheel-pct {
	fill: white;
	font-size: 17px;
	font-weight: 700;
	font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Arrows are drawn BEHIND the circle in the SVG markup so the circle's fill
   covers their base/edges — only the pointed tip is visible, making the
   arrow read as part of the circle rather than a separate attached shape. */
.wpal-arrow-tri {
	fill: #667eea;
	cursor: pointer;
	transition: opacity .15s ease;
}

.wpal-arrow-tri:hover { opacity: .75; }
.wpal-arrow-tri:active { opacity: .55; }

.wpal-center-zone { cursor: pointer; }

/* ── Reading widget ──────────────────────────────────────────────────────── */

.wpal-widget {
	position: fixed;
	bottom: 40px; right: 30px;
	width: 380px;
	max-width: calc(100vw - 80px);
	background: #667eea;
	border-radius: 20px;
	padding: 24px;
	box-shadow: 0 -4px 30px rgba(102,126,234,.3);
	z-index: 99998;
	transform: translateY(calc(100% + 40px));
	transition: transform .4s cubic-bezier(.4,0,.2,1);
}

.wpal-widget.open { transform: translateY(0); }

/* Close button — use !important to override aggressive theme button resets */
.wpal-widget-close {
	position: absolute !important; top: 16px !important; right: 16px !important;
	width: 32px !important; height: 32px !important; min-width: 0 !important;
	background: rgba(255,255,255,.2) !important;
	border: none !important; border-radius: 50% !important;
	display: flex !important; align-items: center !important; justify-content: center !important;
	cursor: pointer !important;
	color: #fff !important;
	padding: 0 !important; margin: 0 !important;
	box-shadow: none !important; outline: none;
	line-height: 1; overflow: visible;
	transition: background .2s, transform .2s;
	z-index: 1;
}

.wpal-widget-close:hover { background: rgba(255,255,255,.35) !important; transform: rotate(90deg); }

.wpal-widget-close svg {
	width: 16px !important; height: 16px !important;
	display: block; stroke: #fff !important; fill: none !important;
	flex-shrink: 0; pointer-events: none;
}

/* Header */
.wpal-widget-header {
	margin-bottom: 14px;
	padding-right: 36px;
}

.wpal-widget-icon { display: none; }

.wpal-widget-title {
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	margin: 0;
	line-height: 1.4;
	white-space: normal;
	overflow: visible;
	word-break: break-word;
}

/* TOC */
.wpal-toc-section { margin-bottom: 4px; }

.wpal-toc-list {
	list-style: none;
	margin: 0; padding: 0;
	max-height: 180px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: rgba(255,255,255,.3) transparent;
}

.wpal-toc-list::-webkit-scrollbar       { width: 3px; }
.wpal-toc-list::-webkit-scrollbar-track { background: transparent; }
.wpal-toc-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 3px; }

.wpal-toc-item { margin: 0; }

.wpal-toc-link,
.wpal-toc-link:visited,
.wpal-toc-link:focus,
.wpal-toc-link:active {
	display: flex; align-items: center; gap: 8px;
	padding: 5px 4px;
	color: rgba(255,255,255,.7);
	text-decoration: none;
	font-size: 13px; line-height: 1.35;
	border-radius: 4px;
	transition: color .15s, background .15s;
	outline: none;
}

.wpal-toc-link:hover,
.wpal-toc-link:visited:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }

.wpal-toc-marker {
	flex-shrink: 0;
	width: 5px; height: 5px;
	border-radius: 50%;
	background: rgba(255,255,255,.25);
	transition: all .2s ease;
}

.wpal-toc-item.wpal-toc-active > .wpal-toc-link,
.wpal-toc-item.wpal-toc-active > .wpal-toc-link:visited { color: #fff; font-weight: 600; }
.wpal-toc-item.wpal-toc-active > .wpal-toc-link .wpal-toc-marker {
	background: #fff;
	box-shadow: 0 0 6px rgba(255,255,255,.6);
	transform: scale(1.5);
}

.wpal-toc-level-1 > .wpal-toc-link,
.wpal-toc-level-1 > .wpal-toc-link:visited { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.88); }
.wpal-toc-level-2 > .wpal-toc-link,
.wpal-toc-level-2 > .wpal-toc-link:visited { font-size: 13px; }
.wpal-toc-level-3 > .wpal-toc-link,
.wpal-toc-level-3 > .wpal-toc-link:visited { font-size: 12px; color: rgba(255,255,255,.58); }

.wpal-toc-empty { color: rgba(255,255,255,.6); font-size: 13px; margin: 0; padding: 4px 0; }

/* Progress bar */
.wpal-progress-section {
	background: rgba(255,255,255,.15);
	border-radius: 12px;
	padding: 14px;
	margin-top: 14px;
	backdrop-filter: blur(10px);
}

.wpal-progress-header {
	display: flex; justify-content: space-between; align-items: center;
	margin-bottom: 10px;
}

.wpal-progress-label {
	color: rgba(255,255,255,.9);
	font-size: 11px; font-weight: 600;
	text-transform: uppercase; letter-spacing: .5px;
}

.wpal-progress-pct { color: #fff; font-size: 15px; font-weight: 700; }

.wpal-progress-track {
	height: 6px;
	background: rgba(255,255,255,.2);
	border-radius: 6px;
	overflow: hidden;
}

.wpal-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, #fff, #f0f0f0);
	width: 0%;
	transition: width .3s ease-out;
	border-radius: 6px;
	box-shadow: 0 0 10px rgba(255,255,255,.5);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
	.wpal-btn-group { bottom: 16px; right: 16px; }
	.wpal-wheel-svg { width: 120px; height: 120px; }
	.wpal-wheel-pct { font-size: 14px; }

	.wpal-widget {
		width: 100%; max-width: 100%;
		padding: 20px;
		border-radius: 16px 16px 0 0;
		bottom: 0; right: 0;
	}

	/* Hide the close (X) button on mobile — drag handle replaces it */
	.wpal-widget-close { display: none !important; }

	/* Drawer/drag handle indicator at the top of the sheet */
	.wpal-widget::before {
		content: '';
		display: block;
		width: 36px;
		height: 4px;
		background: rgba(255,255,255,.4);
		border-radius: 2px;
		margin: 0 auto 14px;
	}

	.wpal-toc-list { max-height: 140px; }
}