/**
 * Q&A Full Answer Styles
 * Matrix terminal-style rendering for full markdown answers
 */

/* ===== FULL ANSWER CONTAINER ===== */

.qa-answer-view {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9999;
	background: var(--bg-primary, #1a1a2e);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: qaAnswerFadeIn 0.3s ease-out;
}

@keyframes qaAnswerFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ===== HEADER ===== */

.qa-answer-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: rgba(0, 255, 65, 0.05);
	border-bottom: 1px solid rgba(0, 255, 65, 0.2);
	font-family: Arial, Helvetica, sans-serif;
	flex-shrink: 0;
}

.qa-answer-back {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: rgba(0, 255, 65, 0.1);
	border: 1px solid rgba(0, 255, 65, 0.2);
	color: var(--matrix-green, #00ff41);
	cursor: pointer;
	font-size: 18px;
	transition: all 0.2s;
	flex-shrink: 0;
}

.qa-answer-back:hover {
	background: rgba(0, 255, 65, 0.2);
	border-color: rgba(0, 255, 65, 0.4);
}

.qa-answer-back:active {
	transform: scale(0.95);
}

.qa-answer-header-info {
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

.qa-answer-header-label {
	font-size: 11px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.6;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.qa-answer-header-question {
	font-size: 13px;
	color: rgba(255, 255, 255, 0.6);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-top: 2px;
}

.qa-answer-header-question::before {
	content: "> ";
	color: var(--matrix-green, #00ff41);
	opacity: 0.5;
}

/* ===== CONTENT ===== */

.qa-answer-content {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 20px 16px 40px;
	-webkit-overflow-scrolling: touch;
}

/* ===== QUESTION BLOCK ===== */

.qa-answer-question {
	background: rgba(0, 255, 65, 0.06);
	border-left: 3px solid var(--matrix-green, #00ff41);
	border-radius: 0 8px 8px 0;
	padding: 12px 16px;
	margin-bottom: 20px;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 15px;
	color: var(--matrix-green, #00ff41);
	line-height: 1.6;
	word-wrap: break-word;
}

.qa-answer-question::before {
	content: "> ";
	opacity: 0.5;
	font-weight: bold;
}

/* ===== ANSWER BODY ===== */

.qa-answer-body {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 15px;
	line-height: 1.7;
	color: rgba(255, 255, 255, 0.88);
	word-wrap: break-word;
	overflow-wrap: break-word;
	-webkit-user-select: text;
	user-select: text;
}

/* Headings */
.qa-answer-body h1,
.qa-answer-body h2,
.qa-answer-body h3,
.qa-answer-body h4 {
	color: var(--matrix-green, #00ff41);
	font-family: Arial, Helvetica, sans-serif;
	margin: 24px 0 12px;
	line-height: 1.3;
	text-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}

.qa-answer-body h1 {
	font-size: 22px;
	border-bottom: 1px solid rgba(0, 255, 65, 0.2);
	padding-bottom: 8px;
}

.qa-answer-body h2 {
	font-size: 19px;
	border-bottom: 1px solid rgba(0, 255, 65, 0.1);
	padding-bottom: 6px;
}

.qa-answer-body h3 {
	font-size: 17px;
	color: var(--matrix-purple, #a855f7);
	text-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

.qa-answer-body h4 {
	font-size: 14px;
	color: var(--matrix-purple, #a855f7);
	opacity: 0.9;
}

/* Paragraphs */
.qa-answer-body p {
	margin: 10px 0;
}

/* Bold and italic */
.qa-answer-body strong {
	color: var(--matrix-green, #00ff41);
	font-weight: bold;
}

.qa-answer-body em {
	color: var(--matrix-purple, #a855f7);
	font-style: italic;
}

/* Links */
.qa-answer-body a {
	color: var(--matrix-purple, #a855f7);
	text-decoration: underline;
	text-decoration-color: rgba(168, 85, 247, 0.4);
	transition: all 0.2s;
}

.qa-answer-body a:hover {
	color: var(--matrix-green, #00ff41);
	text-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}

/* Inline code */
.qa-answer-body code {
	background: rgba(0, 255, 65, 0.08);
	border: 1px solid rgba(0, 255, 65, 0.15);
	border-radius: 4px;
	padding: 2px 6px;
	font-family: "Courier New", monospace;
	font-size: 13px;
	color: var(--matrix-green, #00ff41);
}

/* Code blocks */
.qa-answer-body pre {
	background: rgba(0, 0, 0, 0.4);
	border: 1px solid rgba(0, 255, 65, 0.2);
	border-radius: 8px;
	padding: 14px 16px;
	margin: 14px 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	position: relative;
}

.qa-answer-body pre::before {
	content: attr(data-lang);
	position: absolute;
	top: 4px;
	right: 8px;
	font-size: 10px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.4;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.qa-answer-body pre code {
	background: none;
	border: none;
	padding: 0;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.8);
	line-height: 1.5;
	white-space: pre;
}

/* Lists */
.qa-answer-body ul,
.qa-answer-body ol {
	margin: 10px 0;
	padding-left: 24px;
}

.qa-answer-body li {
	margin: 6px 0;
	line-height: 1.6;
}

.qa-answer-body li::marker {
	color: var(--matrix-green, #00ff41);
}

/* Nested lists */
.qa-answer-body ul ul,
.qa-answer-body ol ol,
.qa-answer-body ul ol,
.qa-answer-body ol ul {
	margin: 4px 0;
}

/* Blockquote */
.qa-answer-body blockquote {
	border-left: 3px solid var(--matrix-purple, #a855f7);
	background: rgba(168, 85, 247, 0.06);
	margin: 14px 0;
	padding: 10px 16px;
	border-radius: 0 8px 8px 0;
	color: rgba(255, 255, 255, 0.7);
}

/* Horizontal rule */
.qa-answer-body hr {
	border: none;
	height: 1px;
	background: linear-gradient(
		90deg,
		transparent,
		var(--matrix-green, #00ff41),
		var(--matrix-purple, #a855f7),
		var(--matrix-green, #00ff41),
		transparent
	);
	margin: 20px 0;
	opacity: 0.4;
}

/* ===== TABLES ===== */

.qa-answer-body table {
	width: 100%;
	border-collapse: collapse;
	margin: 14px 0;
	font-size: 13px;
	overflow-x: auto;
	display: block;
}

.qa-answer-body thead {
	display: table-header-group;
}

.qa-answer-body tbody {
	display: table-row-group;
}

.qa-answer-body tr {
	display: table-row;
}

.qa-answer-body table {
	display: table;
	min-width: 100%;
}

.qa-answer-body .qa-table-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 14px 0;
	border: 1px solid rgba(0, 255, 65, 0.15);
	border-radius: 8px;
}

.qa-answer-body .qa-table-wrapper table {
	margin: 0;
	min-width: 100%;
}

.qa-answer-body th {
	background: rgba(0, 255, 65, 0.1);
	color: var(--matrix-green, #00ff41);
	font-weight: bold;
	text-align: left;
	padding: 10px 12px;
	border: 1px solid rgba(0, 255, 65, 0.2);
	white-space: nowrap;
}

.qa-answer-body td {
	padding: 8px 12px;
	border: 1px solid rgba(0, 255, 65, 0.1);
	color: rgba(255, 255, 255, 0.8);
}

.qa-answer-body tr:nth-child(even) td {
	background: rgba(0, 255, 65, 0.02);
}

.qa-answer-body tr:hover td {
	background: rgba(0, 255, 65, 0.06);
}

/* ===== FORMULA (monospace block) ===== */

.qa-formula {
	background: rgba(168, 85, 247, 0.08);
	border: 1px solid rgba(168, 85, 247, 0.2);
	border-radius: 8px;
	padding: 12px 16px;
	margin: 14px 0;
	font-family: "Courier New", monospace;
	font-size: 14px;
	color: var(--matrix-purple, #a855f7);
	text-align: center;
	overflow-x: auto;
}

/* ===== LOADING STATE ===== */

.qa-answer-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	gap: 16px;
}

.qa-answer-loading-spinner {
	width: 32px;
	height: 32px;
	border: 2px solid rgba(0, 255, 65, 0.2);
	border-top-color: var(--matrix-green, #00ff41);
	border-radius: 50%;
	animation: qaSpinner 0.8s linear infinite;
}

@keyframes qaSpinner {
	to { transform: rotate(360deg); }
}

.qa-answer-loading-text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 13px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.6;
}

/* ===== ERROR STATE ===== */

.qa-answer-error {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	gap: 16px;
	padding: 40px;
	text-align: center;
}

.qa-answer-error-icon {
	font-size: 48px;
	opacity: 0.4;
}

.qa-answer-error-text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	color: rgba(255, 255, 255, 0.5);
}

.qa-answer-error-text::before {
	content: "// ";
	color: var(--matrix-green, #00ff41);
	opacity: 0.4;
}

/* ===== APPEAR ANIMATION ===== */

.qa-answer-body > * {
	opacity: 0;
	transform: translateY(8px);
	animation: qaElementAppear 0.3s ease-out forwards;
}

.qa-answer-body > *:nth-child(1) { animation-delay: 0.05s; }
.qa-answer-body > *:nth-child(2) { animation-delay: 0.1s; }
.qa-answer-body > *:nth-child(3) { animation-delay: 0.12s; }
.qa-answer-body > *:nth-child(4) { animation-delay: 0.14s; }
.qa-answer-body > *:nth-child(5) { animation-delay: 0.16s; }
.qa-answer-body > *:nth-child(n+6) { animation-delay: 0.18s; }

@keyframes qaElementAppear {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ===== SCANLINE DECORATION (disabled in full answer view) ===== */

.qa-answer-view::after {
	display: none;
}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
	.qa-answer-view,
	.qa-answer-body > * {
		animation: none !important;
	}

	.qa-answer-body > * {
		opacity: 1;
		transform: none;
	}

	.qa-answer-view::after {
		display: none;
	}
}
