/* Fasalat Simple Order – Mobile-first, RTL */

.fso-app,
.fso-app * {
	box-sizing: border-box;
}

.fso-app [hidden] {
	display: none !important;
}

.fso-app {
	--fso-primary: #6B1E2E;
	--fso-primary-dark: #511623;
	--fso-bg: #F7F3ED;
	--fso-text: #171717;
	--fso-border: #E5DDD3;

	direction: rtl;
	text-align: right;
	max-width: 720px;
	margin: 0 auto;
	padding-bottom: 88px;
	background: var(--fso-bg);
	color: var(--fso-text);
	min-height: 100vh;
	font-size: 16px;
	line-height: 1.5;
}

.fso-app button,
.fso-app input,
.fso-app textarea {
	font-family: inherit;
	font-size: 16px; /* يمنع تكبير الصفحة تلقائياً في iOS */
}

/* ---------- القائمة المنسدلة للتصنيفات ---------- */
#fso-app .fso-cats {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
#fso-app .fso-category-label {
	flex: 0 0 auto;
	font-size: 14px;
	font-weight: 700;
	white-space: nowrap;
	color: var(--fso-text);
}
#fso-app .fso-category-select-wrap {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
}
#fso-app .fso-category-select {
	appearance: none;
	-webkit-appearance: none;
	display: block;
	width: 100%;
	min-height: 45px;
	margin: 0;
	padding: 9px 15px 9px 38px;
	border: 1px solid var(--fso-border);
	border-radius: 12px;
	background: #FFFDFA;
	color: var(--fso-primary);
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.5;
	direction: rtl;
	text-align: right;
	cursor: pointer;
}
#fso-app .fso-category-chevron {
	position: absolute;
	left: 15px;
	top: 50%;
	width: 9px;
	height: 9px;
	border-left: 2px solid var(--fso-primary);
	border-bottom: 2px solid var(--fso-primary);
	transform: translateY(-70%) rotate(-45deg);
	pointer-events: none;
}
#fso-app .fso-category-select:focus-visible {
	outline: 2px solid var(--fso-primary);
	outline-offset: 2px;
}

/* ---------- معرض الصور ---------- */
.fso-grid {
	display: grid;
	grid-template-columns: 1fr 1fr; /* صورتان في كل سطر */
	gap: 8px;
	padding: 8px;
}

.fso-card {
	position: relative;
	display: flow-root;
	align-self: start; /* كل بطاقة بطول صورتها فقط، بدون تمدد لارتفاع الجارة */
	min-height: 170px; /* يمنع تحميل كل الصور دفعة واحدة قبل ظهورها */
	overflow: hidden;
	border-radius: 14px;
	background: #E5DDD3;
	line-height: 0;
}

.fso-card img {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	min-height: 0 !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	vertical-align: top;
	cursor: zoom-in;
}

/* زر طلب – أعلى اليسار (يستخدم في المعرض وفي المقالات) */
.fso-req {
	position: absolute;
	top: 10px;
	left: 10px;
	right: auto;
	z-index: 5;
	display: inline-block;
	padding: 6px 16px;
	border: 0;
	border-radius: 999px;
	background: var(--fso-primary, #6B1E2E);
	color: #fff;
	font-size: 14px !important;
	font-weight: 700;
	line-height: 1.4;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
	-webkit-tap-highlight-color: transparent;
}

.fso-req:active {
	background: var(--fso-primary-dark, #511623);
}

.fso-card .fso-req {
	top: 6px;
	left: 6px;
	padding: 4px 12px;
	font-size: 13px !important;
}

.fso-empty {
	padding: 24px 12px;
	text-align: center;
	color: #655D58;
}

.fso-more-wrap {
	padding: 4px 12px 16px;
	text-align: center;
}

.fso-more {
	padding: 12px 32px;
	border: 1px solid var(--fso-primary);
	border-radius: 999px;
	background: #fff;
	color: var(--fso-primary);
	font-weight: 700;
	cursor: pointer;
}

/* ---------- نموذج الطلب ---------- */
.fso-form {
	padding: 16px 14px 24px;
}

.fso-title {
	margin: 0 0 14px;
	font-size: 20px;
	text-align: center;
}

.fso-pick {
	margin-bottom: 16px;
}

.fso-preview {
	text-align: center;
}

.fso-preview img {
	display: block;
	width: 100%;
	max-height: 420px;
	margin: 0 auto 10px;
	object-fit: contain;
	border-radius: 14px;
	background: #E5DDD3;
}

.fso-change {
	padding: 10px 16px;
	border: 1px solid var(--fso-primary);
	border-radius: 10px;
	background: #fff;
	color: var(--fso-primary);
	font-size: 14px !important;
	font-weight: 700;
	cursor: pointer;
}

.fso-dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 36px 16px;
	border: 2px dashed var(--fso-primary);
	border-radius: 14px;
	background: #fff;
	color: var(--fso-primary);
	font-weight: 700;
	text-align: center;
	cursor: pointer;
}

.fso-dz-icon {
	font-size: 36px;
	line-height: 1;
}

.fso-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.fso-field {
	display: block;
	margin-bottom: 14px;
}

.fso-field > span {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 700;
}

.fso-field input,
.fso-field textarea {
	display: block;
	width: 100%;
	padding: 12px;
	border: 1px solid var(--fso-border);
	border-radius: 10px;
	background: #fff;
	color: var(--fso-text);
	direction: rtl;
	text-align: right;
}

.fso-field input:focus,
.fso-field textarea:focus {
	outline: 2px solid var(--fso-primary);
	outline-offset: 0;
	border-color: transparent;
}

.fso-msg {
	margin: 0 0 12px;
	padding: 10px 12px;
	border-radius: 10px;
	background: #fee2e2;
	color: #991b1b;
	font-size: 14px;
}

.fso-send {
	display: block;
	width: 100%;
	padding: 16px;
	border: 0;
	border-radius: 12px;
	background: #6B1E2E;
	color: #fff;
	font-size: 18px !important;
	font-weight: 700;
	cursor: pointer;
}

.fso-send:disabled {
	opacity: .65;
	cursor: wait;
}

/* ---------- الشريط السفلي الثابت ---------- */
.fso-bottom {
	position: fixed;
	right: 0;
	left: 0;
	bottom: 0;
	z-index: 9999;
	display: flex; /* الاتجاه RTL: أول زر (الرئيسية) على اليمين */
	max-width: 720px;
	margin: 0 auto;
	padding-bottom: env(safe-area-inset-bottom, 0);
	background: #fff;
	border-top: 1px solid var(--fso-border);
	box-shadow: 0 -2px 10px rgba(0, 0, 0, .08);
}

.fso-nav-btn {
	flex: 1 1 50%;
	padding: 16px 8px;
	border: 0;
	background: #fff;
	color: #655D58;
	font-size: 17px !important;
	font-weight: 700;
	cursor: pointer;
}

.fso-nav-btn + .fso-nav-btn {
	border-right: 1px solid var(--fso-border);
}

.fso-nav-btn.is-active {
	background: var(--fso-primary);
	color: #fff;
}

/* ---------- زر طلب داخل المقالات ---------- */
.fso-wrap {
	position: relative;
	display: inline-block;
	max-width: 100%;
	line-height: 0;
	vertical-align: top;
}

.fso-wrap img {
	max-width: 100%;
	height: auto;
}

.fso-wrap .fso-req {
	--fso-primary: #6B1E2E;
	--fso-primary-dark: #511623;
	font-family: inherit;
}

/* ---------- نافذة تكبير الصورة ---------- */
.fso-lb {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 10001;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	background: rgba(0, 0, 0, .94);
	touch-action: pan-x pan-y pinch-zoom;
}

.fso-lb-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100%;
	padding: 56px 8px 90px;
}

.fso-lb-inner img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0;
	border-radius: 6px;
}

.fso-lb-close {
	position: fixed;
	top: 10px;
	right: 10px;
	z-index: 2;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .2);
	color: #fff;
	font-size: 30px !important;
	line-height: 42px;
	cursor: pointer;
}

.fso-lb-order {
	position: fixed;
	right: 16px;
	left: 16px;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 2;
	max-width: 420px;
	margin: 0 auto;
	padding: 14px;
	border: 0;
	border-radius: 12px;
	background: #6B1E2E;
	color: #fff;
	font-size: 17px !important;
	font-weight: 700;
	cursor: pointer;
}

/* Fasalat 1.1: calm ivory surfaces, charcoal navigation, burgundy accents. */
.fso-app .fso-cats,
.fso-app .fso-bottom { background: #F7F3ED; }
.fso-app .fso-nav-btn { background: transparent; color: #655D58; }
.fso-app .fso-nav-btn.is-active { background: #171717; color: #F7F3ED; }
.fso-app .fso-title { color: #171717; }
.fso-app .fso-field { margin: 0 0 18px; min-width: 0; }
.fso-app .fso-field input,
.fso-app .fso-field textarea { box-sizing: border-box; max-width: 100%; min-height: 48px; margin: 0; }
.fso-app .fso-dropzone { border-color: #CDB8B6; background: #FFFDFA; }
.fso-app .fso-send:hover { background: #511623; }
.fso-app .fso-order-note { margin: 12px 0 0; color: #655D58; font-size: 14px; line-height: 1.9; text-align: center; }
.fso-app .fso-faq { padding: 0 14px 28px; }
.fso-app .fso-faq h2 { margin: 0 0 14px; color: #171717; font-size: 20px; }
.fso-app .fso-faq-item { margin: 0 0 10px; border: 1px solid #E5DDD3; border-radius: 12px; background: #FFFDFA; overflow: hidden; }
.fso-app .fso-faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 14px 16px; color: #171717; font-weight: 700; line-height: 1.7; cursor: pointer; list-style: none; overflow-wrap: anywhere; }
.fso-app .fso-faq-item summary::-webkit-details-marker { display: none; }
.fso-app .fso-faq-item summary::after { content: '+'; flex-shrink: 0; color: #6B1E2E; font-size: 23px; font-weight: 400; }
.fso-app .fso-faq-item[open] summary::after { content: '−'; }
.fso-app .fso-faq-item[open] summary { color: #6B1E2E; }
.fso-app .fso-faq-answer { padding: 0 16px 16px; color: #655D58; font-size: 15px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.fso-app button:focus-visible,
.fso-app summary:focus-visible,
.fso-wrap .fso-req:focus-visible { outline: 2px solid #6B1E2E; outline-offset: 3px; }

/* 1.1.1: scoped layout overrides keep theme form rules from stacking measures. */
#fso-app .fso-form .fso-row { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 12px; width: 100%; margin: 20px 0 8px; padding: 0; }
#fso-app .fso-form .fso-row > .fso-field { display: block !important; width: auto !important; float: none !important; clear: none !important; min-width: 0; margin: 0 0 16px !important; padding: 0; grid-column: auto !important; }
#fso-app .fso-row input { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
#fso-app .fso-measure-label { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
#fso-app .fso-icon { display: inline-block; width: 20px; height: 20px; flex: 0 0 20px; vertical-align: middle; }
#fso-app .fso-measure-label .fso-icon { color: #6B1E2E; }
#fso-app .fso-send { display: flex; align-items: center; justify-content: center; gap: 9px; line-height: 1.6; }
#fso-app .fso-wa-icon { width: 22px; height: 22px; flex-basis: 22px; }
#fso-app .fso-bottom { display: flex; align-items: center; gap: 10px; padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px)); box-sizing: border-box; }
#fso-app .fso-nav-btn { min-height: 48px; border: 0; border-radius: 12px; padding: 12px 8px; margin: 0; }
#fso-app .fso-nav-btn[data-tab="order"] { background: #6B1E2E; color: #fff; border: 2px solid #6B1E2E; font-weight: 800; box-shadow: 0 4px 10px rgba(107,30,46,.22); }
#fso-app .fso-nav-btn[data-tab="order"].is-active { background: #511623; border-color: #511623; box-shadow: inset 0 0 0 2px #F7F3ED, 0 4px 10px rgba(107,30,46,.18); }
#fso-app .fso-nav-btn[data-tab="order"]:hover { background: #511623; }

/* Isolated measurement layout: no shared .row/.field theme classes. */
#fso-app #fso-measurements { display:flex!important; flex-direction:row!important; flex-wrap:nowrap!important; align-items:flex-start!important; gap:12px!important; width:100%!important; margin:20px 0!important; padding:0!important; }
#fso-app #fso-measurements > .fso-measure-cell { display:block!important; flex:1 1 0!important; width:0!important; min-width:0!important; margin:0!important; padding:0!important; float:none!important; clear:none!important; }
#fso-app #fso-measurements > br, #fso-app #fso-measurements > p { display:none!important; }
#fso-app #fso-measurements label { display:flex!important; align-items:center!important; gap:6px!important; width:100%!important; margin:0 0 8px!important; padding:0!important; float:none!important; line-height:1.7!important; }
#fso-app #fso-measurements input { display:block!important; width:100%!important; max-width:100%!important; min-width:0!important; height:48px!important; margin:0!important; padding:10px!important; box-sizing:border-box!important; border:1px solid #E5DDD3; border-radius:10px; text-align:right; }
#fso-app .fso-send-label { color:inherit!important; background:transparent!important; margin:0!important; padding:0!important; }
#fso-app .fso-custom-icon { display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; line-height:1; }

/* ---------- رابط خاص لكل فصال (1.3.0) ---------- */
.fso-design-tools[hidden] { display: none !important; }
.fso-design-tools {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 9px;
	flex-wrap: wrap;
	padding: 8px 12px 3px;
}
.fso-design-tools > span {
	font-size: 12px;
	font-weight: 700;
	color: var(--fso-text, #171717);
}
.fso-design-copy {
	padding: 7px 12px;
	border: 1px solid var(--fso-primary, #6B1E2E);
	border-radius: 10px;
	background: #fff;
	color: var(--fso-primary, #6B1E2E);
	font-size: 13px !important;
	font-weight: 700;
	cursor: pointer;
}
.fso-design-copy:focus-visible {
	outline: 2px solid var(--fso-primary, #6B1E2E);
	outline-offset: 2px;
}

/* v1.3.2: Keep model deep links working while hiding the customer-facing copy-link/ID row. */
#fso-app #fso-design-tools { display: none !important; }

/* 1.4: three tabs, local favorites and controls only inside the lightbox. */
#fso-app .fso-nav-btn { flex: 1 1 0; min-width: 0; font-size: 15px !important; }
#fso-app .fso-saved-title { padding: 22px 12px 0; }
#fso-app .fso-saved-note { padding: 0 18px; text-align: center; font-size: 13px; color: #655D58; line-height: 1.8; }
#fso-saved-count { display: inline-block; min-width: 19px; padding: 0 4px; border-radius: 20px; font-size: 11px; background: rgba(127,127,127,.16); }
#fso-app .fso-lb-frame { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
#fso-app .fso-lb-frame > img { display: block; width: auto; max-width: 100%; max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); object-fit: contain; margin: 0 auto; }
#fso-app .fso-lb-actions { position: absolute; top: 10px; left: 10px; right: auto; display: flex; direction: ltr; gap: 8px; z-index: 3; }
#fso-app .fso-image-action { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; min-width: 46px; padding: 10px; margin: 0; background: #fffdfa; color: #6B1E2E; border: 1px solid #e5ddd3; box-shadow: 0 2px 9px #0004; cursor: pointer; }
#fso-app .fso-image-action { border-radius: 12px; }
#fso-app .fso-image-action svg { display: block; width: 24px; height: 24px; flex-shrink: 0; }
#fso-app .fso-social-mark svg { display: block; width: 24px; height: 24px; }
#fso-app .fso-image-action[aria-pressed="true"] { background: #6B1E2E; border-color: #6B1E2E; color: #fff; }
#fso-app .fso-image-action[aria-pressed="true"] svg { fill: currentColor; }
#fso-app .fso-toast { position: fixed; z-index: 10010; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; color: #fff; background: #171717; box-shadow: 0 4px 18px #0004; line-height: 1.7; text-align: center; font-size: 14px; pointer-events: none; }
#fso-app .fso-share-panel { position: fixed; inset: 0; z-index: 5; display: flex; justify-content: center; align-items: flex-end; background: #0009; padding: 12px; }
#fso-app .fso-share-sheet { width: 100%; max-width: 480px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; background: #F7F3ED; color: #171717; border-radius: 20px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 4px 30px #0005; line-height: 1.6; }
#fso-app .fso-share-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#fso-app .fso-share-heading h3 { margin: 0; font-size: 20px; color: #171717; }
#fso-app #fso-share-close { width: 44px; height: 44px; padding: 0; border: 0; color: #171717; background: #e5ddd3; font-size: 28px; cursor: pointer; }
#fso-app .fso-share-note { color: #655D58; font-size: 13px; margin: 12px 0; line-height: 1.8; }
#fso-app .fso-share-options { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
#fso-app .fso-share-options > * { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; min-width: 0; padding: 12px 3px; margin: 0; background: #fffdfa; border: 1px solid #e5ddd3; border-radius: 12px; text-decoration: none; color: #171717; cursor: pointer; font-size: 14px; line-height: 1.5; text-align: center; }
#fso-app .fso-share-options small { font-size: 10px; color: #655D58; }
#fso-app .fso-social-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-family: Arial,sans-serif; font-weight: bold; color: white; font-size: 23px; }
#fso-app .fso-tg { background: #1689bc; } #fso-app .fso-wa { background: #168344; } #fso-app .fso-ms { background: #6750db; } #fso-app .fso-pin { background: #bd081c; } #fso-app .fso-fb { background: #1764c0; } #fso-app .fso-x { background: #171717; }
#fso-app .fso-share-extras { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 14px; }
#fso-app .fso-share-extras > * { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 8px; margin: 0; border: 1px solid #6B1E2E; border-radius: 12px; color: #6B1E2E; background: #fffdfa; cursor: pointer; font-size: 13px; text-align: center; text-decoration: none; line-height: 1.6; }
#fso-app .fso-share-extras button:disabled { opacity: .55; cursor: default; }
#fso-app button:focus-visible, #fso-app a:focus-visible, #fso-app img[role="button"]:focus-visible { outline: 3px solid #a76d7a; outline-offset: 2px; }
@media(max-width:360px) { #fso-app .fso-bottom { gap: 6px; padding-left: 8px; padding-right: 8px; } #fso-app .fso-nav-btn { font-size: 13px !important; } }

/* 1.5: saved filters and a contact-free fallback sheet, scoped against theme rules. */
#fso-app .fso-saved-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 8px 12px 16px; }
#fso-app .fso-saved-filters label { display: block; margin: 0; min-width: 0; font-size: 14px; font-weight: 700; }
#fso-app .fso-saved-filters select { display: block; width: 100%; min-width: 0; min-height: 46px; margin: 6px 0 0; padding: 8px; border: 1px solid #d6c8c2; border-radius: 12px; color: #6B1E2E; background: #fffdfa; font-family: inherit; font-size: 14px; }
#fso-app .fso-share-panel { padding: 0; }
#fso-app .fso-share-sheet { background: #373737; color: #fff; border-radius: 26px 26px 0 0; max-height: 88vh; max-height: 88dvh; padding: 12px 20px calc(24px + env(safe-area-inset-bottom,0px)); }
#fso-app .fso-share-handle { width: 36px; height: 4px; border-radius: 4px; background: #727272; margin: 2px auto 12px; }
#fso-app .fso-share-heading h3 { color: #fff; font-size: 17px; }
#fso-app #fso-share-close { background: transparent; color: #fff; }
#fso-app .fso-share-preview { display: flex !important; align-items: center; justify-content: space-between; gap: 16px; width: 100%; margin: 12px 0 20px; padding: 16px; border: 0; border-radius: 16px; background: #4b4b4b; color: #fff; text-align: right; cursor: pointer; line-height: 1.8; }
#fso-app #fso-share-preview-text { min-width: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 14px; max-height: 150px; overflow-y: auto; }
#fso-app .fso-share-preview svg { width: 26px; height: 26px; flex: 0 0 26px; }
#fso-app .fso-share-options { display: grid !important; grid-template-columns: repeat(3,minmax(0,1fr)) !important; gap: 18px 10px !important; padding: 4px 0 20px; }
#fso-app .fso-share-options > br, #fso-app .fso-share-options > p:empty { display: none !important; }
#fso-app .fso-share-options > a, #fso-app .fso-share-options > button { display: flex !important; align-items: center !important; justify-content: flex-start !important; flex-direction: column !important; gap: 8px; float: none !important; clear: none !important; width: auto !important; min-width: 0 !important; height: auto !important; margin: 0 !important; padding: 8px 2px !important; border: 0 !important; background: transparent !important; color: #fff !important; box-shadow: none !important; font-size: 13px; }
#fso-app .fso-social-mark { width: 46px; height: 46px; }
#fso-app .fso-social-mark svg { width: 30px; height: 30px; }
#fso-app .fso-share-note { color: #ddd; }
#fso-app .fso-share-more { width: 100%; min-height: 46px; padding: 10px; border: 1px solid #777; background: #4b4b4b; color: #fff; border-radius: 12px; cursor: pointer; }
