/* =====================================================================
   Quiz Maker Pro – Custom Sidebar & Navigator Styling
   Companion stylesheet. Does not modify any core plugin CSS file.
   ===================================================================== */

:root {
	--qmp-primary-grad: linear-gradient(135deg, #7c3aed 0%, #ec4899 55%, #f97316 100%);
	--qmp-primary-solid: #7c3aed;
	--qmp-success-grad: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
	--qmp-current-grad: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
	--qmp-info-grad: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
	--qmp-pending-bg: #faf5ff;
	--qmp-pending-border: #ede9fe;
	--qmp-sidebar-radius: 18px;
}

/* -----------------------------------------------------------
   Layout: quiz container + sidebar side-by-side
   ----------------------------------------------------------- */
.ays-quiz-wrap.qmp-has-sidebar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 280px;
	gap: 24px;
	align-items: start;
}

.ays-quiz-wrap.qmp-has-sidebar > .ays-quiz-container {
	min-width: 0;
}

.qmp-quiz-sidebar {
	grid-column: 2;
	position: sticky;
	top: 20px;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

@media (max-width: 900px) {
	.ays-quiz-wrap.qmp-has-sidebar {
		grid-template-columns: 1fr;
	}
	.qmp-quiz-sidebar {
		grid-column: 1;
		position: static;
		order: -1;
	}
}

.qmp-quiz-sidebar > div {
	border-radius: var(--qmp-sidebar-radius);
	box-shadow: 0 10px 30px rgba(124, 58, 237, 0.14);
	overflow: hidden;
}

/* Only the plain (non-badge) cards get a white background — the badge keeps its
   own gradient background set below. Using :not() here avoids a specificity
   fight between this generic rule and ".qmp-user-badge" that previously made
   the gradient (and the name text) invisible. */
.qmp-quiz-sidebar > div:not(.qmp-user-badge) {
	background: #ffffff;
}

/* -----------------------------------------------------------
   User badge (logged-in name / guest name from the pre-quiz form)
   ----------------------------------------------------------- */
.qmp-user-badge {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	background: var(--qmp-primary-grad) !important;
	color: #ffffff !important;
}

.qmp-avatar {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 17px;
	background: rgba(255, 255, 255, 0.25);
	border: 2px solid rgba(255, 255, 255, 0.65);
	flex-shrink: 0;
	overflow: hidden;
}

.qmp-avatar img,
.qmp-avatar.qmp-avatar-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

.qmp-avatar.qmp-guest {
	background: rgba(255, 255, 255, 0.18);
}

.qmp-user-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.qmp-user-name {
	font-weight: 700;
	font-size: 15px;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 175px;
}

.qmp-user-tag {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.9;
	margin-top: 2px;
}

/* -----------------------------------------------------------
   Navigator card
   ----------------------------------------------------------- */
.qmp-nav-card {
	padding: 16px 14px 18px;
}

.qmp-nav-title {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: #6d28d9;
	margin-bottom: 12px;
	text-align: center;
}

/* Fit the plugin's own navigator markup inside our card */
.qmp-nav-card .ays-quiz-questions-nav-wrap {
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	margin: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	border: none !important;
	border-radius: 0 !important;
}

.qmp-nav-card .ays-quiz-questions-nav-go-left,
.qmp-nav-card .ays-quiz-questions-nav-go-right {
	display: none !important;
}

.qmp-nav-card .ays-quiz-questions-nav-content {
	display: flex !important;
	flex-wrap: wrap !important;
	justify-content: center !important;
	gap: 8px !important;
	padding: 4px 2px !important;
	/* Keep the card a sane, consistent height regardless of question count —
	   long quizzes scroll inside the card instead of pushing it very tall. */
	max-height: 320px !important;
	overflow-y: auto !important;
}

/* Slim, on-theme scrollbar for the navigator when it scrolls (WebKit browsers) */
.qmp-nav-card .ays-quiz-questions-nav-content::-webkit-scrollbar {
	width: 6px;
}
.qmp-nav-card .ays-quiz-questions-nav-content::-webkit-scrollbar-thumb {
	background: var(--qmp-pending-border);
	border-radius: 6px;
}
.qmp-nav-card .ays-quiz-questions-nav-content::-webkit-scrollbar-thumb:hover {
	background: #d8b4fe;
}

.qmp-nav-card .ays-quiz-questions-nav-item {
	flex: 0 0 auto !important;
	flex-basis: auto !important;
	margin: 0 !important;
}

.qmp-nav-card a.ays_questions_nav_question {
	width: 32px !important;
	height: 32px !important;
	min-width: 32px !important;
	border-radius: 9px !important;
	border: 2px solid var(--qmp-pending-border) !important;
	background: var(--qmp-pending-bg) !important;
	color: var(--qmp-primary-solid) !important;
	font-weight: 700 !important;
	font-size: 12px !important;
	line-height: 1 !important;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease !important;
}

.qmp-nav-card a.ays_questions_nav_question:hover {
	transform: translateY(-3px) scale(1.06) !important;
	box-shadow: 0 8px 16px rgba(124, 58, 237, 0.35) !important;
	border-color: #a855f7 !important;
}

/* Answered question (plugin's own class, restyled) */
.qmp-nav-card .ays-quiz-questions-nav-item.ays-quiz-questions-nav-item-answered a.ays_questions_nav_question {
	background: var(--qmp-success-grad) !important;
	border-color: transparent !important;
	color: #ffffff !important;
}

/* Current question (class added by our script) */
.qmp-nav-card .ays-quiz-questions-nav-item.qmp-current a.ays_questions_nav_question {
	background: var(--qmp-current-grad) !important;
	border-color: transparent !important;
	color: #ffffff !important;
	box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25), 0 8px 16px rgba(239, 68, 68, 0.35) !important;
}

/* Flagged / error state from the plugin, kept visible on top of the theme */
.qmp-nav-card .ays_questions_nav_question.ays-has-error {
	outline: 2px solid #ef4444 !important;
	outline-offset: 2px;
}

/* "Info Question" banner item — its own color plus a gentle blink so it
   stands out from the numbered question bullets. Matched by its title
   attribute since Quiz Maker Pro doesn't give it a distinct class. */
.qmp-nav-card a.ays_questions_nav_question[title="Info Question"] {
	background: var(--qmp-info-grad) !important;
	border-color: transparent !important;
	color: #ffffff !important;
	animation: qmp-info-blink 1.6s ease-in-out infinite;
}

@keyframes qmp-info-blink {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55);
		transform: scale(1);
	}
	50% {
		box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
		transform: scale(1.08);
	}
}

/* Legend */
.qmp-nav-legend {
	display: flex;
	justify-content: space-between;
	gap: 6px;
	margin-top: 14px;
	font-size: 10.5px;
	color: #6b7280;
	flex-wrap: wrap;
}

.qmp-nav-legend span {
	display: flex;
	align-items: center;
	gap: 5px;
}

.qmp-nav-legend i {
	width: 10px;
	height: 10px;
	border-radius: 3px;
	display: inline-block;
}

.qmp-dot-answered { background: var(--qmp-success-grad); }
.qmp-dot-current { background: var(--qmp-current-grad); }
.qmp-dot-pending { background: var(--qmp-pending-bg); border: 1px solid var(--qmp-pending-border); }
