/**
 * Public Styles - Spark SEO Reports
 *
 * BEM Naming Convention: .block__element--modifier
 * Mobile-first responsive design
 *
 * @package SparkSEO
 */

/* ==========================================================================
   Error Messages
   ========================================================================== */

.spark-seo-error {
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	padding: 12px 16px;
	margin: 16px 0;
	color: #856404;
	font-size: 14px;
}

/* ==========================================================================
   KPIs Grid
   ========================================================================== */

.spark-seo-kpis {
	margin: 24px 0;
}

.spark-seo-kpis__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

@media (min-width: 640px) {
	.spark-seo-kpis__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.spark-seo-kpis__grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 24px;
	}
}

.spark-seo-kpis__card {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 20px;
	display: flex;
	align-items: flex-start;
	gap: 16px;
	transition: all 0.2s ease;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.spark-seo-kpis__card:hover {
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	border-color: #d1d5db;
}

.spark-seo-kpis__icon {
	font-size: 32px;
	line-height: 1;
	flex-shrink: 0;
}

.spark-seo-kpis__content {
	flex: 1;
	min-width: 0;
}

.spark-seo-kpis__label {
	font-size: 14px;
	font-weight: 500;
	color: #6b7280;
	margin-bottom: 8px;
	line-height: 1.4;
}

.spark-seo-kpis__value {
	font-size: 28px;
	font-weight: 700;
	color: #111827;
	line-height: 1.2;
	margin-bottom: 8px;
}

@media (min-width: 640px) {
	.spark-seo-kpis__value {
		font-size: 32px;
	}
}

.spark-seo-kpis__change {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	font-weight: 500;
}

.spark-seo-kpis__change--positive {
	color: #059669;
}

.spark-seo-kpis__change--negative {
	color: #dc2626;
}

.spark-seo-kpis__change-icon {
	font-weight: 700;
}

.spark-seo-kpis__change-label {
	color: #6b7280;
	margin-left: 4px;
}

/* ==========================================================================
   Completed Section
   ========================================================================== */

.spark-seo-completed {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 24px;
	margin: 24px 0;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.spark-seo-completed--empty {
	text-align: center;
	color: #6b7280;
	font-size: 14px;
}

.spark-seo-completed__header {
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 2px solid #e5e7eb;
}

.spark-seo-completed__title {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	color: #111827;
}

.spark-seo-completed__content {
	font-size: 15px;
	line-height: 1.7;
	color: #374151;
}

.spark-seo-completed__content ul,
.spark-seo-completed__content ol {
	padding-left: 24px;
	margin: 16px 0;
}

.spark-seo-completed__content li {
	margin: 8px 0;
	line-height: 1.6;
}

.spark-seo-completed__content ul li::marker {
	color: #059669;
}

.spark-seo-completed__content p {
	margin: 12px 0;
}

.spark-seo-completed__content h3,
.spark-seo-completed__content h4 {
	margin-top: 20px;
	margin-bottom: 12px;
	color: #111827;
}

/* ==========================================================================
   Planned Section
   ========================================================================== */

.spark-seo-planned {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 24px;
	margin: 24px 0;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.spark-seo-planned--empty {
	text-align: center;
	color: #6b7280;
	font-size: 14px;
}

.spark-seo-planned__header {
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 2px solid #e5e7eb;
}

.spark-seo-planned__title {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	color: #111827;
}

.spark-seo-planned__content {
	font-size: 15px;
	line-height: 1.7;
	color: #374151;
}

.spark-seo-planned__content ul,
.spark-seo-planned__content ol {
	padding-left: 24px;
	margin: 16px 0;
}

.spark-seo-planned__content li {
	margin: 8px 0;
	line-height: 1.6;
}

.spark-seo-planned__content ul li::marker {
	color: #2563eb;
}

.spark-seo-planned__content p {
	margin: 12px 0;
}

.spark-seo-planned__content h3,
.spark-seo-planned__content h4 {
	margin-top: 20px;
	margin-bottom: 12px;
	color: #111827;
}

/* ==========================================================================
   Keywords Table
   ========================================================================== */

.spark-seo-keywords {
	margin: 24px 0;
}

/* Search & Controls */
.spark-seo-keywords__controls {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	gap: 16px;
}

.spark-seo-keywords__search-form {
	flex: 1 1 auto;
	min-width: 250px;
}

.spark-seo-keywords__search-wrapper {
	display: flex;
	gap: 8px;
	align-items: center;
}

.spark-seo-keywords__search-input {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.5;
}

.spark-seo-keywords__search-input:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.spark-seo-keywords__search-button {
	padding: 8px 16px;
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
}

.spark-seo-keywords__search-button:hover {
	background: #135e96;
}

.spark-seo-keywords__search-clear {
	padding: 8px 16px;
	background: #fff;
	color: #dc2626;
	border: 1px solid #dc2626;
	border-radius: 4px;
	font-size: 14px;
	text-decoration: none;
	transition: all 0.2s;
}

.spark-seo-keywords__search-clear:hover {
	background: #dc2626;
	color: #fff;
}

.spark-seo-keywords__info {
	color: #6b7280;
	font-size: 14px;
	font-weight: 500;
}

.spark-seo-keywords__wrapper {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.spark-seo-keywords__table-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.spark-seo-keywords__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.spark-seo-keywords__thead {
	background: #f9fafb;
	border-bottom: 2px solid #e5e7eb;
}

.spark-seo-keywords__row--header .spark-seo-keywords__cell {
	padding: 12px 16px;
	text-align: left;
	font-weight: 600;
	color: #374151;
	text-transform: uppercase;
	font-size: 12px;
	letter-spacing: 0.05em;
	white-space: nowrap;
}

/* Sortable column headers */
.spark-seo-keywords__cell--sortable a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 4px;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: color 0.2s;
}

.spark-seo-keywords__cell--sortable a:hover {
	color: #2271b1;
}

.spark-seo-keywords__sort-indicator {
	opacity: 0.3;
	font-size: 12px;
	transition: opacity 0.2s;
}

.spark-seo-keywords__cell--sortable a:hover .spark-seo-keywords__sort-indicator {
	opacity: 0.6;
}

.spark-seo-keywords__sort-indicator--active {
	opacity: 1;
	color: #2271b1;
	font-weight: 700;
}

.spark-seo-keywords__row {
	border-bottom: 1px solid #f3f4f6;
	transition: background-color 0.15s ease;
}

.spark-seo-keywords__row:hover {
	background-color: #f9fafb;
}

.spark-seo-keywords__row:last-child {
	border-bottom: none;
}

.spark-seo-keywords__cell {
	padding: 12px 16px;
	color: #111827;
	vertical-align: middle;
}

.spark-seo-keywords__cell--keyword {
	font-weight: 500;
	min-width: 200px;
}

.spark-seo-keywords__cell--position,
.spark-seo-keywords__cell--delta {
	text-align: center;
	min-width: 80px;
}

.spark-seo-keywords__cell--volume,
.spark-seo-keywords__cell--traffic {
	text-align: right;
	min-width: 100px;
}

.spark-seo-keywords__position {
	display: inline-block;
	background: #dbeafe;
	color: #1e40af;
	font-weight: 600;
	padding: 4px 12px;
	border-radius: 12px;
	font-size: 13px;
}

.spark-seo-keywords__empty {
	color: #9ca3af;
	font-style: italic;
}

/* Position Delta Indicators */
.spark-seo-keywords__delta {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 12px;
	font-weight: 600;
	font-size: 13px;
}

.spark-seo-keywords__delta--positive {
	background: #d1fae5;
	color: #059669;
}

.spark-seo-keywords__delta--negative {
	background: #fee2e2;
	color: #dc2626;
}

.spark-seo-keywords__row--empty .spark-seo-keywords__cell {
	text-align: center;
	padding: 40px 16px;
	color: #6b7280;
	font-style: italic;
}

/* Footer: Pagination & Per Page */
.spark-seo-keywords__footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
	padding: 16px;
	border-top: 1px solid #e5e7eb;
}

.spark-seo-keywords__per-page {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #6b7280;
}

.spark-seo-keywords__per-page-select {
	padding: 6px 10px;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	font-size: 14px;
	background: #fff;
	cursor: pointer;
}

.spark-seo-keywords__per-page-select:focus {
	outline: none;
	border-color: #2271b1;
}

.spark-seo-keywords__pagination {
	display: flex;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
}

.spark-seo-keywords__page-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	background: #ffffff;
	color: #374151;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.15s ease;
}

.spark-seo-keywords__page-link:hover {
	background: #f9fafb;
	border-color: #d1d5db;
}

.spark-seo-keywords__page-link--active {
	background: #2563eb;
	border-color: #2563eb;
	color: #ffffff;
	pointer-events: none;
}

.spark-seo-keywords__page-link--prev,
.spark-seo-keywords__page-link--next {
	font-weight: 600;
}

.spark-seo-keywords__page-ellipsis {
	padding: 0 4px;
	color: #9ca3af;
	font-weight: 600;
}

/* Mobile adjustments */
@media (max-width: 639px) {
	.spark-seo-keywords__controls {
		flex-direction: column;
		align-items: stretch;
	}

	.spark-seo-keywords__search-form {
		width: 100%;
		min-width: 100%;
	}

	.spark-seo-keywords__search-wrapper {
		flex-direction: column;
	}

	.spark-seo-keywords__search-input,
	.spark-seo-keywords__search-button,
	.spark-seo-keywords__search-clear {
		width: 100%;
	}

	.spark-seo-keywords__info {
		text-align: center;
		font-size: 13px;
	}

	.spark-seo-keywords__cell {
		padding: 10px 12px;
		font-size: 13px;
	}

	.spark-seo-keywords__cell--keyword {
		min-width: 150px;
	}

	.spark-seo-keywords__cell--position,
	.spark-seo-keywords__cell--delta {
		min-width: 60px;
	}

	.spark-seo-keywords__cell--volume,
	.spark-seo-keywords__cell--traffic {
		min-width: 80px;
	}

	.spark-seo-keywords__footer {
		flex-direction: column;
		gap: 12px;
	}

	.spark-seo-keywords__per-page,
	.spark-seo-keywords__pagination {
		width: 100%;
		justify-content: center;
	}

	.spark-seo-keywords__page-link {
		min-width: 36px;
		height: 36px;
		font-size: 13px;
	}
}

/* ==========================================================================
   Databox Embed
   ========================================================================== */

.spark-seo-databox {
	margin: 24px 0;
}

.spark-seo-databox__wrapper {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.spark-seo-databox__embed {
	position: relative;
	padding-bottom: 56.25%; /* 16:9 aspect ratio */
	height: 0;
	overflow: hidden;
}

.spark-seo-databox__iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
}

/* ==========================================================================
   Elementor Compatibility
   ========================================================================== */

/* Ensure proper spacing in Elementor widgets */
.elementor-widget-shortcode .spark-seo-kpis,
.elementor-widget-shortcode .spark-seo-completed,
.elementor-widget-shortcode .spark-seo-planned,
.elementor-widget-shortcode .spark-seo-keywords,
.elementor-widget-shortcode .spark-seo-databox {
	margin-top: 0;
	margin-bottom: 0;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus styles for keyboard navigation */
.spark-seo-keywords__page-link:focus {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	.spark-seo-kpis__card,
	.spark-seo-completed,
	.spark-seo-planned,
	.spark-seo-keywords__wrapper {
		box-shadow: none;
		border: 1px solid #000;
	}

	.spark-seo-keywords__pagination {
		display: none;
	}

	.spark-seo-databox {
		display: none;
	}
}