/**
 * Engineeringa2z AI Tools — Core CSS (e2zai-core.css)
 * Sirf reusable, shared components. Har class e2zai- se start hoti hai.
 * No Bootstrap, no Tailwind, no external framework.
 */

/* ---------------------------------------------------------------------
 * CSS Variables (theme admin se override hoti hain)
 * ------------------------------------------------------------------ */
.e2zai-scope {
	--e2zai-primary: #0f4c81;
	--e2zai-primary-dark: #0b3a63;
	--e2zai-accent: #f2a900;
	--e2zai-bg: #ffffff;
	--e2zai-surface: #f7f9fc;
	--e2zai-surface-2: #eef2f7;
	--e2zai-border: #d9e1ec;
	--e2zai-text: #1c2733;
	--e2zai-muted: #5a6b7b;
	--e2zai-success: #1a8a4a;
	--e2zai-error: #c0392b;
	--e2zai-warning: #b7791f;
	--e2zai-radius: 10px;
	--e2zai-radius-sm: 6px;
	--e2zai-shadow: 0 1px 3px rgba(16, 42, 67, .08), 0 4px 16px rgba(16, 42, 67, .06);
	--e2zai-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--e2zai-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	--e2zai-gap: 16px;
}

.e2zai-scope[data-e2zai-theme="dark"] {
	--e2zai-bg: #0f1720;
	--e2zai-surface: #16212e;
	--e2zai-surface-2: #1d2b3a;
	--e2zai-border: #2b3b4d;
	--e2zai-text: #e7edf4;
	--e2zai-muted: #9fb0c0;
	--e2zai-shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
}

/* ---------------------------------------------------------------------
 * Base / Typography
 * ------------------------------------------------------------------ */
.e2zai-scope,
.e2zai-scope * {
	box-sizing: border-box;
}

.e2zai-scope {
	font-family: var(--e2zai-font-body);
	color: var(--e2zai-text);
	line-height: 1.6;
	font-size: 16px;
}

.e2zai-scope h1,
.e2zai-scope h2,
.e2zai-scope h3,
.e2zai-scope h4 {
	color: var(--e2zai-text);
	line-height: 1.25;
	margin: 0 0 .5em;
	font-weight: 700;
}

.e2zai-scope p {
	margin: 0 0 1em;
}

.e2zai-scope a {
	color: var(--e2zai-primary);
}

/* ---------------------------------------------------------------------
 * Layout / Grid
 * ------------------------------------------------------------------ */
.e2zai-card {
	background: var(--e2zai-bg);
	border: 1px solid var(--e2zai-border);
	border-radius: var(--e2zai-radius);
	box-shadow: var(--e2zai-shadow);
	padding: 20px;
}

.e2zai-card + .e2zai-card {
	margin-top: var(--e2zai-gap);
}

.e2zai-grid {
	display: grid;
	gap: var(--e2zai-gap);
}

.e2zai-grid-2 {
	grid-template-columns: repeat(2, 1fr);
}

.e2zai-grid-3 {
	grid-template-columns: repeat(3, 1fr);
}

.e2zai-stack > * + * {
	margin-top: 12px;
}

.e2zai-row {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	align-items: center;
}

/* ---------------------------------------------------------------------
 * Forms / Inputs / Textarea (AI-friendly, auto-grow)
 * ------------------------------------------------------------------ */
.e2zai-label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
	color: var(--e2zai-text);
}

.e2zai-input,
.e2zai-textarea,
.e2zai-select {
	width: 100%;
	padding: 11px 13px;
	font-size: 15px;
	font-family: inherit;
	color: var(--e2zai-text);
	background: var(--e2zai-surface);
	border: 1px solid var(--e2zai-border);
	border-radius: var(--e2zai-radius-sm);
	transition: border-color .15s, box-shadow .15s;
}

.e2zai-input:focus,
.e2zai-textarea:focus,
.e2zai-select:focus {
	outline: none;
	border-color: var(--e2zai-primary);
	box-shadow: 0 0 0 3px rgba(15, 76, 129, .15);
}

.e2zai-textarea {
	min-height: 96px;
	resize: vertical;
	overflow: hidden;
	line-height: 1.55;
}

.e2zai-hint {
	font-size: 13px;
	color: var(--e2zai-muted);
	margin-top: 5px;
}

/* ---------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------ */
.e2zai-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 11px 20px;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	line-height: 1;
	color: #fff;
	background: var(--e2zai-primary, #0f4c81);
	border: 1px solid var(--e2zai-primary, #0f4c81);
	border-radius: var(--e2zai-radius-sm, 6px);
	cursor: pointer;
	transition: background .15s, transform .05s, opacity .15s;
	text-decoration: none;
}

.e2zai-btn:hover {
	background: var(--e2zai-primary-dark, #0b3a63);
}

.e2zai-btn:active {
	transform: translateY(1px);
}

.e2zai-btn:disabled,
.e2zai-btn.is-loading {
	opacity: .6;
	cursor: not-allowed;
}

.e2zai-btn-secondary {
	color: var(--e2zai-text, #1c2733);
	background: var(--e2zai-surface-2, #eef2f7);
	border-color: var(--e2zai-border, #d9e1ec);
}

.e2zai-btn-secondary:hover {
	background: var(--e2zai-border, #d9e1ec);
}

.e2zai-btn-ghost {
	color: var(--e2zai-primary, #0f4c81);
	background: transparent;
	border-color: transparent;
	padding: 6px 10px;
}

.e2zai-btn-sm {
	padding: 7px 12px;
	font-size: 13px;
}

/* ---------------------------------------------------------------------
 * Badges / Alerts
 * ------------------------------------------------------------------ */
.e2zai-badge {
	display: inline-block;
	padding: 3px 10px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 999px;
	background: var(--e2zai-surface-2);
	color: var(--e2zai-muted);
}

.e2zai-badge-success { background: rgba(26, 138, 74, .12); color: var(--e2zai-success); }
.e2zai-badge-error { background: rgba(192, 57, 43, .12); color: var(--e2zai-error); }
.e2zai-badge-warning { background: rgba(183, 121, 31, .12); color: var(--e2zai-warning); }

.e2zai-alert {
	padding: 12px 16px;
	border-radius: var(--e2zai-radius-sm);
	border-left: 4px solid var(--e2zai-border);
	background: var(--e2zai-surface);
	font-size: 14px;
}

.e2zai-alert-warning { border-left-color: var(--e2zai-warning); background: rgba(183, 121, 31, .08); }
.e2zai-alert-error { border-left-color: var(--e2zai-error); background: rgba(192, 57, 43, .08); }
.e2zai-alert-success { border-left-color: var(--e2zai-success); background: rgba(26, 138, 74, .08); }
.e2zai-alert-info { border-left-color: var(--e2zai-primary); background: rgba(15, 76, 129, .07); }

/* ---------------------------------------------------------------------
 * Chat / Response Bubbles
 * ------------------------------------------------------------------ */
.e2zai-response {
	background: var(--e2zai-surface);
	border: 1px solid var(--e2zai-border);
	border-radius: var(--e2zai-radius);
	padding: 18px 20px;
	position: relative;
}

.e2zai-response-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--e2zai-border);
}

.e2zai-response-body {
	font-size: 15.5px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.e2zai-response-body h1,
.e2zai-response-body h2,
.e2zai-response-body h3 { margin-top: 1em; }

.e2zai-response-body ul,
.e2zai-response-body ol { margin: 0 0 1em 1.4em; }

.e2zai-response-body li { margin-bottom: .35em; }

.e2zai-response-body table {
	width: 100%;
	border-collapse: collapse;
	margin: 1em 0;
	font-size: 14px;
}

.e2zai-response-body th,
.e2zai-response-body td {
	border: 1px solid var(--e2zai-border);
	padding: 8px 10px;
	text-align: left;
}

.e2zai-response-body th { background: var(--e2zai-surface-2); }

/* ---------------------------------------------------------------------
 * Code blocks + Copy button
 * ------------------------------------------------------------------ */
.e2zai-code {
	background: #0d1b2a;
	color: #e2e8f0;
	border-radius: var(--e2zai-radius-sm);
	padding: 14px 16px;
	overflow-x: auto;
	font-family: var(--e2zai-font-mono);
	font-size: 13.5px;
	line-height: 1.5;
	margin: 1em 0;
	position: relative;
}

.e2zai-response-body code {
	font-family: var(--e2zai-font-mono);
	background: var(--e2zai-surface-2);
	padding: 2px 6px;
	border-radius: 4px;
	font-size: .9em;
}

.e2zai-response-body pre code {
	background: transparent;
	padding: 0;
}

.e2zai-copy {
	position: absolute;
	top: 10px;
	right: 10px;
}

/* ---------------------------------------------------------------------
 * Loader / AI Typing (Thinking) Indicator
 * ------------------------------------------------------------------ */
.e2zai-loader {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid var(--e2zai-border);
	border-top-color: var(--e2zai-primary);
	border-radius: 50%;
	animation: e2zai-spin .7s linear infinite;
}

@keyframes e2zai-spin { to { transform: rotate(360deg); } }

.e2zai-typing {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--e2zai-muted);
	font-size: 14px;
	padding: 6px 0;
}

.e2zai-typing-dots {
	display: inline-flex;
	gap: 5px;
}

.e2zai-typing-dots span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--e2zai-primary);
	opacity: .4;
	animation: e2zai-blink 1.2s infinite both;
}

.e2zai-typing-dots span:nth-child(2) { animation-delay: .2s; }
.e2zai-typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes e2zai-blink {
	0%, 80%, 100% { opacity: .3; transform: scale(.85); }
	40% { opacity: 1; transform: scale(1); }
}

/* Skeleton loader */
.e2zai-skeleton {
	background: linear-gradient(90deg, var(--e2zai-surface-2) 25%, var(--e2zai-border) 37%, var(--e2zai-surface-2) 63%);
	background-size: 400% 100%;
	animation: e2zai-shimmer 1.4s ease infinite;
	border-radius: 4px;
	height: 14px;
	margin-bottom: 10px;
}

@keyframes e2zai-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------------------------------------------------------------------
 * Toast
 * ------------------------------------------------------------------ */
.e2zai-toast-wrap {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.e2zai-toast {
	background: var(--e2zai-text);
	color: #fff;
	padding: 12px 18px;
	border-radius: var(--e2zai-radius-sm);
	font-size: 14px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
	animation: e2zai-toast-in .25s ease;
	max-width: 340px;
}

.e2zai-toast-success { background: var(--e2zai-success); }
.e2zai-toast-error { background: var(--e2zai-error); }

@keyframes e2zai-toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------
 * Modal
 * ------------------------------------------------------------------ */
.e2zai-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 20, 30, .55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99998;
	padding: 20px;
}

.e2zai-modal {
	background: var(--e2zai-bg);
	border-radius: var(--e2zai-radius);
	padding: 24px;
	max-width: 520px;
	width: 100%;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

/* Utilities */
.e2zai-mt-0 { margin-top: 0; }
.e2zai-mt-1 { margin-top: 8px; }
.e2zai-mt-2 { margin-top: 16px; }
.e2zai-hidden { display: none !important; }
.e2zai-text-muted { color: var(--e2zai-muted); }
.e2zai-text-center { text-align: center; }
.e2zai-fade-in { animation: e2zai-fade .3s ease; }

@keyframes e2zai-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------ */
@media (max-width: 768px) {
	.e2zai-grid-2,
	.e2zai-grid-3 { grid-template-columns: 1fr; }
	.e2zai-scope { font-size: 15px; }
	.e2zai-card { padding: 16px; }
	.e2zai-toast-wrap { left: 16px; right: 16px; bottom: 16px; }
	.e2zai-toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
	.e2zai-scope *,
	.e2zai-loader,
	.e2zai-typing-dots span,
	.e2zai-skeleton { animation: none !important; transition: none !important; }
}
