/**
 * Readability Analyzer - Annotations Section
 *
 * Highlighted text, issue markers, filter toggles, legend, and suggestion popover.
 *
 * @package AgenticWP
 */

/* ============================================
   Annotated Section Container
   ============================================ */

.readability-annotated-section {
	padding: 0 0 48px;
}

.readability-annotated-section[hidden] {
	display: none;
}

/* ============================================
   Annotated Card
   ============================================ */

.annotated-card {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 1.5rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.annotated-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
	flex-wrap: wrap;
}

.annotated-header .card-title {
	margin: 0;
}

.annotated-controls {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
}

/* ============================================
   Filter Toggles
   ============================================ */

.filter-toggles {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.filter-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.375rem 0.75rem;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--muted);
	background: var(--tool-bg-subtle);
	border: 1px solid transparent;
	border-radius: 20px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.filter-toggle:hover {
	border-color: var(--line);
}

.filter-toggle.active {
	color: var(--ink);
	background: #fff;
	border-color: var(--line);
}

.filter-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	opacity: 0.4;
	transition: opacity 0.2s ease;
}

.filter-toggle.active .filter-dot {
	opacity: 1;
}

/* Filter dot colors */
.filter-toggle--passive .filter-dot {
	background: var(--issue-passive);
}

.filter-toggle--long .filter-dot {
	background: var(--issue-long);
}

.filter-toggle--adverb .filter-dot {
	background: var(--issue-adverb);
}

.filter-toggle--complex .filter-dot {
	background: var(--issue-complex);
}

.filter-toggle--repetitive .filter-dot {
	background: var(--issue-repetitive);
}

/* Small button */
.btn-small {
	padding: 0.375rem 0.75rem;
	font-size: 0.75rem;
}

/* ============================================
   Issue Legend
   ============================================ */

.issue-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	padding: 0.75rem 1rem;
	margin-bottom: 1rem;
	background: var(--tool-bg-subtle);
	border-radius: 8px;
}

.legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.75rem;
	color: var(--muted);
}

.legend-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
}

.legend-passive .legend-dot {
	background: var(--issue-passive);
}

.legend-long .legend-dot {
	background: var(--issue-long);
}

.legend-adverb .legend-dot {
	background: var(--issue-adverb);
}

.legend-complex .legend-dot {
	background: var(--issue-complex);
}

.legend-repetitive .legend-dot {
	background: var(--issue-repetitive);
}

/* ============================================
   Issue Summary
   ============================================ */

.issue-summary {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	padding: 1rem;
	margin-bottom: 1rem;
	background: var(--tool-bg-subtle);
	border-radius: 8px;
}

.summary-item {
	display: flex;
	align-items: baseline;
	gap: 0.375rem;
}

.summary-count {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
}

.summary-label {
	font-size: 0.8125rem;
	color: var(--muted);
}

/* ============================================
   Annotated Text Container
   ============================================ */

.annotated-text-container {
	margin-bottom: 1rem;
}

.annotated-text {
	padding: 1.5rem;
	font-size: 1rem;
	line-height: 1.8;
	color: var(--ink);
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 12px;
	max-height: 500px;
	overflow-y: auto;
}

.annotated-text:focus {
	outline: 2px solid var(--readability-accent);
	outline-offset: 2px;
}

/* Highlight spans - base styles for issue highlights */
.issue-highlight {
	position: relative;
	padding: 2px 4px;
	margin: 0 -2px;
	border-radius: 3px;
	cursor: pointer;
	transition: background 0.15s ease;
}

.issue-highlight:hover {
	filter: brightness(0.95);
}

.issue-highlight:focus {
	outline: 2px solid var(--ink);
	outline-offset: 1px;
}

/* Issue type highlighting - matches JS-generated class names */
.issue-highlight.issue-passive {
	background: var(--issue-passive-bg);
	border-bottom: 2px solid var(--issue-passive);
}

.issue-highlight.issue-long {
	background: var(--issue-long-bg);
	border-bottom: 2px solid var(--issue-long);
}

.issue-highlight.issue-adverb {
	background: var(--issue-adverb-bg);
	border-bottom: 2px solid var(--issue-adverb);
}

.issue-highlight.issue-complex {
	background: var(--issue-complex-bg);
	border-bottom: 2px solid var(--issue-complex);
}

.issue-highlight.issue-repetitive {
	background: var(--issue-repetitive-bg);
	border-bottom: 2px solid var(--issue-repetitive);
}

/* Hidden state for filtered highlights */
.issue-highlight.hidden {
	background: transparent;
	border-bottom: none;
	padding: 0;
	margin: 0;
	cursor: text;
}

/* ============================================
   No Issues State
   ============================================ */

.no-issues-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 3rem;
	text-align: center;
}

.no-issues-state[hidden] {
	display: none;
}

.no-issues-icon {
	width: 64px;
	height: 64px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 1rem;
	color: var(--tool-success);
	background: var(--tool-success-bg);
	border-radius: 50%;
}

.no-issues-state h3 {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--ink);
	margin: 0 0 0.5rem;
}

.no-issues-state p {
	font-size: 0.9375rem;
	color: var(--muted);
	margin: 0;
	max-width: 400px;
}

/* ============================================
   Suggestion Popover
   ============================================ */

.suggestion-popover {
	position: absolute;
	z-index: var(--tool-z-overlay);
	width: 360px;
	max-width: calc(100vw - 2rem);
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 12px;
	box-shadow: var(--tool-shadow-lg);
	animation: slide-in-up 0.2s ease;
}

.suggestion-popover[hidden] {
	display: none;
}

.popover-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--line);
}

.popover-type {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 0.25rem 0.5rem;
	border-radius: 4px;
}

/* Popover type colors */
.popover-type.type-passive {
	color: var(--issue-passive);
	background: var(--issue-passive-bg);
}

.popover-type.type-long {
	color: var(--issue-long);
	background: var(--issue-long-bg);
}

.popover-type.type-adverb {
	color: var(--issue-adverb);
	background: var(--issue-adverb-bg);
}

.popover-type.type-complex {
	color: var(--issue-complex);
	background: var(--issue-complex-bg);
}

.popover-type.type-repetitive {
	color: var(--issue-repetitive);
	background: var(--issue-repetitive-bg);
}

.popover-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	background: transparent;
	border: none;
	color: var(--muted);
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.popover-close:hover {
	background: var(--tool-bg-subtle);
	color: var(--ink);
}

.popover-content {
	padding: 1rem;
}

.popover-original,
.popover-suggestion {
	margin-bottom: 1rem;
}

.popover-suggestion[hidden] {
	display: none;
}

.popover-label {
	display: block;
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted);
	margin-bottom: 0.375rem;
}

.popover-text {
	font-size: 0.9375rem;
	line-height: 1.5;
	color: var(--ink);
	margin: 0;
	padding: 0.75rem;
	background: var(--tool-bg-subtle);
	border-radius: 6px;
}

.popover-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.popover-tip {
	padding: 0.75rem;
	font-size: 0.8125rem;
	color: var(--muted);
	background: var(--tool-bg-subtle);
	border-radius: 6px;
	line-height: 1.5;
}

.popover-tip:empty {
	display: none;
}

/* Primary button in popover */
.popover-actions .btn-primary {
	padding: 0.375rem 0.875rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #fff;
	background: var(--readability-accent);
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.2s ease;
}

.popover-actions .btn-primary:hover {
	background: var(--readability-accent-dark);
}

.popover-actions .btn-secondary {
	padding: 0.375rem 0.875rem;
	font-size: 0.8125rem;
}
