/**
 * ACC_LOCAL — Switcher Styles
 * acc-local-switcher.css
 *
 * نظام: ثيم (auto/light/dark) + لون تمييز متغيّر (--acc-primary من الإعدادات)
 * + 4 مواضع فيزيائية + شريط تذييل + أحجام زر + RTL سليم (موضع فيزيائي ثابت،
 * واتجاه المحتوى من سمة dir).
 */

/* ═══════════ متغيّرات الثيم ═══════════ */
.acc-local-switcher-root {
	--acc-bg: #ffffff;
	--acc-fg: #1f2330;
	--acc-muted: #6b7280;
	--acc-border: #e3e6ec;
	--acc-hover: #f4f5f8;
	--acc-primary: #2563eb;        /* يُستبدل inline من الإعدادات */
	--acc-primary-bg: rgba( 37, 99, 235, 0.12 );
	--acc-radius: 14px;
	--acc-shadow: 0 12px 40px rgba( 16, 24, 40, 0.16 );
	--acc-z: 99990;
	font-family: inherit;
	box-sizing: border-box;
}
.acc-local-switcher-root *,
.acc-local-switcher-root *::before,
.acc-local-switcher-root *::after { box-sizing: border-box; }

/* الوضع الداكن الصريح + التلقائي حسب النظام */
.acc-local-theme-dark {
	--acc-bg: #1b1f2a; --acc-fg: #e6e8ee; --acc-muted: #9aa1b0;
	--acc-border: #2c313d; --acc-hover: #242936;
	--acc-shadow: 0 12px 40px rgba( 0, 0, 0, 0.5 );
}
@media ( prefers-color-scheme: dark ) {
	.acc-local-theme-auto {
		--acc-bg: #1b1f2a; --acc-fg: #e6e8ee; --acc-muted: #9aa1b0;
		--acc-border: #2c313d; --acc-hover: #242936;
		--acc-shadow: 0 12px 40px rgba( 0, 0, 0, 0.5 );
	}
}

/* ═══════════ المواضع الفيزيائية (مستقلة عن اللغة) ═══════════ */
.acc-local-floating { position: fixed; z-index: var( --acc-z ); }
.acc-local-pos-bottom-right { bottom: 20px; right: 20px; }
.acc-local-pos-bottom-left  { bottom: 20px; left: 20px; }
.acc-local-pos-top-right    { top: 20px; right: 20px; }
.acc-local-pos-top-left     { top: 20px; left: 20px; }

/* شريط تذييل ممتد */
.acc-local-pos-footer-bar {
	position: fixed; inset-inline: 0; bottom: 0; top: auto;
	display: flex; justify-content: center;
	padding: 8px; background: var( --acc-bg );
	border-top: 1px solid var( --acc-border );
	box-shadow: 0 -2px 16px rgba( 16, 24, 40, 0.08 );
}

/* ═══════════ زر الـ Trigger ═══════════ */
.acc-local-locale-trigger {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 14px;
	border: 1px solid var( --acc-border );
	border-radius: 999px;
	background: var( --acc-bg );
	color: var( --acc-fg );
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba( 16, 24, 40, 0.10 );
	transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
	white-space: nowrap;
}
.acc-local-locale-trigger:hover { background: var( --acc-hover ); border-color: var( --acc-primary ); transform: translateY( -1px ); }
.acc-local-locale-trigger[aria-expanded="true"] { border-color: var( --acc-primary ); }
.acc-local-locale-trigger:focus-visible { outline: 2px solid var( --acc-primary ); outline-offset: 2px; }
.acc-local-trigger-globe,
.acc-local-trigger-flag { font-size: 17px; }
.acc-local-trigger-sep { color: var( --acc-muted ); }
.acc-local-trigger-symbol { color: var( --acc-muted ); margin-inline-start: 2px; }
.acc-local-trigger-chevron { color: var( --acc-muted ); font-size: 11px; }

/* أحجام */
.acc-local-size-small .acc-local-locale-trigger { padding: 6px 11px; font-size: 12px; }
.acc-local-size-large .acc-local-locale-trigger { padding: 12px 18px; font-size: 15px; }

/* ═══════════ الخلفية ═══════════ */
.acc-local-panel-backdrop {
	position: fixed; inset: 0;
	background: rgba( 15, 23, 42, 0.32 );
	backdrop-filter: blur( 1px );
	z-index: calc( var( --acc-z ) - 1 );
}

/* ═══════════ اللوحة ═══════════ */
.acc-local-locale-panel {
	position: absolute;
	width: 380px;
	max-width: calc( 100vw - 24px );
	max-height: min( 72vh, 600px );
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var( --acc-bg );
	color: var( --acc-fg );
	border: 1px solid var( --acc-border );
	border-radius: var( --acc-radius );
	box-shadow: var( --acc-shadow );
	z-index: var( --acc-z );
	animation: acc-local-in 0.18s ease both;
}
/* محاذاة اللوحة للزاوية الفيزيائية الصحيحة */
.acc-local-pos-bottom-right .acc-local-locale-panel { bottom: calc( 100% + 10px ); right: 0; }
.acc-local-pos-bottom-left  .acc-local-locale-panel { bottom: calc( 100% + 10px ); left: 0; }
.acc-local-pos-top-right    .acc-local-locale-panel { top: calc( 100% + 10px ); right: 0; }
.acc-local-pos-top-left     .acc-local-locale-panel { top: calc( 100% + 10px ); left: 0; }
.acc-local-pos-footer-bar   .acc-local-locale-panel { bottom: calc( 100% + 10px ); left: 50%; transform: translateX( -50% ); }
/* مضمّن (shortcode/nav): يفتح للأسفل */
.acc-local-switcher-root:not( .acc-local-floating ) .acc-local-locale-panel { top: calc( 100% + 8px ); inset-inline-end: 0; }

.acc-local-panel-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var( --acc-border );
	font-size: 14px;
}
.acc-local-panel-close {
	border: 0; background: transparent; color: var( --acc-muted );
	font-size: 16px; cursor: pointer; line-height: 1; padding: 4px; border-radius: 6px;
}
.acc-local-panel-close:hover { background: var( --acc-hover ); }

/* التبويبات */
.acc-local-tabs {
	display: flex; gap: 2px; padding: 0 8px;
	border-bottom: 1px solid var( --acc-border );
}
.acc-local-tab {
	flex: 1; border: 0; background: transparent; color: var( --acc-muted );
	font-size: 13px; font-weight: 600; padding: 11px 6px; cursor: pointer;
	border-bottom: 2px solid transparent;
}
.acc-local-tab:hover { color: var( --acc-fg ); }
.acc-local-tab--active,
.acc-local-tab[aria-selected="true"] { color: var( --acc-primary ); border-bottom-color: var( --acc-primary ); }

.acc-local-panel-body { overflow-y: auto; padding: 10px; }

.acc-local-search {
	position: sticky; inset-block-start: 0; z-index: 2;
	width: 100%; padding: 10px 12px; margin-block-end: 8px;
	border: 1px solid var( --acc-border ); border-radius: 9px;
	background: var( --acc-bg ); color: var( --acc-fg ); font-size: 13px;
}
.acc-local-search:focus-visible { outline: 2px solid var( --acc-primary ); outline-offset: 1px; }

.acc-local-section { margin-block-end: 6px; }
.acc-local-section-title {
	font-size: 11px; font-weight: 700; text-transform: uppercase;
	letter-spacing: 0.04em; color: var( --acc-muted ); padding: 8px 6px 4px;
}
.acc-local-alpha-head {
	position: sticky; inset-block-start: 42px;
	background: var( --acc-bg ); font-size: 12px; font-weight: 800;
	color: var( --acc-primary ); padding: 4px 8px;
	border-bottom: 1px solid var( --acc-border );
}
.acc-local-empty { text-align: center; color: var( --acc-muted ); font-size: 13px; padding: 18px; }

.acc-local-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-local-opt {
	display: flex; align-items: center; gap: 10px; width: 100%;
	border: 1px solid transparent; background: transparent; color: var( --acc-fg );
	padding: 10px; border-radius: 9px; cursor: pointer; font-size: 13px; text-align: start;
}
.acc-local-opt:hover { background: var( --acc-hover ); }
.acc-local-opt.acc-local-selected {
	background: var( --acc-primary-bg ); border-color: var( --acc-primary ); font-weight: 700;
}
.acc-local-opt-flag, .acc-local-opt-symbol { font-size: 17px; min-width: 24px; text-align: center; }
.acc-local-opt-name, .acc-local-country-name { flex: 1; }
.acc-local-opt-meta { color: var( --acc-muted ); font-size: 12px; font-weight: 600; }

.acc-local-panel-foot {
	display: flex; align-items: center; justify-content: space-between;
	padding: 11px 14px; border-top: 1px solid var( --acc-border );
	font-size: 12px; color: var( --acc-muted );
}
.acc-local-undo-btn {
	border: 1px solid var( --acc-primary ); background: var( --acc-primary-bg );
	color: var( --acc-primary ); font-weight: 700; font-size: 12px;
	padding: 7px 12px; border-radius: 9px; cursor: pointer;
}

/* ═══════════ Geo Banner ═══════════ */
.acc-local-geo-banner {
	position: fixed; bottom: 0; inset-inline: 0;
	z-index: calc( var( --acc-z ) + 1 );
	background: #111827; color: #f9fafb;
	box-shadow: 0 -4px 24px rgba( 0, 0, 0, 0.25 );
	animation: acc-local-up 0.25s ease both;
}
.acc-local-geo-banner__inner {
	max-width: 980px; margin: 0 auto;
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
	gap: 12px; padding: 13px 18px;
}
.acc-local-geo-banner__info { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.acc-local-geo-flag { font-size: 20px; }
.acc-local-geo-banner__actions { display: flex; gap: 8px; }
.acc-local-geo-banner__accept {
	border: 0; background: var( --acc-primary, #2563eb ); color: #fff; font-weight: 700;
	font-size: 13px; padding: 9px 16px; border-radius: 9px; cursor: pointer;
}
.acc-local-geo-banner__dismiss {
	border: 1px solid rgba( 255, 255, 255, 0.3 ); background: transparent; color: #f9fafb;
	font-size: 13px; padding: 9px 14px; border-radius: 9px; cursor: pointer;
}
.acc-local-geo-banner__progress {
	position: absolute; bottom: 0; inset-inline: 0; height: 3px;
	background: var( --acc-primary, #2563eb ); transform-origin: left;
	animation: acc-local-progress 15s linear forwards;
}

/* ═══════════ الموبايل: صفيحة سفلية ═══════════ */
@media ( max-width: 640px ) {
	.acc-local-floating .acc-local-locale-panel,
	.acc-local-pos-footer-bar .acc-local-locale-panel {
		position: fixed; inset: auto 0 0 0; left: 0; right: 0; top: auto;
		transform: none; width: 100%; max-width: 100%;
		border-radius: var( --acc-radius ) var( --acc-radius ) 0 0; max-height: 84vh;
		animation: acc-local-up 0.2s ease both;
	}
}

/* ═══════════ حركات ═══════════ */
@keyframes acc-local-in { from { opacity: 0; transform: translateY( 8px ) scale( 0.98 ); } to { opacity: 1; transform: translateY( 0 ) scale( 1 ); } }
@keyframes acc-local-up { from { transform: translateY( 100% ); } to { transform: translateY( 0 ); } }
@keyframes acc-local-progress { from { transform: scaleX( 1 ); } to { transform: scaleX( 0 ); } }

@media ( prefers-reduced-motion: reduce ) {
	.acc-local-locale-panel, .acc-local-geo-banner { animation: none; }
	.acc-local-geo-banner__progress { animation-duration: 15s; }
}
