.ldspq-dashboard {
	margin: 1.5rem 0;
}

.ldspq-dashboard h2 {
	/* Use Elementor global typography if available, otherwise fall back */
	font-size: var(--e-global-typography-primary-font-size, 1.5rem);
	line-height: var(--e-global-typography-primary-line-height, 1.3);
	margin: 0 0 1rem;
}

.ldspq-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 1rem;
}

.ldspq-tab {
	border: 1px solid #ccd0d4;
	background: #f6f7f7;
	padding: 6px 12px;
	cursor: pointer;
	border-radius: 3px;
	font-size: 13px;
}

.ldspq-tab.ldspq-tab-active {
	background: #ffffff;
	border-bottom-color: #ffffff;
	font-weight: 600;
}

.ldspq-tab-panel {
	display: none;
}

.ldspq-tab-panel.ldspq-tab-panel-active {
	display: block;
}

/* Space sections a bit so they feel like Elementor sections */
.ldspq-dashboard-section,
.ldspq-tab-panel {
	padding: 1rem 0;
	border-top: 1px solid rgba(0, 0, 0, 0.04);
}

/* Builder empty state: no curated categories for this student */
.ldspq-builder-empty {
	border-left: 4px solid #dba617;
	background: #fcf9e8;
	padding: 12px 16px;
	border-radius: 3px;
}

.ldspq-builder-empty p {
	margin: 0;
}

/* Buttons: rely on WP/Elementor .button styling, just tweak size */
.ldspq-dashboard .button.button-small {
	padding: 3px 10px;
	font-size: 12px;
}

/* Table wraps nicely on smaller screens */
.ldspq-my-quizzes {
	overflow-x: auto;
}

.ldspq-my-quizzes table {
	width: 100%;
}

/* Analytics layout tweaks */
.ldspq-analytics-overview {
	margin-bottom: 1.5rem;
}

.ldspq-analytics-kpis {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.ldspq-analytics-kpis li {
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 4px;
	padding: 8px 12px;
	font-size: 13px;
}

.ldspq-analytics-filters {
	margin-bottom: 0.75rem;
	display: flex;
	align-items: center;
	gap: 8px;
}

.ldspq-analytics-filters select {
	max-width: 160px;
}

.ldspq-analytics-recent,
.ldspq-analytics-categories {
	margin-top: 1rem;
}

/* Simple Elementor-style spinner next to the submit button */
.ldspq-spinner {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: var(--e-global-color-primary, #2271b1);
	box-sizing: border-box;
}

.ldspq-spinner.is-active {
	animation: ldspq-spin 0.7s linear infinite;
}

/* Time limit builder inputs */
.ldspq-time-inputs {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.ldspq-time-inputs .ldspq-time-sep {
	opacity: 0.7;
}

.ldspq-time-inputs input.ldspq-time-h,
.ldspq-time-inputs input.ldspq-time-m,
.ldspq-time-inputs input.ldspq-time-s {
	max-width: 90px;
}

.ldspq-time-presets {
	margin-top: 6px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ldspq-time-unlimited {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 6px;
	font-size: 13px;
}

.ldspq-time-presets .button {
	padding: 3px 10px;
	font-size: 12px;
}

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

#ldspq-builder .ldspq-terms-select {
	min-width: 260px;
}

/* ---------------------------------------------------------------------------
 * Layout polish (1.1.0). The builder borrows Elementor form class names, but
 * Elementor's form CSS isn't loaded on this page, so the spacing lives here.
 * ------------------------------------------------------------------------ */

.ldspq-tabs {
	gap: 10px;
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ldspq-dashboard .ldspq-tab-panel {
	padding-top: 0;
	border-top: 0;
}

/* Builder: two-column grid, one column on phones */
#ldspq-builder .elementor-form-fields-wrapper {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px 28px;
	margin: 0;
}

#ldspq-builder .ldspq-field {
	display: block;
	width: auto;
	max-width: none;
	margin: 0;
	padding: 0;
	min-width: 0;
}

#ldspq-builder .ldspq-field.elementor-col-100 {
	grid-column: 1 / -1;
}

#ldspq-builder .elementor-field-label {
	display: block;
	margin: 0 0 8px;
	font-weight: 600;
}

#ldspq-builder .ldspq-field > input.elementor-field,
#ldspq-builder .ldspq-field > select.elementor-field {
	width: 100%;
	max-width: none;
	box-sizing: border-box;
}

#ldspq-builder .description {
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.5;
	opacity: 0.8;
}

#ldspq-builder .ldspq-time-inputs {
	gap: 8px;
	flex-wrap: nowrap;
}

#ldspq-builder .ldspq-time-inputs input {
	flex: 1 1 0;
	min-width: 0;
	max-width: none;
}

#ldspq-builder .ldspq-time-presets {
	margin-top: 10px;
	gap: 8px;
}

#ldspq-builder .ldspq-time-unlimited {
	display: flex;
	margin: 10px 0 0;
	font-weight: 400;
}

#ldspq-builder .ldspq-terms-select {
	min-width: 0;
	padding-top: 8px;
	padding-bottom: 8px;
}

#ldspq-builder .ldspq-terms-select option {
	padding: 4px 0;
}

/* Checkbox rows: label text beside the box, not bold-on-bold */
#ldspq-builder .ldspq-field > .elementor-field-label:has(input[type="checkbox"]) {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	cursor: pointer;
}

#ldspq-builder .e-form__buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding-top: 4px;
}

#ldspq-builder .e-form__buttons .ldspq-spinner,
#ldspq-builder .e-form__buttons .ldspq-success-message {
	margin-left: 0 !important;
}

.ldspq-builder-empty {
	padding: 16px 20px;
}

/* My Quizzes search row */
.ldspq-my-quizzes-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 8px;
	margin: 0 0 1.25rem;
}

.ldspq-my-quizzes-filters label {
	flex: 0 1 320px;
	margin: 0;
}

.ldspq-my-quizzes-filters input[type="search"] {
	width: 100%;
	box-sizing: border-box;
}

.ldspq-my-quizzes-filters .button.button-small {
	padding: 0 18px;
	font-size: 14px;
}

/* Action buttons. The theme styles <button> but not <a class="button">, so the
   link actions looked like plain text. Primary = take/retake, Delete = outline. */
.ldspq-dashboard {
	--ldspq-btn: #13afe0;
	--ldspq-btn-text: #353c3d;
}

.ldspq-dashboard a.button.button-small {
	display: inline-block;
	background-color: var(--ldspq-btn);
	color: var(--ldspq-btn-text);
	border-radius: 2px;
	padding: 6px 12px;
	font-family: inherit;
	line-height: 18px;
	text-decoration: none;
}

.ldspq-dashboard a.button.button-small:hover,
.ldspq-dashboard a.button.button-small:focus {
	filter: brightness(0.92);
}

.ldspq-dashboard .button.ldspq-delete-quiz {
	background: transparent;
	color: inherit;
	border: 1px solid currentColor;
	padding: 5px 12px;
	opacity: 0.75;
}

.ldspq-dashboard .button.ldspq-delete-quiz:hover,
.ldspq-dashboard .button.ldspq-delete-quiz:focus {
	color: #b32d2e;
	opacity: 1;
}

.ldspq-analytics-filters .button.button-small {
	align-self: stretch;
	padding: 0 18px;
	font-size: 14px;
}

/* Tables */
.ldspq-stack-table td.ldspq-cell-actions {
	white-space: nowrap;
}

.ldspq-stack-table td.ldspq-cell-actions .button + .button {
	margin-left: 6px;
}

.ldspq-pagination {
	margin-top: 1rem;
}

/* Analytics */
.ldspq-analytics-overview {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.ldspq-analytics-filters {
	margin: 0;
}

.ldspq-analytics-filters label {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
}

.ldspq-analytics-kpis li {
	padding: 12px 16px;
	font-size: 14px;
}

.ldspq-dashboard h3 {
	margin: 1.75rem 0 0.75rem;
}

@media (max-width: 640px) {
	#ldspq-builder .elementor-form-fields-wrapper {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
	}

	.ldspq-tab {
		flex: 1 1 auto;
		text-align: center;
	}

	.ldspq-my-quizzes-filters label {
		flex: 1 1 auto;
	}

	/* Tables become one card per row */
	.ldspq-stack-table thead {
		display: none;
	}

	.ldspq-stack-table,
	.ldspq-stack-table tbody,
	.ldspq-stack-table tr,
	.ldspq-stack-table td {
		display: block;
		width: 100%;
		box-sizing: border-box;
	}

	.ldspq-stack-table tr {
		margin-bottom: 12px;
		border: 1px solid rgba(0, 0, 0, 0.1);
		border-radius: 4px;
	}

	.ldspq-stack-table td {
		display: flex;
		justify-content: space-between;
		gap: 12px;
		border: 0;
		border-bottom: 1px solid rgba(0, 0, 0, 0.05);
		padding: 8px 12px;
		text-align: right;
	}

	.ldspq-stack-table td::before {
		content: attr(data-label);
		font-weight: 600;
		text-align: left;
	}

	.ldspq-stack-table td.ldspq-cell-actions {
		justify-content: flex-start;
		border-bottom: 0;
		white-space: normal;
	}

	.ldspq-stack-table td.ldspq-cell-actions::before {
		content: none;
	}
}
