/* =========================================================
   Market Prices - Frontend Styles (RTL by default)
   تصميم مودرن بشكل بطاقة (Card)، محمي بقوة من أي تنسيقات
   عامة يفرضها قالب الموقع على عناصر <table>/<th>/<td>.
   ========================================================= */

.mp-widget {
	--mp-bg: #ffffff;
	--mp-surface: #f8f9fb;
	--mp-text: #16181d;
	--mp-heading: #0f1115;
	--mp-border: rgba(15, 23, 42, 0.08);
	--mp-muted: rgba(15, 23, 42, 0.55);
	--mp-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 28px -8px rgba(16, 24, 40, 0.12);

	/* ألوان الهوية البصرية (اللوجو) - مستخرجة مباشرة من ملف اللوجو */
	--mp-brand-navy: #012452;
	--mp-brand-navy-2: #064395;
	--mp-brand-green: #09641d;
	--mp-brand-green-2: #12cb3b;

	--mp-up: #0aaa2d;
	--mp-up-bg: rgba(10, 170, 45, 0.1);
	--mp-down: #dc2626;
	--mp-down-bg: rgba(220, 38, 38, 0.1);
	--mp-flat: #6b7280;
	--mp-flat-bg: rgba(107, 114, 128, 0.1);
	--mp-accent-gold-1: #f4c95d;
	--mp-accent-gold-2: #c8860a;

	position: relative;
	background: var(--mp-bg);
	color: var(--mp-text) !important;
	border: 1px solid var(--mp-border);
	border-radius: 18px;
	padding: 22px;
	box-sizing: border-box;
	box-shadow: var(--mp-shadow);
	direction: rtl;
	text-align: right;
	font-size: 14px;
	line-height: 1.6;
	overflow: hidden;
	isolation: isolate;
}

.mp-widget::before {
	content: '';
	position: absolute;
	inset: 0 0 auto 0;
	height: 4px;
	background: linear-gradient(90deg, var(--mp-brand-navy), var(--mp-brand-green));
}

.mp-widget.mp-style-dark {
	--mp-bg: #12141a;
	--mp-surface: #191c24;
	--mp-text: #e9ecf2;
	--mp-heading: #ffffff;
	--mp-border: rgba(255, 255, 255, 0.08);
	--mp-muted: rgba(255, 255, 255, 0.58);
	--mp-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 16px 32px -12px rgba(0, 0, 0, 0.55);
	--mp-up-bg: rgba(18, 203, 59, 0.16);
	--mp-down-bg: rgba(248, 113, 113, 0.16);
}

.mp-widget,
.mp-widget * {
	box-sizing: border-box;
}

/* ---------------------------------------------------------
   الأقسام (Sections)
   --------------------------------------------------------- */

.mp-sections {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
	align-items: start;
	gap: 20px;
	position: relative;
	z-index: 1;
}

.mp-layout-ticker .mp-sections {
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 16px;
}

.mp-section {
	background: var(--mp-surface);
	border: 1px solid var(--mp-border);
	border-radius: 14px;
	padding: 16px 14px;
	position: relative;
	overflow: hidden;
}

.mp-layout-ticker .mp-section {
	padding: 14px 12px;
}

.mp-section-title {
	font-size: 14.5px;
	font-weight: 800;
	color: var(--mp-heading) !important;
	margin: 0 0 14px;
	display: flex;
	align-items: center;
	gap: 10px;
	letter-spacing: 0.2px;
}

.mp-icon {
	font-size: 15px;
	line-height: 1;
	width: 30px;
	height: 30px;
	flex: 0 0 30px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	color: #fff;
	box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.25);
}

.mp-section-gold .mp-icon {
	background: linear-gradient(135deg, var(--mp-accent-gold-1), var(--mp-accent-gold-2));
}

.mp-section-currency .mp-icon {
	background: linear-gradient(135deg, var(--mp-brand-navy-2), var(--mp-brand-navy));
}

.mp-section-oil .mp-icon {
	background: linear-gradient(135deg, var(--mp-brand-green-2), var(--mp-brand-green));
}

/* ---------------------------------------------------------
   صفوف الشريط المختصر (Ticker rows)
   --------------------------------------------------------- */

.mp-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 10px;
	margin-bottom: 4px;
	border-radius: 10px;
	background: var(--mp-bg);
	transition: background-color 0.15s ease;
}

.mp-row:hover {
	background: var(--mp-border);
}

.mp-row:last-child {
	margin-bottom: 0;
}

.mp-label {
	color: var(--mp-muted) !important;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.mp-value {
	font-weight: 800;
	color: var(--mp-heading) !important;
	font-variant-numeric: tabular-nums;
	direction: ltr;
	unicode-bidi: plaintext;
}

.mp-row-highlight {
	background: linear-gradient(135deg, rgba(212, 160, 23, 0.14), rgba(212, 160, 23, 0.03));
	border: 1px solid rgba(212, 160, 23, 0.25);
}

.mp-row-highlight .mp-value {
	font-size: 21px;
	font-weight: 900;
}

/* ---------------------------------------------------------
   شارة نسبة التغيّر (Change badge)
   --------------------------------------------------------- */

.mp-change {
	font-size: 11.5px;
	font-weight: 800;
	border-radius: 999px;
	padding: 3px 9px;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 3px;
	direction: ltr;
}

.mp-change-inline {
	display: inline-flex;
	margin-top: 8px;
}

.mp-change.mp-up {
	color: var(--mp-up) !important;
	background: var(--mp-up-bg) !important;
}

.mp-change.mp-down {
	color: var(--mp-down) !important;
	background: var(--mp-down-bg) !important;
}

.mp-change.mp-flat {
	color: var(--mp-flat) !important;
	background: var(--mp-flat-bg) !important;
}

.mp-change-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
	flex-wrap: wrap;
}

.mp-change-type-label {
	font-size: 11px;
	color: var(--mp-muted) !important;
	margin: 8px 0 0;
}

.mp-calc-tag {
	font-size: 10px;
	font-weight: 600;
	color: var(--mp-muted) !important;
	background: var(--mp-border) !important;
	border-radius: 999px;
	padding: 1px 7px;
	margin-inline-start: 4px;
}

/* ---------------------------------------------------------
   الجداول (Table layout) - محمية بقوة من تنسيقات القالب العامة
   --------------------------------------------------------- */

.mp-widget .mp-table {
	width: 100% !important;
	border-collapse: separate !important;
	border-spacing: 0 !important;
	font-size: 14px !important;
	background: transparent !important;
	margin: 0 !important;
}

.mp-widget .mp-table thead tr {
	background: transparent !important;
}

.mp-widget .mp-table th {
	background: transparent !important;
	color: var(--mp-muted) !important;
	font-weight: 700 !important;
	font-size: 11.5px !important;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	text-align: right !important;
	padding: 0 10px 10px !important;
	border: none !important;
	border-bottom: 1px solid var(--mp-border) !important;
}

.mp-widget .mp-table td {
	background: transparent !important;
	color: var(--mp-text) !important;
	border: none !important;
	border-bottom: 1px solid var(--mp-border) !important;
	padding: 12px 10px !important;
	font-weight: 500;
}

.mp-widget .mp-table tbody tr {
	background: transparent !important;
	transition: background-color 0.15s ease;
}

.mp-widget .mp-table tbody tr:hover {
	background: var(--mp-bg) !important;
}

.mp-widget .mp-table tbody tr:last-child td {
	border-bottom: none !important;
}

.mp-widget .mp-table td:first-child {
	color: var(--mp-text) !important;
	font-weight: 600;
}

.mp-widget .mp-table th:last-child,
.mp-widget .mp-table td:last-child {
	text-align: left !important;
}

.mp-num {
	font-variant-numeric: tabular-nums;
	direction: ltr;
	unicode-bidi: plaintext;
	font-weight: 800 !important;
	color: var(--mp-heading) !important;
}

/* ---------------------------------------------------------
   الرسم البياني (Chart panel)
   --------------------------------------------------------- */

.mp-chart-panel {
	background: var(--mp-bg);
	border: 1px solid var(--mp-border);
	border-radius: 14px;
	padding: 16px 14px 8px;
	margin-top: 14px;
}

.mp-chart {
	width: 100% !important;
	max-width: 100%;
	display: block;
}

.mp-chart-empty,
.mp-chart-note {
	font-size: 12px;
	color: var(--mp-muted) !important;
	margin: 4px 0;
	text-align: center;
}

/* ---------------------------------------------------------
   نصوص مساعدة (Disclaimer / empty state)
   --------------------------------------------------------- */

.mp-disclaimer {
	font-size: 11px;
	color: var(--mp-muted) !important;
	margin: 10px 0 0;
	line-height: 1.5;
}

.mp-empty {
	font-size: 13px;
	color: var(--mp-muted) !important;
	margin: 4px 0;
	padding: 10px;
	background: var(--mp-bg);
	border-radius: 10px;
}

/* ---------------------------------------------------------
   تذييل "آخر تحديث" مع نقطة "مباشر" نابضة
   --------------------------------------------------------- */

.mp-last-updated {
	font-size: 12px;
	color: var(--mp-muted) !important;
	margin-top: 18px;
	padding-top: 14px;
	border-top: 1px solid var(--mp-border);
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
}

.mp-last-updated::before {
	content: '';
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--mp-up);
	box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
	animation: mp-pulse 2s infinite;
	flex: 0 0 auto;
}

@keyframes mp-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
	}
	70% {
		box-shadow: 0 0 0 7px rgba(22, 163, 74, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.mp-last-updated::before {
		animation: none;
	}
}

@media (max-width: 767px) {
	.mp-widget {
		padding: 16px;
		border-radius: 14px;
	}
	.mp-sections,
	.mp-layout-ticker .mp-sections {
		grid-template-columns: 1fr;
	}
}

/* =========================================================
   Admin Settings Page Styles
   ========================================================= */

.mp-settings-wrap .mp-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 16px 0;
	flex-wrap: wrap;
}

.mp-status-grid {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-inline-start: auto;
}

.mp-status-card {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 8px 14px;
	font-size: 13px;
	min-width: 160px;
}

.mp-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	margin-top: 4px;
}

.mp-badge-warning {
	background: #fff3cd;
	color: #7a5b00;
}

.mp-badge-error {
	background: #fde8e8;
	color: #a10000;
}

.mp-badge-muted {
	background: #eee;
	color: #666;
}

.mp-source-note {
	font-size: 11px;
	opacity: 0.7;
}

.mp-error-log {
	font-size: 11px;
	margin-top: 4px;
}

.ltr-input {
	direction: ltr;
	text-align: left;
}

.mp-quota-hint {
	opacity: 0.7;
	font-size: 12px;
	margin-inline-start: 8px;
}

.mp-test-result {
	margin-inline-start: 8px;
	font-size: 12px;
}

.mp-inline-result {
	font-size: 13px;
}

.mp-plugin-credit {
	margin-top: 24px;
	padding-top: 12px;
	border-top: 1px solid #dcdcde;
	font-size: 12px;
	opacity: 0.75;
	text-align: center;
}

.mp-plugin-credit a {
	text-decoration: none;
	font-weight: 600;
}
