/**
 * Deemah Business Impact Calculator — front-end styles
 *
 * منفذ الـ <style> اللي كان داخل frontend/index.html، بس كل المحددات صارت
 * محصورة داخل .deemah-calc — عشان ما تتصادم مع تصميم القالب (theme) اللي
 * يستخدمه الموقع، ولا تأثر على باقي عناصر الصفحة.
 */

.deemah-calc {
	/* هوية ديمة البصرية — مأخوذة من اللوقو */
	--deemah-green-dark: #2b4d2a;
	--deemah-green-med: #729765;
	--deemah-cream: #f1eed0;
	--deemah-mint: #d1eecf;
	--deemah-lavender: #e3e0e6;
	--deemah-text: #1f2a1e;
	--deemah-white: #ffffff;
	--deemah-error: #b3261e;

	font-family: 'Tajawal', 'Segoe UI', sans-serif;
	color: var(--deemah-text);
	line-height: 1.7;
	background: linear-gradient(180deg, var(--deemah-cream) 0%, var(--deemah-cream) 35%, var(--deemah-mint) 100%);
	border-radius: 18px;
}

/* الاتجاه يتبع lang/dir الحاسبة الفعلية (عربي = rtl، انقليزي = ltr) —
   بدل ما يكون rtl ثابت دايمًا، عشان تدويل الحاسبة يشتغل صح. */
.deemah-calc[dir='rtl'] {
	direction: rtl;
	text-align: right;
}

.deemah-calc[dir='ltr'] {
	direction: ltr;
	text-align: left;
}

.deemah-calc *,
.deemah-calc *::before,
.deemah-calc *::after {
	box-sizing: border-box;
}

.deemah-container {
	max-width: 720px;
	margin: 0 auto;
	padding: 24px 16px 60px;
}

/* ---------------------------------------------------------------
   الهيدر
   --------------------------------------------------------------- */
.deemah-header {
	text-align: center;
	padding: 28px 16px 4px;
}

.deemah-logo-img {
	height: 56px;
	width: auto;
	display: inline-block;
	filter: drop-shadow(0 2px 6px rgba(43, 77, 42, 0.15));
}

.deemah-logo-word {
	font-size: 46px;
	font-weight: 700;
	color: var(--deemah-green-dark);
	margin-top: 2px;
	letter-spacing: 0.5px;
	line-height: 1.1;
}

.deemah-calc .deemah-subtitle {
	color: var(--deemah-green-med);
	font-weight: 700;
	font-size: 15px;
	letter-spacing: 0.5px;
	margin: 2px 0 0;
	text-transform: uppercase;
}

/* ---------------------------------------------------------------
   شريط التقدم
   --------------------------------------------------------------- */
.deemah-progress {
	display: flex;
	justify-content: center;
	background: rgba(255, 255, 255, 0.6);
	border-radius: 999px;
	padding: 6px;
	gap: 4px;
	margin: 20px auto 28px;
	max-width: 480px;
	box-shadow: 0 1px 4px rgba(43, 77, 42, 0.08);
}

.deemah-step {
	flex: 1;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
	color: #93998f;
	padding: 9px 6px;
	border-radius: 999px;
	transition: color 0.25s, background-color 0.25s;
}

.deemah-step.is-active {
	color: var(--deemah-white);
	background: var(--deemah-green-dark);
}

/* ---------------------------------------------------------------
   البطاقات
   --------------------------------------------------------------- */
.deemah-card {
	background: var(--deemah-white);
	border-radius: 18px;
	padding: 26px 24px;
	margin-bottom: 20px;
	box-shadow: 0 4px 18px rgba(43, 77, 42, 0.1);
	border-top: 4px solid var(--deemah-green-med);
}

.deemah-calc .deemah-card h2 {
	display: flex;
	align-items: center;
	color: var(--deemah-green-dark);
	font-size: 20px;
	margin: 0 0 18px;
	padding: 0;
	border: 0;
	font-family: inherit;
}

.deemah-calc .deemah-card-icon {
	flex-shrink: 0;
	width: 22px !important;
	height: 22px !important;
	margin-inline-end: 8px;
	color: var(--deemah-green-med);
}

.deemah-calc .deemah-card-icon svg {
	width: 22px !important;
	height: 22px !important;
	max-width: 22px !important;
	max-height: 22px !important;
	display: block;
}

/* ---------------------------------------------------------------
   النموذج
   --------------------------------------------------------------- */
.deemah-calc label {
	display: block;
	font-weight: 700;
	margin-bottom: 6px;
	font-size: 14px;
	color: var(--deemah-text);
}

.deemah-field-hint {
	font-size: 12px;
	color: #6b6b6b;
	margin-top: -4px;
	margin-bottom: 10px;
}

.deemah-calc input[type='number'],
.deemah-calc input[type='text'],
.deemah-calc select {
	width: 100%;
	max-width: 100%;
	padding: 13px 15px;
	border: 2px solid var(--deemah-lavender);
	border-radius: 12px;
	font-family: inherit;
	font-size: 15px;
	margin-bottom: 18px;
	background: #fbfbf8;
	color: var(--deemah-text);
	line-height: 1.4;
	transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.deemah-calc input:focus,
.deemah-calc select:focus {
	outline: none;
	border-color: var(--deemah-green-med);
	background: var(--deemah-white);
	box-shadow: 0 0 0 4px rgba(114, 151, 101, 0.15);
}

/* مفتاح التفعيل (Toggle) لقسم الأثر البيئي */
.deemah-toggle-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--deemah-mint);
	padding: 14px 16px;
	border-radius: 12px;
	margin-bottom: 18px;
	gap: 12px;
}

.deemah-toggle-row label {
	margin-bottom: 0;
}

.deemah-switch {
	position: relative;
	display: inline-block;
	width: 56px;
	height: 32px;
	flex-shrink: 0;
}

.deemah-switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	margin: 0;
	cursor: pointer;
	z-index: 2;
}

.deemah-slider {
	position: absolute;
	cursor: pointer;
	inset: 0;
	background-color: #b9b9b9;
	border-radius: 34px;
	transition: 0.2s;
}

.deemah-slider::before {
	content: '';
	position: absolute;
	height: 24px;
	width: 24px;
	right: 4px;
	bottom: 4px;
	background-color: #fff;
	border-radius: 50%;
	transition: 0.2s;
}

.deemah-switch input:checked + .deemah-slider {
	background-color: var(--deemah-green-dark);
}

.deemah-switch input:checked + .deemah-slider::before {
	transform: translateX(-24px);
}

/* حقل الفئة يظهر بس لو التبديل مفعّل */
.deemah-env-fields {
	display: none;
}

.deemah-env-fields.is-visible {
	display: block;
}

.deemah-calc button.deemah-btn-primary {
	width: 100%;
	background: linear-gradient(135deg, var(--deemah-green-dark), var(--deemah-green-med));
	color: var(--deemah-white);
	border: none;
	padding: 17px;
	border-radius: 14px;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(43, 77, 42, 0.25);
	transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.deemah-calc button.deemah-btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(43, 77, 42, 0.32);
	filter: brightness(1.05);
}

.deemah-calc button.deemah-btn-primary:active {
	transform: translateY(0);
}

.deemah-calc button.deemah-btn-primary:disabled {
	background: #9aa79a;
	cursor: not-allowed;
	box-shadow: none;
	transform: none;
}

.deemah-error {
	background: #fdecea;
	border: 1px solid var(--deemah-error);
	color: var(--deemah-error);
	padding: 12px 16px;
	border-radius: 10px;
	margin-bottom: 18px;
	font-size: 14px;
	display: none;
}

.deemah-error.is-visible {
	display: block;
}

/* ---------------------------------------------------------------
   النتائج
   --------------------------------------------------------------- */
.deemah-results-section {
	display: none;
}

.deemah-results-section.is-visible {
	display: block;
}

.deemah-exec-summary {
	background: linear-gradient(135deg, var(--deemah-green-dark) 0%, #23401f 100%);
	color: var(--deemah-white);
	border-radius: 18px;
	padding: 28px 26px;
	margin-bottom: 24px;
	font-size: 16px;
	line-height: 1.9;
	box-shadow: 0 6px 20px rgba(43, 77, 42, 0.25);
}

.deemah-exec-summary strong {
	color: var(--deemah-mint);
}

.deemah-result-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	padding: 12px 4px;
	border-bottom: 1px solid var(--deemah-lavender);
	transition: background 0.15s;
}

.deemah-result-row:hover {
	background: rgba(114, 151, 101, 0.06);
	border-radius: 8px;
}

.deemah-result-row:last-child {
	border-bottom: none;
}

.deemah-result-row .deemah-label {
	font-size: 14px;
	color: #555;
}

.deemah-result-row .deemah-value {
	font-size: 18px;
	font-weight: 700;
	color: var(--deemah-green-dark);
	white-space: nowrap;
}

.deemah-advisory {
	background: var(--deemah-mint);
	border-radius: 10px;
	padding: 12px 14px;
	font-size: 13.5px;
	margin-top: 10px;
	color: var(--deemah-text);
	/* النص الاسترشادي صار يتبع لغة الصفحة (عربي/انقليزي) — ما نفرض LTR
	   ثابت هنا بعد الحين، يرث الاتجاه من .deemah-calc[dir]. */
}

.deemah-env-card {
	display: none;
}

.deemah-env-card.is-visible {
	display: block;
}

.deemah-calc button.deemah-btn-new {
	background: transparent;
	border: 2px solid var(--deemah-green-dark);
	color: var(--deemah-green-dark);
	padding: 12px;
	border-radius: 12px;
	width: 100%;
	font-family: inherit;
	font-weight: 700;
	cursor: pointer;
	margin-top: 10px;
}

.deemah-calc button.deemah-btn-pdf {
	background: var(--deemah-green-dark);
	color: var(--deemah-white);
	border: none;
	padding: 14px;
	border-radius: 12px;
	width: 100%;
	font-family: inherit;
	font-weight: 700;
	font-size: 15px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: filter 0.15s;
}

.deemah-calc button.deemah-btn-pdf:hover {
	filter: brightness(1.1);
}

.deemah-calc button.deemah-btn-pdf:disabled {
	background: #9aa79a;
	cursor: not-allowed;
}

/* ---------------------------------------------------------------
   القالب المستقل (standalone page template)
   --------------------------------------------------------------- */
body.deemah-standalone {
	margin: 0;
	padding: 0;
	background: #f1eed0;
}

body.deemah-standalone .deemah-calc {
	border-radius: 0;
	min-height: 100vh;
}

/* ---------------------------------------------------------------
   تصدير التقرير عبر طباعة المتصفح (window.print) — يستبدل html2canvas
   عشان نضمن نفس عرض النص العربي RTL الصحيح اللي يشتغل بالصفحة الحيّة.
   --------------------------------------------------------------- */
@media print {
	@page {
		size: A4;
		margin: 12mm;
	}

	/* عزل العنصر فعليًا يصير عبر JS (display:none على كل الإخوة) —
	   هذا بس يضمن الألوان/التدرجات تُطبع بدل ما المتصفح يشيلها افتراضيًا،
	   ويشيل أي تحديد عرض أقصى/هوامش وراثية تضيّق التقرير. */
	body.deemah-printing .deemah-printable,
	body.deemah-printing .deemah-printable * {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
		color-adjust: exact;
	}

	body.deemah-printing .deemah-printable {
		width: 100%;
		max-width: none;
		margin: 0;
		padding: 0;
		/* الاتجاه يتبع dir العنصر نفسه (موروث من .deemah-calc) — ما نفرضه rtl
		   ثابت، عشان النسخة الانقليزية تطبع LTR صح. */
	}
}
