/**
 * FSD AI Assistant - Code Compiler & Terminal Sandbox Stylesheet
 */

.fsd-compiler-wrapper {
	font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	background: #0f172a;
	border: 1px solid #334155;
	border-radius: 12px;
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
	overflow: visible;
	margin: 24px 0;
	color: #f8fafc;
	box-sizing: border-box;
}

.fsd-compiler-wrapper * {
	box-sizing: border-box;
}

/* Header & Control Bar */
.fsd-compiler-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #1e293b;
	padding: 10px 16px;
	border-bottom: 1px solid #334155;
	border-top-left-radius: 12px;
	border-top-right-radius: 12px;
	gap: 12px;
	flex-wrap: wrap;
}

.fsd-compiler-lang-select-wrapper {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #0f172a;
	padding: 6px 12px;
	border-radius: 8px;
	border: 1px solid #334155;
}

.fsd-lang-icon {
	color: #38bdf8;
	font-size: 18px;
	width: 18px;
	height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fsd-compiler-lang-select {
	background: #0f172a !important;
	border: none !important;
	color: #f8fafc !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	cursor: pointer;
	outline: none;
	padding: 2px 6px;
	border-radius: 6px;
}

.fsd-compiler-lang-select option {
	background: #1e293b !important;
	color: #f8fafc !important;
	padding: 6px 10px;
}

.fsd-compiler-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Icon-Only Buttons */
.fsd-compiler-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	outline: none;
	position: relative;
	padding: 0;
}

.fsd-compiler-icon-btn .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	line-height: 1;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fsd-btn-reset {
	background: #0f172a;
	color: #94a3b8;
	border-color: #334155;
}

.fsd-btn-reset:hover {
	background: #334155;
	color: #f8fafc;
	border-color: #475569;
}

.fsd-btn-ai-fix {
	background: rgba(168, 85, 247, 0.15);
	color: #c084fc;
	border-color: rgba(168, 85, 247, 0.4);
}

.fsd-btn-ai-fix:hover {
	background: rgba(168, 85, 247, 0.3);
	color: #e9d5ff;
	box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
	transform: translateY(-1px);
}

.fsd-btn-run {
	background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
	border: none;
}

.fsd-btn-run:hover {
	background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
	box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
	transform: translateY(-1px) scale(1.04);
}

.fsd-compiler-icon-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none !important;
	box-shadow: none !important;
}

/* Custom Tooltips for Accessibility */
[data-tooltip] {
	position: relative;
}

[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%) translateY(-4px);
	background: #090d16;
	color: #f8fafc;
	border: 1px solid #334155;
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 9999;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

/* Workspace Grid Body */
.fsd-compiler-body {
	display: grid;
	grid-template-columns: 1fr 1fr;
	min-height: 400px;
	background: #090d16;
	border-bottom-left-radius: 12px;
	border-bottom-right-radius: 12px;
}

@media (max-width: 900px) {
	.fsd-compiler-body {
		grid-template-columns: 1fr;
	}
}

/* Code Editor Container */
.fsd-compiler-editor-container {
	display: flex;
	position: relative;
	background: #0f172a;
	border-right: 1px solid #1e293b;
	overflow: hidden;
	border-bottom-left-radius: 12px;
}

.fsd-editor-gutter {
	width: 40px;
	padding: 16px 8px;
	background: #0b1120;
	color: #94a3b8;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 13px;
	line-height: 1.6;
	text-align: right;
	user-select: none;
	border-right: 1px solid #1e293b;
}

.fsd-compiler-textarea {
	flex: 1;
	width: 100%;
	height: 100%;
	min-height: 380px;
	padding: 16px;
	background: #0f172a !important;
	color: #ffffff !important;
	caret-color: #38bdf8;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Fira Code", "Liberation Mono", "Courier New", monospace;
	font-size: 13.5px;
	line-height: 1.6;
	border: none;
	outline: none;
	resize: vertical;
	white-space: pre;
	overflow-wrap: normal;
	overflow-x: auto;
	tab-size: 4;
}

/* Output Container & Tabs */
.fsd-compiler-output-container {
	display: flex;
	flex-direction: column;
	background: #0b1120;
	border-bottom-right-radius: 12px;
}

.fsd-compiler-tab-header {
	display: flex;
	align-items: center;
	background: #151d30;
	padding: 6px 12px;
	border-bottom: 1px solid #1e293b;
	gap: 6px;
	overflow-x: visible;
}

.fsd-tab-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 8px;
	color: #94a3b8;
	cursor: pointer;
	transition: all 0.2s ease;
	outline: none;
}

.fsd-tab-btn .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	line-height: 1;
	margin: 0;
}

.fsd-tab-btn:hover {
	color: #f8fafc;
	background: rgba(255, 255, 255, 0.05);
}

.fsd-tab-btn.active {
	color: #38bdf8;
	background: rgba(56, 189, 248, 0.12);
	border-color: rgba(56, 189, 248, 0.3);
}

.fsd-status-badge {
	margin-left: auto;
	font-size: 11px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 9999px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.fsd-status-idle {
	background: #1e293b;
	color: #94a3b8;
}

.fsd-status-running {
	background: rgba(59, 130, 246, 0.2);
	color: #60a5fa;
	border: 1px solid rgba(59, 130, 246, 0.4);
}

.fsd-status-success {
	background: rgba(16, 185, 129, 0.2);
	color: #34d399;
	border: 1px solid rgba(16, 185, 129, 0.4);
}

.fsd-status-error {
	background: rgba(239, 68, 68, 0.2);
	color: #f87171;
	border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Tab Pane Contents */
.fsd-compiler-tab-content {
	flex: 1;
	position: relative;
	overflow: hidden;
}

.fsd-tab-pane {
	display: none;
	height: 100%;
	padding: 16px;
	overflow-y: auto;
}

.fsd-tab-pane.active {
	display: block;
}

/* Terminal Console Log */
.fsd-terminal-console {
	margin: 0;
	padding: 0;
	background: transparent;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 13px;
	line-height: 1.6;
	white-space: pre-wrap;
	word-break: break-word;
	color: #e2e8f0;
}

.fsd-log-system {
	color: #64748b;
	font-style: italic;
}

.fsd-log-stdout {
	color: #34d399;
}

.fsd-log-stderr {
	color: #f87171;
}

.fsd-log-info {
	color: #38bdf8;
}

/* Web Live Preview Iframe */
.fsd-preview-iframe {
	width: 100%;
	height: 360px;
	border: none;
	background: #ffffff;
	border-radius: 6px;
}

/* AI Review Pane */
.fsd-ai-review-content {
	color: #cbd5e1;
	font-size: 13px;
	line-height: 1.6;
}

.fsd-ai-card {
	background: #1e293b;
	border-radius: 8px;
	padding: 14px;
	margin-bottom: 12px;
	border: 1px solid #334155;
}

.fsd-ai-card-title {
	font-size: 13px;
	font-weight: 700;
	color: #c084fc;
	margin-bottom: 6px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.fsd-ai-code-block {
	background: #0f172a;
	padding: 10px;
	border-radius: 6px;
	color: #38bdf8;
	font-family: monospace;
	overflow-x: auto;
	margin-top: 8px;
}
