/*!
 * Engineeringa2z Tools — Core CSS (e2z-core.css)
 * Saari classes e2z- prefix ke saath. Generic names kabhi nahi.
 * Tools ke module CSS me sirf e2z-[tool-slug]- classes hoti hain.
 */

/* ---------- CSS Variables ---------- */
.e2z-tool,
.e2z-scope {
	/* Colors — admin settings se override hote hain (:root inline) */
	--e2z-primary: #0f766e;
	--e2z-accent: #d97706;
	--e2z-bg: #ffffff;
	--e2z-surface: #f8fafc;
	--e2z-surface-2: #eef2f7;
	--e2z-border: #d9e0ea;
	--e2z-text: #17212e;
	--e2z-text-muted: #5b6b7d;
	--e2z-success: #15803d;
	--e2z-warn: #b45309;
	--e2z-error: #b91c1c;
	--e2z-info: #0369a1;

	/* Spacing scale */
	--e2z-sp-1: 4px;
	--e2z-sp-2: 8px;
	--e2z-sp-3: 12px;
	--e2z-sp-4: 16px;
	--e2z-sp-5: 24px;
	--e2z-sp-6: 32px;
	--e2z-sp-7: 48px;

	/* Type + radius + shadow */
	--e2z-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, sans-serif;
	--e2z-font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
	--e2z-radius: 10px;
	--e2z-radius-sm: 6px;
	--e2z-shadow: 0 1px 2px rgba(15, 30, 50, 0.06), 0 4px 14px rgba(15, 30, 50, 0.07);
	--e2z-focus-ring: 0 0 0 3px color-mix(in srgb, var(--e2z-primary) 30%, transparent);

	font-family: var(--e2z-font);
	color: var(--e2z-text);
	line-height: 1.55;
	box-sizing: border-box;
}

/* Dark mode variables — [data-e2z-theme="dark"] wrapper ya OS preference */
.e2z-tool[data-e2z-theme="dark"],
[data-e2z-theme="dark"] .e2z-tool,
[data-e2z-theme="dark"] .e2z-scope {
	--e2z-bg: #0f1722;
	--e2z-surface: #16202e;
	--e2z-surface-2: #1d2938;
	--e2z-border: #2c3b4e;
	--e2z-text: #e7edf4;
	--e2z-text-muted: #9db0c3;
	--e2z-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
	[data-e2z-theme="auto"] .e2z-tool,
	.e2z-tool[data-e2z-theme="auto"] {
		--e2z-bg: #0f1722;
		--e2z-surface: #16202e;
		--e2z-surface-2: #1d2938;
		--e2z-border: #2c3b4e;
		--e2z-text: #e7edf4;
		--e2z-text-muted: #9db0c3;
	}
}

.e2z-tool *,
.e2z-tool *::before,
.e2z-tool *::after {
	box-sizing: inherit;
}

/* ---------- Typography ---------- */
.e2z-h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 var(--e2z-sp-4); line-height: 1.25; }
.e2z-h2 { font-size: 1.35rem; font-weight: 700; margin: 0 0 var(--e2z-sp-3); line-height: 1.3; }
.e2z-h3 { font-size: 1.1rem; font-weight: 600; margin: 0 0 var(--e2z-sp-2); }
.e2z-text-muted { color: var(--e2z-text-muted); }
.e2z-text-small { font-size: 0.85rem; }
.e2z-mono { font-family: var(--e2z-font-mono); }
.e2z-text-center { text-align: center; }
.e2z-text-right { text-align: right; }

/* ---------- Card ---------- */
.e2z-card {
	background: var(--e2z-surface);
	border: 1px solid var(--e2z-border);
	border-radius: var(--e2z-radius);
	box-shadow: var(--e2z-shadow);
	padding: var(--e2z-sp-5);
	margin-bottom: var(--e2z-sp-5);
}
.e2z-card-title {
	font-size: 1.05rem;
	font-weight: 700;
	margin: 0 0 var(--e2z-sp-3);
	display: flex;
	align-items: center;
	gap: var(--e2z-sp-2);
}

/* ---------- Buttons ---------- */
.e2z-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--e2z-sp-2);
	padding: 10px 18px;
	border-radius: var(--e2z-radius-sm);
	border: 1px solid transparent;
	background: var(--e2z-primary);
	color: #ffffff;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	transition: filter 0.15s ease, transform 0.08s ease;
}
.e2z-btn:hover { filter: brightness(1.08); }
.e2z-btn:active { transform: translateY(1px); }
.e2z-btn:focus-visible { outline: none; box-shadow: var(--e2z-focus-ring); }
.e2z-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.e2z-btn-accent { background: var(--e2z-accent); }
.e2z-btn-ghost {
	background: transparent;
	color: var(--e2z-primary);
	border-color: var(--e2z-border);
}
.e2z-btn-ghost:hover { background: var(--e2z-surface-2); filter: none; }
.e2z-btn-danger { background: var(--e2z-error); }
.e2z-btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.e2z-btn-lg { padding: 13px 24px; font-size: 1.05rem; }
.e2z-btn-block { width: 100%; }

/* ---------- Forms & Inputs ---------- */
.e2z-field { margin-bottom: var(--e2z-sp-4); }
.e2z-label {
	display: block;
	font-weight: 600;
	font-size: 0.9rem;
	margin-bottom: var(--e2z-sp-1);
}
.e2z-input,
.e2z-select,
.e2z-textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--e2z-border);
	border-radius: var(--e2z-radius-sm);
	background: var(--e2z-bg);
	color: var(--e2z-text);
	font-family: inherit;
	font-size: 0.95rem;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.e2z-input:focus,
.e2z-select:focus,
.e2z-textarea:focus {
	outline: none;
	border-color: var(--e2z-primary);
	box-shadow: var(--e2z-focus-ring);
}
.e2z-input[aria-invalid="true"] { border-color: var(--e2z-error); }
.e2z-hint { font-size: 0.8rem; color: var(--e2z-text-muted); margin-top: var(--e2z-sp-1); }
.e2z-error-text { font-size: 0.8rem; color: var(--e2z-error); margin-top: var(--e2z-sp-1); }
.e2z-input-group { display: flex; }
.e2z-input-group .e2z-input { border-radius: var(--e2z-radius-sm) 0 0 var(--e2z-radius-sm); }
.e2z-input-addon {
	display: inline-flex;
	align-items: center;
	padding: 0 12px;
	border: 1px solid var(--e2z-border);
	border-left: 0;
	border-radius: 0 var(--e2z-radius-sm) var(--e2z-radius-sm) 0;
	background: var(--e2z-surface-2);
	font-size: 0.85rem;
	color: var(--e2z-text-muted);
	white-space: nowrap;
}

/* ---------- Tables ---------- */
.e2z-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.e2z-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}
.e2z-table th,
.e2z-table td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--e2z-border);
	text-align: left;
}
.e2z-table th {
	background: var(--e2z-surface-2);
	font-weight: 700;
	white-space: nowrap;
}
.e2z-table tbody tr:hover { background: var(--e2z-surface-2); }

/* ---------- Grid & layout utilities ---------- */
.e2z-grid { display: grid; gap: var(--e2z-sp-4); }
.e2z-grid-2 { grid-template-columns: repeat(2, 1fr); }
.e2z-grid-3 { grid-template-columns: repeat(3, 1fr); }
.e2z-grid-4 { grid-template-columns: repeat(4, 1fr); }
.e2z-flex { display: flex; gap: var(--e2z-sp-3); align-items: center; }
.e2z-flex-wrap { flex-wrap: wrap; }
.e2z-flex-between { justify-content: space-between; }
.e2z-mt-2 { margin-top: var(--e2z-sp-2); }
.e2z-mt-4 { margin-top: var(--e2z-sp-4); }
.e2z-mb-2 { margin-bottom: var(--e2z-sp-2); }
.e2z-mb-4 { margin-bottom: var(--e2z-sp-4); }
.e2z-hidden { display: none !important; }

/* ---------- Badges ---------- */
.e2z-badge {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
	background: var(--e2z-surface-2);
	color: var(--e2z-text-muted);
	border: 1px solid var(--e2z-border);
}
.e2z-badge-primary { background: color-mix(in srgb, var(--e2z-primary) 12%, transparent); color: var(--e2z-primary); border-color: transparent; }
.e2z-badge-success { background: color-mix(in srgb, var(--e2z-success) 12%, transparent); color: var(--e2z-success); border-color: transparent; }
.e2z-badge-warn { background: color-mix(in srgb, var(--e2z-warn) 12%, transparent); color: var(--e2z-warn); border-color: transparent; }
.e2z-badge-error { background: color-mix(in srgb, var(--e2z-error) 12%, transparent); color: var(--e2z-error); border-color: transparent; }

/* ---------- Alerts ---------- */
.e2z-alert {
	padding: var(--e2z-sp-3) var(--e2z-sp-4);
	border-radius: var(--e2z-radius-sm);
	border: 1px solid var(--e2z-border);
	border-left-width: 4px;
	background: var(--e2z-surface);
	margin: var(--e2z-sp-3) 0;
	font-size: 0.92rem;
}
.e2z-alert-info { border-left-color: var(--e2z-info); }
.e2z-alert-success { border-left-color: var(--e2z-success); }
.e2z-alert-warn { border-left-color: var(--e2z-warn); }
.e2z-alert-error { border-left-color: var(--e2z-error); }

/* ---------- Toast ---------- */
.e2z-toast-stack {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: var(--e2z-sp-2);
	max-width: min(340px, calc(100vw - 32px));
}
.e2z-toast {
	background: #17212e;
	color: #ffffff;
	padding: 12px 16px;
	border-radius: var(--e2z-radius-sm);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
	font-size: 0.9rem;
	font-family: var(--e2z-font);
	animation: e2z-slide-up 0.25s ease;
	border-left: 4px solid var(--e2z-primary, #0f766e);
}
.e2z-toast-success { border-left-color: #22c55e; }
.e2z-toast-error { border-left-color: #ef4444; }
.e2z-toast-leaving { animation: e2z-fade-out 0.25s ease forwards; }

/* ---------- Modal ---------- */
.e2z-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 18, 28, 0.6);
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--e2z-sp-4, 16px);
	animation: e2z-fade-in 0.2s ease;
}
.e2z-modal {
	background: var(--e2z-bg, #ffffff);
	color: var(--e2z-text, #17212e);
	border-radius: 12px;
	max-width: 560px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	padding: 24px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	animation: e2z-slide-up 0.25s ease;
}
.e2z-modal-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 12px; }
.e2z-modal-close { float: right; background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: inherit; line-height: 1; }

/* ---------- Loader / Skeleton ---------- */
.e2z-loader {
	display: inline-block;
	width: 22px;
	height: 22px;
	border: 3px solid var(--e2z-border);
	border-top-color: var(--e2z-primary);
	border-radius: 50%;
	animation: e2z-spin 0.7s linear infinite;
}
.e2z-skeleton {
	background: linear-gradient(90deg, var(--e2z-surface-2) 25%, var(--e2z-surface) 50%, var(--e2z-surface-2) 75%);
	background-size: 200% 100%;
	animation: e2z-shimmer 1.4s ease infinite;
	border-radius: var(--e2z-radius-sm);
	min-height: 14px;
}

/* ---------- Tabs ---------- */
.e2z-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--e2z-border); flex-wrap: wrap; }
.e2z-tab {
	padding: 10px 16px;
	border: 0;
	background: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--e2z-text-muted);
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
}
.e2z-tab:focus-visible { outline: none; box-shadow: var(--e2z-focus-ring); border-radius: 4px; }
.e2z-tab-active { color: var(--e2z-primary); border-bottom-color: var(--e2z-primary); }
.e2z-tab-panel { padding-top: var(--e2z-sp-4); }

/* ---------- Accordion ---------- */
.e2z-accordion { border: 1px solid var(--e2z-border); border-radius: var(--e2z-radius-sm); overflow: hidden; }
.e2z-accordion-item + .e2z-accordion-item { border-top: 1px solid var(--e2z-border); }
.e2z-accordion-head {
	width: 100%;
	text-align: left;
	background: var(--e2z-surface);
	border: 0;
	padding: 12px 16px;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--e2z-text);
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.e2z-accordion-body { padding: 12px 16px; display: none; }
.e2z-accordion-open .e2z-accordion-body { display: block; }

/* ---------- Tooltip ---------- */
.e2z-tooltip { position: relative; cursor: help; border-bottom: 1px dotted var(--e2z-text-muted); }
.e2z-tooltip::after {
	content: attr(data-e2z-tip);
	position: absolute;
	bottom: 125%;
	left: 50%;
	transform: translateX(-50%);
	background: #17212e;
	color: #fff;
	padding: 6px 10px;
	border-radius: 6px;
	font-size: 0.78rem;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
	z-index: 10;
}
.e2z-tooltip:hover::after,
.e2z-tooltip:focus::after { opacity: 1; }

/* ---------- Export bar ---------- */
.e2z-export-bar {
	display: flex;
	gap: var(--e2z-sp-2);
	flex-wrap: wrap;
	margin-top: var(--e2z-sp-4);
	padding-top: var(--e2z-sp-3);
	border-top: 1px dashed var(--e2z-border);
}

/* ---------- Pagination ---------- */
.e2z-pagination { display: flex; gap: var(--e2z-sp-1); flex-wrap: wrap; }
.e2z-page-btn {
	min-width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--e2z-border);
	border-radius: var(--e2z-radius-sm);
	background: var(--e2z-bg);
	color: var(--e2z-text);
	cursor: pointer;
	font-family: inherit;
}
.e2z-page-btn-active { background: var(--e2z-primary); color: #fff; border-color: var(--e2z-primary); }

/* ---------- Animations ---------- */
@keyframes e2z-spin { to { transform: rotate(360deg); } }
@keyframes e2z-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes e2z-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes e2z-slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes e2z-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.e2z-anim-fade { animation: e2z-fade-in 0.3s ease; }
.e2z-anim-slide { animation: e2z-slide-up 0.3s ease; }

@media (prefers-reduced-motion: reduce) {
	.e2z-tool *,
	.e2z-toast,
	.e2z-modal,
	.e2z-modal-overlay {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.e2z-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
	.e2z-grid-3 { grid-template-columns: repeat(2, 1fr); }
	.e2z-card { padding: var(--e2z-sp-4); }
}
@media (max-width: 480px) {
	.e2z-grid-2,
	.e2z-grid-3,
	.e2z-grid-4 { grid-template-columns: 1fr; }
	.e2z-h1 { font-size: 1.4rem; }
	.e2z-flex-wrap-mobile { flex-wrap: wrap; }
	.e2z-btn { width: 100%; }
	.e2z-export-bar .e2z-btn { width: auto; flex: 1 1 auto; }
}

/* ---------- Print ---------- */
@media print {
	.e2z-export-bar,
	.e2z-toast-stack,
	.e2z-modal-overlay { display: none !important; }
	.e2z-card { box-shadow: none; border-color: #999; }
}

/* ---------- Desktop View popup + forced layout (Part 9 core update) ---------- */
/* Popup: bottom-centered toast-style dialog, mobile-first sizing */
.e2z-dvp-popup {
	position: fixed;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	z-index: 99999;
	width: calc(100% - 28px);
	max-width: 420px;
	background: #1E293B;
	color: #F1F5F9;
	border-radius: 12px;
	padding: 16px 44px 16px 16px;
	box-shadow: 0 8px 30px rgba(2, 6, 23, 0.45);
	font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
	animation: e2z-dvp-in 0.3s ease;
}
@keyframes e2z-dvp-in {
	from { opacity: 0; transform: translateX(-50%) translateY(14px); }
	to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.e2z-dvp-msg {
	margin: 0 0 12px;
	font-size: 0.9rem;
	line-height: 1.5;
	color: #F1F5F9;
}
.e2z-dvp-switch {
	width: 100%;
	min-height: 44px;
	padding: 11px 14px;
	border: none;
	border-radius: 8px;
	background: #2563EB;
	color: #fff;
	font-family: inherit;
	font-size: 0.92rem;
	font-weight: 700;
	cursor: pointer;
}
.e2z-dvp-switch:hover { filter: brightness(1.15); }
.e2z-dvp-switch:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5); }
.e2z-dvp-close {
	position: absolute;
	top: 8px;
	right: 8px;
	min-width: 34px;
	min-height: 34px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: #94A3B8;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	line-height: 1;
}
.e2z-dvp-close:hover { background: rgba(148, 163, 184, 0.15); color: #fff; }
.e2z-dvp-close:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.4); }

/* Forced desktop layout: viewport meta width=1280 hi asli mechanism hai
 * (media queries phir desktop layout render karti hain) — ye class
 * supplementary hai: page ko squish hone se rokti hai + future hooks. */
body.e2z-force-desktop-view {
	min-width: 1280px;
	overflow-x: auto;
}
/* Forced desktop me popup dobara na dikhe to bhi layout stable rahe */
body.e2z-force-desktop-view .e2z-dvp-popup {
	max-width: 420px;
}

/* ---------- "Back to Mobile View" revert button (Part 9 core update, addition) ---------- */
/* Minor floating pill — right edge, vertically centered, semi-transparent.
 * Right-middle placement portrait aur landscape dono me visible rehta hai
 * aur page content/CTAs se overlap minimum rakhta hai. */
.e2z-dvr-btn {
	position: fixed;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	z-index: 99998; /* popup (99999) ke just neeche */
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 10px 12px 10px 10px;
	border: 1px solid rgba(148, 163, 184, 0.35);
	border-right: none;
	border-radius: 10px 0 0 10px;
	background: rgba(15, 23, 42, 0.55);
	color: #F1F5F9;
	font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
	font-size: 0.74rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	opacity: 0.6;
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	transition: opacity 0.2s ease, background 0.2s ease;
	max-width: 46vw;
}
.e2z-dvr-btn:hover,
.e2z-dvr-btn:focus-visible {
	opacity: 1;
	background: rgba(15, 23, 42, 0.9);
	outline: none;
}
.e2z-dvr-btn:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5); }
.e2z-dvr-icon { font-size: 0.95rem; }
.e2z-dvr-text { white-space: nowrap; }
