/* AgriMer — مؤشّر الإشعاع الشمسي والطاقة المتجددة
 * يُحمَّل داخل Shadow DOM، فلا يصل إليه CSS القالب ولا يصل هو إليه.
 * نفس نظام التصميم المستعمَل في agrimer-livestock.css، بادئة en- بدل ls-.
 */

:host {
	display: block;
	all: initial;
	font-family: "Cairo", "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* :where() = خصوصية صفر، حتى لا يطغى هذا التصفير على أنماط Leaflet الداخلية */
:where(.en-root, .en-root *) {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font-family: inherit;
}

.en-root {
	direction: rtl;
	color: #17202a;
	font-size: 15px;
	line-height: 1.7;
}

/* ---------- الرأس ---------- */

.en-head {
	margin-bottom: 14px;
}

.en-head h2 {
	font-size: 22px;
	font-weight: 800;
	color: #0e3b2e;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.en-head p {
	font-size: 13.5px;
	color: #5b6b73;
	margin-top: 4px;
}

.en-badge {
	display: inline-block;
	background: #fff6e6;
	color: #a1690a;
	border: 1px solid #f0dba8;
	border-radius: 999px;
	padding: 2px 10px;
	font-size: 12px;
	font-weight: 700;
}

/* ---------- منتقي الولايات ---------- */

.en-regions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 16px;
}

.en-regions button {
	appearance: none;
	border: 1px solid #d6e2e6;
	background: #fff;
	color: #2c3e50;
	border-radius: 999px;
	padding: 6px 13px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: all .15s;
	line-height: 1.4;
}

.en-regions button:hover {
	border-color: #f39c12;
	color: #a1690a;
}

.en-regions button[aria-pressed="true"] {
	background: #e67e22;
	border-color: #e67e22;
	color: #fff;
}

/* ---------- الشبكة ---------- */

.en-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 14px;
	align-items: start;
}

.en-card {
	background: #fff;
	border: 1px solid #e4ecef;
	border-radius: 16px;
	padding: 16px 18px;
	box-shadow: 0 2px 10px rgba(16, 42, 67, .05);
}

.en-card h3 {
	font-size: 15px;
	font-weight: 800;
	color: #0e3b2e;
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.en-wide {
	grid-column: 1 / -1;
}

/* ---------- المقياس ---------- */

.en-gauge {
	text-align: center;
	padding: 20px 18px 18px;
	border-radius: 16px;
	border: 1px solid #e4ecef;
	color: #fff;
	position: relative;
	overflow: hidden;
}

.en-gauge .en-num {
	font-size: 52px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -1px;
}

.en-gauge .en-unit {
	font-size: 15px;
	font-weight: 700;
	opacity: .9;
	margin-top: 2px;
}

.en-gauge .en-lvl {
	font-size: 18px;
	font-weight: 800;
	margin-top: 10px;
}

.en-gauge .en-meta {
	font-size: 13px;
	opacity: .95;
	margin-top: 8px;
	background: rgba(0, 0, 0, .16);
	border-radius: 10px;
	padding: 6px 10px;
	display: inline-block;
}

/* ---------- سلّم الدرجات ---------- */

.en-scale {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px;
	margin-top: 12px;
}

.en-scale > div {
	text-align: center;
	font-size: 10.5px;
	font-weight: 700;
	color: #fff;
	border-radius: 7px;
	padding: 5px 2px;
	opacity: .38;
	transition: opacity .2s;
	line-height: 1.35;
}

.en-scale > div.on {
	opacity: 1;
	box-shadow: 0 0 0 2px #17202a inset;
}

.en-scale .ltr {
	font-size: 9.5px;
	opacity: .95;
	font-variant-numeric: tabular-nums;
}

/* ---------- شريط الساعات ---------- */

.en-hours {
	display: grid;
	grid-template-columns: repeat(24, 1fr);
	gap: 2px;
	align-items: end;
	height: 130px;
	margin-top: 6px;
	direction: ltr;
}

.en-hours .hbar {
	position: relative;
	border-radius: 4px 4px 2px 2px;
	min-height: 4px;
	cursor: default;
	background: #f39c12;
}

.en-hours .hbar.na {
	background: #e8eef0;
	height: 6px;
}

.en-hours .hbar.now {
	box-shadow: 0 0 0 2px #17202a;
}

.en-hlabels {
	display: grid;
	grid-template-columns: repeat(24, 1fr);
	gap: 2px;
	margin-top: 5px;
	direction: ltr;
}

.en-hlabels span {
	font-size: 9.5px;
	color: #7c8c93;
	text-align: center;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ltr {
	direction: ltr;
	unicode-bidi: isolate;
	display: inline-block;
}

.en-tip {
	font-size: 12.5px;
	color: #5b6b73;
	margin-top: 8px;
	min-height: 20px;
}

/* ---------- الملخّص ---------- */

.en-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	gap: 8px;
	margin-top: 12px;
}

.en-stat {
	background: #fffaf0;
	border: 1px solid #f2e4c4;
	border-radius: 12px;
	padding: 9px 10px;
	text-align: center;
}

.en-stat b {
	display: block;
	font-size: 19px;
	font-weight: 800;
	color: #0e3b2e;
	font-variant-numeric: tabular-nums;
}

.en-stat > span {
	font-size: 11.5px;
	color: #6b7c84;
	font-weight: 600;
}

/* ---------- المدخلات ---------- */

.en-fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 10px;
	margin-bottom: 12px;
}

.en-field label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: #5b6b73;
	margin-bottom: 4px;
}

.en-field input {
	width: 100%;
	border: 1px solid #d6e2e6;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 15px;
	font-weight: 700;
	color: #17202a;
	background: #fff;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.en-field input:focus {
	outline: none;
	border-color: #f39c12;
	box-shadow: 0 0 0 3px rgba(243, 156, 18, .18);
}

/* ---------- الأرقام الكبيرة ---------- */

.en-big {
	font-size: 34px;
	font-weight: 800;
	color: #0e3b2e;
	line-height: 1.15;
	font-variant-numeric: tabular-nums;
}

.en-big small {
	font-size: 14px;
	font-weight: 700;
	color: #6b7c84;
}

.en-sub {
	font-size: 12.5px;
	color: #6b7c84;
	margin-top: 6px;
}

.en-break {
	margin-top: 10px;
	border-top: 1px dashed #e0e9ec;
	padding-top: 9px;
	font-size: 12.5px;
	color: #5b6b73;
}

.en-break div {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding: 2px 0;
}

.en-break b {
	color: #17202a;
	font-variant-numeric: tabular-nums;
}

/* ---------- التوصيات ---------- */

.en-advice ul {
	list-style: none;
}

.en-advice li {
	position: relative;
	padding: 6px 22px 6px 0;
	font-size: 14px;
	border-bottom: 1px solid #f0f5f6;
}

.en-advice li:last-child {
	border-bottom: 0;
}

.en-advice li::before {
	content: "◂";
	position: absolute;
	right: 4px;
	top: 6px;
	color: #f39c12;
	font-weight: 800;
}

/* ---------- تنبيه التزامن مع الماشية ---------- */

.en-note {
	background: #eefaf3;
	border: 1px solid #bfe3d2;
	color: #0e6b4f;
	border-radius: 12px;
	padding: 11px 14px;
	font-size: 13.5px;
	font-weight: 600;
}

/* ---------- حالات ---------- */

.en-msg {
	background: #fff7e6;
	border: 1px solid #f3d999;
	color: #7a5a12;
	border-radius: 12px;
	padding: 11px 14px;
	font-size: 13.5px;
	font-weight: 600;
}

.en-msg.err {
	background: #fdecea;
	border-color: #f5b7b1;
	color: #922b21;
}

.en-skel {
	background: linear-gradient(90deg, #eef3f5 25%, #f7fafb 50%, #eef3f5 75%);
	background-size: 200% 100%;
	animation: ensh 1.2s infinite;
	border-radius: 12px;
	height: 150px;
}

@keyframes ensh {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ---------- الهامش العلمي ---------- */

.en-refs {
	margin-top: 16px;
	font-size: 11.5px;
	color: #7c8c93;
	line-height: 1.85;
	background: #f6fafb;
	border: 1px solid #e9eff1;
	border-radius: 12px;
	padding: 11px 14px;
}

.en-refs b {
	color: #4a5a62;
}

.en-refs code {
	font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
	background: #eaf1f3;
	padding: 1px 5px;
	border-radius: 4px;
	direction: ltr;
	display: inline-block;
	font-size: 11px;
}

/* ---------- الخريطة ---------- */

.en-mapcard {
	margin-top: 14px;
}

.en-map {
	height: 400px;
	border-radius: 12px;
	overflow: hidden;
	direction: ltr;
	background: #eaf1f3;
	border: 1px solid #e0e9ec;
	position: relative;
	z-index: 0;
}

.en-map,
.en-map * {
	box-sizing: content-box;
}

.en-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	margin-top: 10px;
	font-size: 12.5px;
	color: #4a5a62;
}

.en-legend span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
}

.en-legend .ltr {
	display: inline-block;
	gap: 0;
}

.en-legend i {
	width: 13px;
	height: 13px;
	border-radius: 50%;
	display: inline-block;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px #c9d6da;
}

.en-mapsel {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 10px;
	background: #fffaf0;
	border: 1px solid #f2e4c4;
	border-radius: 12px;
	padding: 9px 12px;
	font-size: 13.5px;
	font-weight: 700;
	color: #0e3b2e;
}

.en-link {
	appearance: none;
	border: 1px solid #e67e22;
	background: #fff;
	color: #a1690a;
	border-radius: 999px;
	padding: 4px 12px;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
}

.en-link:hover {
	background: #e67e22;
	color: #fff;
}

/* بديل الخريطة إن تعذّر تحميل Leaflet: شبكة ولايات ملوّنة */
.en-chips {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 6px;
}

.en-chips button {
	appearance: none;
	border: 0;
	border-radius: 10px;
	padding: 7px 4px;
	color: #fff;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
	line-height: 1.35;
}

.en-chips button small {
	display: block;
	font-size: 10.5px;
	font-weight: 600;
	opacity: .95;
	direction: ltr;
}

.en-chips button[aria-pressed="true"] {
	box-shadow: 0 0 0 3px #17202a inset;
}

.en-map .leaflet-tooltip {
	font-family: "Cairo", "Tajawal", system-ui, sans-serif;
	font-weight: 700;
	direction: rtl;
}

@media (max-width: 560px) {
	.en-map { height: 330px; }
	.en-gauge .en-num { font-size: 42px; }
	.en-hours { height: 105px; }
	.en-hlabels span { font-size: 8.5px; }
	.en-scale div { font-size: 9px; }
	.en-root { font-size: 14.5px; }
}
