/**
 * Universal Code Editor
 *
 * @package AiTeluguLo_Tech_Tutorials
 */

/* ---------------------------------------------------------
   Base
--------------------------------------------------------- */

.ait-code-editor-page, .ait-html-code-editor-page {
	margin: 0;
	padding: 0;
	background: #f6f7fb;
	color: #1f2937;
	font-family:
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		Roboto,
		Arial,
		sans-serif;
}

.ait-code-editor-page *, .ait-code-editor-page *::before, .ait-code-editor-page *::after,
.ait-html-code-editor-page *, .ait-html-code-editor-page *::before, .ait-html-code-editor-page *::after {
	box-sizing: border-box;
}


/* ---------------------------------------------------------
   Main Container
--------------------------------------------------------- */

.ait-code-editor {
	width: 100%;
	max-width: 1400px;
	height: calc(100vh - 32px);
	margin: 0 auto;
	padding: 18px 20px 20px;
	display: flex;
	flex-direction: column;
}


/* ---------------------------------------------------------
   Header
--------------------------------------------------------- */

.ait-code-editor-header {
	margin-bottom: 14px;
}

.ait-code-editor-breadcrumb {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
	font-size: 14px;
	color: #6b7280;
}

.ait-code-editor-breadcrumb a {
	color: #2563eb;
	text-decoration: none;
}

.ait-code-editor-breadcrumb a:hover {
	text-decoration: underline;
}

.ait-code-editor-title-row {
	display: flex;
	align-items: center;
	gap: 18px;
	width: 100%;
}

.ait-code-editor-title-row h1 {
	flex: 1;
	margin: 0;
	font-size: 28px;
	line-height: 1.2;
	font-weight: 700;
	color: #111827;
}

.ait-code-editor-lesson-title {
	display: none;
}

.ait-code-editor-technology {
	display: inline-flex;
	align-items: center;
	padding: 8px 14px;
	border-radius: 8px;
	background: #eef2ff;
	color: #4338ca;
	font-size: 14px;
	font-weight: 600;
}


/* ---------------------------------------------------------
   Actions
--------------------------------------------------------- */

.ait-code-editor-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
	margin: 0;
}

.ait-code-editor-run {
	border: 0;
	border-radius: 8px;
	padding: 10px 24px;
	background: #2563eb;
	color: #ffffff;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition:
		background 0.2s ease,
		transform 0.2s ease,
		box-shadow 0.2s ease;
}

.ait-code-editor-run:hover {
	background: #1d4ed8;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.ait-code-editor-run:active {
	transform: translateY(1px);
}

.ait-code-editor-run:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.ait-code-editor-back {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 8px 15px;
	border-radius: 8px;
	background: #ffffff;
	border: 1px solid #d1d5db;
	color: #374151;
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	transition:
		background 0.2s ease,
		border-color 0.2s ease;
}

.ait-code-editor-back:hover {
	background: #f9fafb;
	border-color: #9ca3af;
}


/* ---------------------------------------------------------
   Workspace
--------------------------------------------------------- */

.ait-code-editor-workspace {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 16px;
	width: 100%;
	flex: 1;
	min-height: 0;
}


/* ---------------------------------------------------------
   Panels
--------------------------------------------------------- */

.ait-code-editor-panel {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	background: #ffffff;
	border: 1px solid #dbe1ea;
	border-radius: 10px;
	box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.ait-code-editor-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	height: 46px;
	padding: 0 16px;
	background: #f8fafc;
	border-bottom: 1px solid #e5e7eb;
	color: #111827;
	font-size: 14px;
	font-weight: 700;
}

.ait-code-editor-language {
	color: #6b7280;
	font-size: 13px;
	font-weight: 600;
}


/* ---------------------------------------------------------
   Code Input
--------------------------------------------------------- */

.ait-code-editor-input {
	display: block;
	flex: 1;
	width: 100%;
	min-height: 0;
	margin: 0;
	padding: 18px;
	border: 0;
	outline: none;
	resize: none;
	background: #111827;
	color: #f9fafb;
	font-family:
		"Consolas",
		"Monaco",
		"Courier New",
		monospace;
	font-size: 15px;
	line-height: 1.7;
	tab-size: 4;
	white-space: pre;
	overflow: auto;
}

.ait-code-editor-input:focus {
	box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.35);
}


/* ---------------------------------------------------------
   Output
--------------------------------------------------------- */

.ait-code-editor-output {
	flex: 1;
	min-height: 0;
	padding: 18px;
	background: #ffffff;
	color: #111827;
	font-family:
		"Consolas",
		"Monaco",
		"Courier New",
		monospace;
	font-size: 15px;
	line-height: 1.7;
	white-space: pre-wrap;
	overflow: auto;
}

.ait-code-editor-placeholder {
	color: #9ca3af;
	font-family:
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		Roboto,
		Arial,
		sans-serif;
	font-size: 14px;
}


/* ---------------------------------------------------------
   Status
--------------------------------------------------------- */

.ait-code-editor-status {
	flex-shrink: 0;
	margin-top: 8px;
	padding: 7px 12px;
	border-radius: 8px;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	color: #6b7280;
	font-size: 13px;
}


/* ---------------------------------------------------------
   Error State
--------------------------------------------------------- */

.ait-code-editor-output.ait-code-editor-error {
	background: #fff7f7;
	color: #b91c1c;
}


/* ---------------------------------------------------------
   Success State
--------------------------------------------------------- */

.ait-code-editor-output.ait-code-editor-success {
	background: #f7fff9;
	color: #166534;
}


/* ---------------------------------------------------------
   Preview Mode
--------------------------------------------------------- */

.ait-code-editor-preview-frame {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 470px;
	border: 0;
	background: #ffffff;
}


/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */

@media (max-width: 900px) {

	.ait-code-editor-workspace {
		grid-template-columns: 1fr;
	}

	.ait-code-editor-panel {
		min-height: 420px;
	}

	.ait-code-editor-input,
	.ait-code-editor-output {
		min-height: 370px;
	}

}


@media (max-width: 640px) {

	.ait-code-editor {
		padding: 20px 14px 30px;
	}

	.ait-code-editor-title-row {
		align-items: flex-start;
		flex-direction: column;
	}

	.ait-code-editor-title-row h1 {
		font-size: 27px;
	}

	.ait-code-editor-lesson-title {
		font-size: 16px;
	}

	.ait-code-editor-actions {
		flex-wrap: wrap;
	}

	.ait-code-editor-run {
		padding: 10px 22px;
	}

	.ait-code-editor-panel {
		min-height: 360px;
	}

	.ait-code-editor-input,
	.ait-code-editor-output {
		min-height: 310px;
		font-size: 14px;
	}

}






.ait-code-editor-input-form {
    padding: 20px;
}

.ait-code-editor-input-group {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.ait-code-editor-input-group label {
    display: inline-block;
    margin: 0;
    font-family:
        "Consolas",
        "Monaco",
        "Courier New",
        monospace;
    font-size: 16px;
    font-weight: 400;
    white-space: nowrap;
}

.ait-python-runtime-input {
    width: 180px;
    height: 32px;
    min-height: 32px;
    padding: 4px 8px;
    margin: 0;
    border: 0px solid #d1d5db;
    border-radius: 5px;
    background: #ffffff;
    font-family:
        "Consolas",
        "Monaco",
        "Courier New",
        monospace;
    font-size: 16px;
    line-height: 22px;
    box-sizing: border-box;
}

.ait-python-runtime-input:focus {
    outline: none;
}

.ait-python-input-submit {
    display: none;
}

/* Python terminal-style input */

.ait-python-input-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px 0;
    padding: 0;
}

.ait-python-input-prompt {
    display: inline-block;
    font-family:
        "Consolas",
        "Monaco",
        "Courier New",
        monospace;
    font-size: 15px;
    line-height: 30px;
    white-space: nowrap;
}

.ait-python-runtime-input {
    width: 180px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 3px 7px !important;
    margin: 0 !important;
    display: inline-block !important;
    flex: 0 0 180px !important;
    box-sizing: border-box !important;

    border: none !important;
    outline: none !important;
    background: transparent;
    font-family:
        "Consolas",
        "Monaco",
        "Courier New",
        monospace;
    font-size: 15px;
}

.ait-python-runtime-input:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}


.ait-python-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;

    font-family:
        "Consolas",
        "Monaco",
        "Courier New",
        monospace;

    font-size: 15px;
}

.ait-code-editor-status {
    color: #dc2626;
}

/* ---------------------------------------------------------
   Practice Popup
--------------------------------------------------------- */
.ait-code-editor-practice{
	border: 0;
	border-radius: 8px;
	padding: 10px 24px;
	background: #2563eb;
	color: #ffffff;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition:
		background 0.2s ease,
		transform 0.2s ease,
		box-shadow 0.2s ease;
		}

.ait-practice-overlay {
	display: flex;
	align-items: center;
	justify-content: center;
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: rgba(0, 0, 0, 0.55);
	padding: 20px;
}

.ait-practice-overlay[hidden] {
	display: none;
}

.ait-practice-panel {
	width: 100%;
	max-width: 650px;
	max-height: 85vh;
	overflow-y: auto;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.ait-practice-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid #e5e7eb;
}

.ait-practice-header h2 {
	margin: 0;
	font-size: 20px;
}

.ait-practice-close {
	border: 0;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 6px;
	color: #111827;
}

.ait-practice-content {
	padding: 22px;
}

.ait-practice-item {
	margin-bottom: 20px;
}

.ait-practice-item:last-child {
	margin-bottom: 0;
}

.ait-practice-item h3 {
	margin: 0 0 8px;
	font-size: 16px;
}

.ait-practice-item p {
	margin: 0;
	line-height: 1.7;
	font-size: 15px;
}

/* HTML Code Editor isolated preview iframe */
.ait-html-code-editor-page .ait-html-preview-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: 0;
    background: #ffffff;
}


.ait-practice-content .ait-practice-item + .ait-practice-item {
    margin-top: 24px;
}

