/* ==========================================================================
   خط Almarai — مستضاف محلياً (SIL Open Font License 1.1)
   لا يُحمَّل من خوادم خارجية: أسرع، ويتفادى مشاكل الخصوصية.
   ========================================================================== */

@font-face {
	font-family: 'Almarai';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/almarai-arabic-400-normal.woff2') format('woff2');
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
	font-family: 'Almarai';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/almarai-arabic-700-normal.woff2') format('woff2');
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
	font-family: 'Almarai';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/almarai-latin-400-normal.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: 'Almarai';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/almarai-latin-700-normal.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   COD Order Form – واجهة الطلب
   ========================================================================== */

.icf-form-wrap {
	--icf-primary: #ed1b24;
	--icf-primary-2: #e91e63;
	--icf-btn-text: #fff;
	--icf-cart: #12b5ad;
	--icf-wa: #25d366;
	--icf-bg: #fff;
	--icf-text: #1e1e1e;
	--icf-field-bg: #f2f2f2;
	--icf-field-txt: #333;
	--icf-border: #e5e5e5;
	--icf-active: #111;
	--icf-head-bg: #fff;
	--icf-head-txt: #cc5000;
	--icf-total: #e91e63;
	--icf-badge: #111;
	--icf-radius: 10px;
	--icf-max: 620px;
	--icf-font: 15px;
	--icf-family: 'Almarai', system-ui, -apple-system, 'Segoe UI', sans-serif;

	box-sizing: border-box;
	max-width: var(--icf-max);
	margin: 20px auto;
	background: var(--icf-bg);
	color: var(--icf-text);
	border: 1px solid var(--icf-border);
	border-radius: calc(var(--icf-radius) + 4px);
	overflow: hidden;
	font-size: var(--icf-font);
	direction: rtl;
	text-align: right;
	box-shadow: 0 2px 14px rgba(0, 0, 0, .06);
	font-family: var(--icf-family);
}

/* الخط يرث لكل العناصر الداخلية، بما فيها الحقول والأزرار التي
   لا ترث font-family تلقائياً في المتصفحات. */
.icf-form-wrap,
.icf-form-wrap input,
.icf-form-wrap select,
.icf-form-wrap textarea,
.icf-form-wrap button,
.icf-form-wrap option,
.icf-form-wrap a { font-family: var(--icf-family); }

.icf-form-wrap *,
.icf-form-wrap *::before,
.icf-form-wrap *::after { box-sizing: border-box; }

.icf-form { padding: 16px; margin: 0; }

/* بعض القوالب تفرض حجماً على كل SVG؛ نعزل أيقونات النموذج عن ذلك */
.icf-form-wrap svg {
	max-width: none;
	max-height: none;
	vertical-align: middle;
	fill: currentColor;
}

.icf-title {
	text-align: center;
	font-weight: 700;
	line-height: 1.6;
	margin: 4px 0 18px;
	font-size: calc(var(--icf-font) + 1px);
}

/* ---------- الحقول ---------- */

.icf-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 12px;
}

.icf-field {
	position: relative;
	display: flex;
	align-items: stretch;
	flex: 1 1 100%;
	min-width: 0;
	border-radius: var(--icf-radius);
	overflow: hidden;
	background: var(--icf-field-bg);
	border: 1px solid transparent;
	transition: border-color .15s ease;
}

.icf-field.icf-col-6 { flex: 1 1 calc(50% - 5px); }
.icf-field.icf-col-12 { flex: 1 1 100%; }

.icf-field:focus-within { border-color: var(--icf-active); }

.icf-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	flex: 0 0 46px;
	background: #111;
	color: #fff;
	border-radius: var(--icf-radius);
}

.icf-icon .icf-svg {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
}

.icf-icon .icf-svg svg { width: 100%; height: 100%; display: block; }

/* كل أيقونات الحقول بنفس المقاس تماماً */
.icf-icon .icf-svg-pin { width: 22px; height: 22px; }

.icf-input {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	border: 0 !important;
	outline: 0;
	background: transparent;
	color: var(--icf-field-txt);
	padding: 13px 12px;
	font-size: inherit;
	font-family: inherit;
	box-shadow: none !important;
	border-radius: 0;
	height: auto;
	line-height: 1.4;
}

.icf-input::placeholder { color: #9b9b9b; opacity: 1; }
.icf-textarea { resize: vertical; padding: 12px; }

select.icf-input {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23777'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: left 10px center;
	background-size: 20px;
	padding-left: 34px;
	cursor: pointer;
}

.icf-field.icf-error { border-color: #e02020; background: #fff3f3; }

.icf-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- المتغيرات ---------- */

.icf-variations { margin-bottom: 16px; }

.icf-attr {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.icf-attr-label { font-weight: 600; flex: 0 0 auto; }

.icf-attr-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.icf-swatch {
	width: 34px;
	height: 34px;
	padding: 3px;
	border-radius: 50%;
	border: 2px solid transparent;
	background: none;
	cursor: pointer;
	line-height: 0;
	transition: border-color .15s ease, transform .15s ease;
}

.icf-swatch span {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, .15);
}

.icf-swatch:hover { transform: scale(1.06); }
.icf-swatch.is-active { border-color: var(--icf-active); }
.icf-swatch.is-out { opacity: .35; cursor: not-allowed; }

.icf-pill {
	min-width: 42px;
	padding: 8px 14px;
	border-radius: var(--icf-radius);
	border: 1px solid var(--icf-border);
	background: var(--icf-bg);
	color: var(--icf-text);
	cursor: pointer;
	font-size: inherit;
	font-family: inherit;
	transition: border-color .15s ease, background .15s ease;
}

.icf-pill:hover { border-color: var(--icf-active); }
.icf-pill.is-active { border-color: var(--icf-active); border-width: 2px; font-weight: 600; }
.icf-pill.is-out { opacity: .35; text-decoration: line-through; cursor: not-allowed; }

/* ---------- العروض ---------- */

.icf-offers { margin-bottom: 16px; }

.icf-offers-title {
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: center;
	font-weight: 700;
	margin-bottom: 12px;
}

.icf-offers-title .icf-svg svg { width: 18px; height: 18px; color: var(--icf-cart); }

.icf-offer {
	display: block;
	position: relative;
	border: 1px solid var(--icf-border);
	border-radius: var(--icf-radius);
	padding: 14px 46px 14px 14px;
	margin-bottom: 10px;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}

.icf-offer::before {
	content: "";
	position: absolute;
	right: 14px;
	top: 16px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid #c9c9c9;
	background: #fff;
}

.icf-offer.is-active { border-color: #16a34a; background: #f6fdf9; }
.icf-offer.is-active::before { border-color: #16a34a; border-width: 6px; }
.icf-offer input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }

.icf-offer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-direction: row-reverse;
}

.icf-offer-label { font-weight: 600; }
.icf-offer-price { font-weight: 700; color: var(--icf-total); white-space: nowrap; }

.icf-free-tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	background: #16a34a;
	color: #fff;
	border-radius: 999px;
	padding: 4px 12px;
	font-size: 13px;
}

.icf-free-tag .icf-svg svg { width: 15px; height: 15px; }

.icf-offer-vars { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--icf-border); }
.icf-offer.is-active .icf-offer-vars { display: block; }

.icf-offer-unit {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.icf-unit-num {
	flex: 0 0 28px;
	width: 28px;
	height: 28px;
	border-radius: 6px;
	background: var(--icf-field-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 700;
}

.icf-offer-select {
	background: var(--icf-field-bg);
	border-radius: var(--icf-radius) !important;
	padding: 10px 12px;
	padding-left: 34px;
}

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

.icf-delivery { margin-bottom: 14px; }
.icf-delivery-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.icf-delivery-opt {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 auto;
	justify-content: space-between;
	flex-wrap: nowrap;
	min-height: 48px;
	padding: 8px 14px;
}

.icf-delivery-opt input { position: absolute; opacity: 0; }
.icf-delivery-opt b { color: var(--icf-total); font-size: 15px; white-space: nowrap; }
.icf-delivery-opt.is-hidden { display: none; }

.icf-delivery-name {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	min-width: 0;
}

/* الأبعاد مفروضة على الوسم نفسه: بعض القوالب (Astra مثلاً) تترك SVG بلا حجم
   فيتمدد إلى عرض الحاوية بالكامل. */
.icf-delivery-name > .icf-svg {
	display: block;
	width: 18px;
	height: 18px;
	min-width: 18px;
	flex: 0 0 18px;
	color: #666;
}

.icf-delivery-name > .icf-svg > svg {
	width: 18px;
	height: 18px;
	display: block;
}

.icf-delivery-opt.is-active .icf-delivery-name > .icf-svg { color: var(--icf-active); }

.icf-no-desk {
	margin: 8px 0 0;
	padding: 8px 12px;
	background: #fff7ed;
	color: #9a3412;
	border-radius: var(--icf-radius);
	font-size: 13px;
	line-height: 1.5;
}

/* ---------- الكمية ---------- */

.icf-qty-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin: 16px 0;
}

.icf-qty-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	min-width: 38px;
	padding: 0;
	margin: 0;
	border-radius: 8px;
	border: 1px solid var(--icf-border);
	background: var(--icf-bg);
	color: var(--icf-text);
	font-size: 20px;
	font-weight: 400;
	font-family: inherit;
	line-height: 1;
	text-align: center;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none;
}

/* الرمز نفسه يُوسَّط بصرياً: بعض الخطوط تضع + و − فوق خط الأساس */
.icf-qty-btn > span {
	display: block;
	line-height: 1;
	transform: translateY(-1px);
}

.icf-qty-btn:hover { border-color: var(--icf-active); }

.icf-qty {
	width: 60px;
	text-align: center;
	border: 0;
	background: transparent;
	font-size: 16px;
	font-weight: 600;
	color: var(--icf-text);
	-moz-appearance: textfield;
}

.icf-qty::-webkit-outer-spin-button,
.icf-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- الأزرار ---------- */

.icf-actions { display: flex; flex-direction: column; gap: 10px; }

.icf-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 56px;
	padding: 14px 60px;
	border: 0;
	border-radius: var(--icf-radius);
	color: var(--icf-btn-text);
	font-size: calc(var(--icf-font) + 2px);
	font-weight: 700;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: filter .15s ease, transform .1s ease;
}

.icf-btn:hover { filter: brightness(1.07); color: var(--icf-btn-text); }
.icf-btn:active { transform: translateY(1px); }
.icf-btn:disabled { opacity: .65; cursor: progress; }

.icf-btn-buy { background: linear-gradient(90deg, var(--icf-primary), var(--icf-primary-2)); }
.icf-btn-cart { background: var(--icf-cart); }
.icf-btn-wa { background: var(--icf-wa); }
.icf-btn-wa .icf-svg svg { width: 22px; height: 22px; }

.icf-badge {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	background: var(--icf-badge);
	color: #fff;
	border-radius: 7px;
	padding: 4px 10px;
	font-size: 13px;
	font-weight: 700;
	white-space: nowrap;
}

.icf-badge:empty { display: none; }

/* ---------- الرسائل ---------- */

.icf-message {
	display: none;
	margin-top: 12px;
	padding: 12px 14px;
	border-radius: var(--icf-radius);
	font-weight: 600;
	text-align: center;
}

.icf-message.is-error { display: block; background: #fdecec; color: #b91c1c; }
.icf-message.is-success { display: block; background: #eafaf0; color: #15803d; }

/* ---------- ملخص الطلب ---------- */

.icf-summary {
	margin: 16px -16px -16px;
	border-top: 1px solid var(--icf-border);
}

.icf-summary-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 14px 16px;
	background: var(--icf-head-bg);
	color: var(--icf-head-txt);
	border: 0;
	font-size: inherit;
	font-family: inherit;
	font-weight: 700;
	cursor: pointer;
}

.icf-summary-title { display: flex; align-items: center; gap: 8px; }
.icf-summary-title .icf-svg svg { width: 18px; height: 18px; }

.icf-caret {
	width: 10px;
	height: 10px;
	border-left: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform .2s ease;
}

.icf-summary.is-open .icf-caret { transform: rotate(135deg); }

.icf-summary-body { display: none; }
.icf-summary.is-open .icf-summary-body { display: block; }

.icf-summary-section {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	background: #fafafa;
	border-top: 1px solid var(--icf-border);
	font-size: 14px;
	color: #666;
}

.icf-summary-section .icf-svg svg { width: 16px; height: 16px; }

.icf-line {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-top: 1px solid var(--icf-border);
}

.icf-line-thumb { flex: 0 0 44px; line-height: 0; }
.icf-line-thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.icf-line-name { flex: 1 1 auto; font-size: 14px; }
.icf-line-var { display: block; font-style: normal; font-size: 12px; color: #888; }

.icf-line-qty {
	background: var(--icf-badge);
	color: #fff;
	border-radius: 5px;
	padding: 2px 7px;
	font-size: 12px;
	font-weight: 700;
}

.icf-line-price { font-weight: 600; white-space: nowrap; font-size: 14px; }
.icf-shipping-line .icf-line-name,
.icf-total-line .icf-line-name { font-weight: 700; font-size: 15px; }

.icf-total-line { background: #fafafa; }

.icf-total-value {
	background: #fde7ef;
	color: var(--icf-total);
	border-radius: 8px;
	padding: 6px 14px;
	font-weight: 800;
	font-size: 16px;
	white-space: nowrap;
}

/* حماية عامة: أي SVG للإضافة له أبعاد صريحة مهما كان القالب */
.icf-svg{display:inline-flex;align-items:center;justify-content:center}
.icf-svg > svg{width:100%;height:100%;display:block}

/* ---------- الشريط السفلي ---------- */

.icf-sticky {
	position: fixed;
	right: 14px;
	bottom: 14px;
	z-index: 9998;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.icf-sticky-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	color: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
	transition: transform .15s ease;
}

.icf-sticky-btn:hover { transform: scale(1.08); color: #fff; }
.icf-sticky-btn .icf-svg { width: 24px; height: 24px; }
.icf-sticky-btn .icf-svg svg { width: 24px; height: 24px; }
.icf-sticky-phone { background: #111; }
.icf-sticky-wa { background: #25d366; }

/* ---------- شاشات صغيرة ---------- */

@media (max-width: 600px) {
	.icf-form-wrap { margin: 16px 0; border-radius: var(--icf-radius); }
	.icf-field.icf-col-6 { flex: 1 1 100%; }
	.icf-btn { padding: 14px 54px; font-size: var(--icf-font); }
	.icf-attr { gap: 8px; }

	/* تثبيت حجم الأيقونات: بعض القوالب تصغّر SVG داخل الحقول على الهاتف */
	.icf-icon { width: 48px; flex: 0 0 48px; }
	.icf-icon .icf-svg,
	.icf-icon .icf-svg-pin { width: 22px; height: 22px; }

	.icf-delivery-opt { flex: 1 1 100%; }
}

/* ---------- تقليل الحركة ---------- */

@media (prefers-reduced-motion: reduce) {
	.icf-form-wrap * { transition: none !important; animation: none !important; }
}

.icf-form-wrap :focus-visible { outline: 2px solid var(--icf-active); outline-offset: 2px; }
