/* =============================================================================
   Khtyar SEO Autopilot — front-end styles for generated articles (v1.1.1)
   RTL-first, no external fonts, no !important on theme elements.

   Scope rules:
   - Everything lives under .ksap-* classes that this plugin generates.
   - The order FORM markup belongs to the store's order plugin (.cp-*,
     .khtyar-offer-*). The theme styles that form only inside
     `.single-product .kt-buy-now-panel`, so inside an article it would render
     with browser defaults. The block "ORDER FORM INSIDE ARTICLES" below gives it
     the store's own visual language, scoped to .ksap-orderbox ONLY —
     product pages are never affected.
   - !important is used only where the order plugin prints its own global
     !important rules (the offer selector), because a scoped rule must be able
     to win without touching the product-page copy of the same markup.
   ============================================================================= */

/* ------------------------------------------------------------- figures ----
   Compact by default: the sizes come from CSS variables printed inline from
   Settings → 4c (figure_max_width / figure_height / figure_hero_height), so the
   owner can tune them without touching code. Fixed height + object-fit: cover
   keeps every image the same calm size instead of eating the whole screen. */
.ksap-figure {
	margin: 1.5em auto;
	max-width: var(--ksap-fig-w, 560px);
	text-align: center;
}

img.ksap-img {
	display: block;
	margin: 0 auto;
	width: 100%;
	height: var(--ksap-fig-h, 340px);
	max-width: 100%;
	object-fit: cover;
	border-radius: 14px;
	background: #f6f8f7;
	transition: opacity .18s ease, transform .18s ease;
}

.ksap-figure-hero { margin-top: .8em; }

.ksap-figure-hero img.ksap-img { height: var(--ksap-fig-hero-h, 420px); }

/* clicking an article image goes straight to its product page */
.ksap-figure-link {
	display: block;
	border: 0;
	text-decoration: none !important;
	cursor: pointer;
}

.ksap-figure-link:hover img.ksap-img,
.ksap-figure-link:focus img.ksap-img {
	opacity: .93;
	transform: scale(1.012);
}

.ksap-figure figcaption {
	margin-top: .55em;
	font-size: .85em;
	line-height: 1.7;
	color: #61756f;
}

/* ----------------------------------------------------------------- FAQ ---- */
.ksap-faq {
	margin: 2.2em 0 1em;
	padding: 1.3em 1.5em;
	border: 1px solid #dfeee8;
	border-radius: 18px;
	background: #fbfffd;
}

.ksap-faq h2 { margin-top: 0; font-size: 1.3em; color: #092822; }
.ksap-faq h3 { margin: 1.1em 0 .35em; font-size: 1.05em; color: #103f39; }
.ksap-faq p  { margin: 0 0 .6em; color: #344b45; }

/* ------------------------------------------------------ related blocks ---- */
.ksap-related,
.ksap-products {
	margin: 2em 0;
	padding: 1.2em 1.4em;
	border: 1px solid #dfeee8;
	border-radius: 18px;
	background: #fff;
}

.ksap-related h2,
.ksap-products h2 { margin-top: 0; font-size: 1.15em; color: #092822; }

.ksap-related ul,
.ksap-products ul { margin: .4em 0 0; padding-inline-start: 1.2em; }
.ksap-related li,
.ksap-products li { margin-bottom: .45em; line-height: 1.8; }

/* =========================================================== ORDER BOX ==== */
.ksap-orderbox {
	margin: 2.4em auto;
	max-width: 720px;
	padding: 22px 20px 20px;
	border: 1px solid #dfeee8;
	border-radius: 22px;
	background: linear-gradient(180deg, #ffffff 0%, #fbfffd 100%);
	box-shadow: 0 14px 34px rgba(16, 63, 57, .07);
	text-align: right;
	direction: rtl;
	font-family: inherit;
}

.ksap-orderbox-title {
	margin: 0 0 4px !important;
	color: #092822 !important;
	font-size: 24px !important;
	line-height: 1.45 !important;
	font-weight: 1000 !important;
}

.ksap-orderbox-title::before { content: "🛒 "; }

.ksap-orderbox-note {
	margin: 0 0 14px;
	color: #61756f;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.8;
}

/* ------------------------------------------------- ORDER FORM (articles) --
   The same look the store uses on product pages, scoped to the article box. */

.ksap-orderbox .cp-order-form,
.ksap-orderbox form.cp-order-form {
	max-width: 100% !important;
	margin: 0 !important;
	background: transparent !important;
	border: 0 !important;
	padding: 0 !important;
}

.ksap-orderbox .cp-grid {
	display: grid !important;
	grid-template-columns: 1fr 1fr !important;
	gap: 12px !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
}

.ksap-orderbox .cp-grid:before,
.ksap-orderbox .cp-submit-area:before { display: none !important; }

/* price strip (WooCommerce price html: <del> old </del> <ins> now </ins>) */
.ksap-orderbox .cp-price,
.ksap-orderbox .ksap-orderbox-price {
	grid-column: 1 / -1;
	display: flex !important;
	align-items: baseline !important;
	justify-content: flex-start !important;
	gap: 10px !important;
	flex-wrap: wrap;
	position: static !important;
	transform: none !important;
	width: auto !important;
	height: auto !important;
	margin: 0 0 12px !important;
	padding: 13px 16px !important;
	border: 1px dashed #bbf7d0 !important;
	border-radius: 16px !important;
	background: #ecfdf5 !important;
	box-shadow: none !important;
	color: #103f39 !important;
	font-size: 15px !important;
	font-weight: 900 !important;
}

.ksap-orderbox .cp-price:before {
	content: 'السعر';
	align-self: center;
	color: #61756f;
	font-size: 12.5px;
	font-weight: 1000;
}

.ksap-orderbox .cp-price .amount,
.ksap-orderbox .ksap-orderbox-price .amount {
	color: #103f39 !important;
	font-size: 24px !important;
	font-weight: 1000 !important;
}

.ksap-orderbox .cp-price del,
.ksap-orderbox .ksap-orderbox-price del {
	order: 2;
	color: #8aa099 !important;
	font-size: 14px !important;
	font-weight: 800 !important;
	opacity: .8;
	text-decoration: line-through !important;
}

.ksap-orderbox .cp-price ins,
.ksap-orderbox .ksap-orderbox-price ins {
	order: 1;
	background: transparent !important;
	color: #103f39 !important;
	text-decoration: none !important;
}


/* the struck old price must stay small even though .amount is enlarged above */
.ksap-orderbox .cp-price del .amount,
.ksap-orderbox .ksap-orderbox-price del .amount {
	color: #8aa099 !important;
	font-size: 14px !important;
	font-weight: 800 !important;
}

.ksap-orderbox .cp-price del .amount .woocommerce-Price-currencySymbol,
.ksap-orderbox .ksap-orderbox-price del .amount .woocommerce-Price-currencySymbol {
	font-size: 11px !important;
}

/* quantity offers -------------------------------------------------------- */
.ksap-orderbox .khtyar-offer-selector {
	grid-column: 1 / -1;
	display: grid !important;
	grid-template-columns: 1fr !important;
	gap: 9px !important;
	width: 100% !important;
	margin: 0 0 14px !important;
}

.ksap-orderbox .khtyar-offer-option {
	position: relative;
	display: flex !important;
	align-items: center !important;
	justify-content: flex-start !important;
	gap: 10px !important;
	background: #fff !important;
	border: 1.5px solid #e0ede7 !important;
	border-radius: 14px !important;
	padding: 12px 14px !important;
	cursor: pointer !important;
	color: #123630 !important;
	font-weight: 900 !important;
	transition: border-color .18s ease, background .18s ease, box-shadow .18s ease !important;
	overflow: visible;
}

.ksap-orderbox .khtyar-offer-option:hover { border-color: #9fc7b8 !important; }

.ksap-orderbox .khtyar-offer-option.is-active {
	border-color: #103f39 !important;
	background: #f2fdf8 !important;
	box-shadow: 0 8px 20px rgba(16, 63, 57, .08) !important;
}

.ksap-orderbox .khtyar-offer-option input[type="radio"] {
	order: 1;
	flex: none !important;
	width: 19px !important;
	height: 19px !important;
	margin: 0 !important;
	accent-color: #103f39 !important;
}

/* the badge becomes an inline pill inside the row instead of an absolute
   sticker that overlapped the card above it */
.ksap-orderbox .khtyar-offer-option.best:before {
	content: attr(data-badge);
	order: 2;
	position: static !important;
	top: auto !important;
	left: auto !important;
	display: inline-flex;
	align-items: center;
	flex: none;
	background: #cb4a2f !important;
	color: #fff !important;
	border-radius: 999px !important;
	padding: 4px 10px !important;
	font-size: 10.5px !important;
	font-weight: 1000 !important;
	line-height: 1.4;
	white-space: nowrap;
}

.ksap-orderbox .khtyar-offer-option span {
	order: 3;
	flex: 1 !important;
	color: #123630 !important;
	font-size: 14px !important;
	font-weight: 900 !important;
	line-height: 1.6;
	text-align: right;
}

.ksap-orderbox .khtyar-offer-option strong {
	order: 4;
	flex: none !important;
	width: auto !important;
	color: #cb4a2f !important;
	font-size: 15px !important;
	font-weight: 1000 !important;
	white-space: nowrap !important;
	padding: 0 !important;
	text-align: left !important;
}

/* fields ----------------------------------------------------------------- */
.ksap-orderbox .cp-field {
	margin: 0 !important;
	min-width: 0;
}

.ksap-orderbox .cp-name-field { grid-column: 1 / -1; }

.ksap-orderbox .cp-field label {
	display: block;
	margin: 0 0 6px !important;
	color: #103f39 !important;
	font-size: 13.5px !important;
	font-weight: 1000 !important;
	line-height: 1.5;
}

.ksap-orderbox .cp-field label span { color: #cb4a2f; }

.ksap-orderbox .cp-input-wrap,
.ksap-orderbox .cp-phone-wrap {
	position: relative;
	display: flex !important;
	align-items: center;
	height: 50px !important;
	min-height: 50px !important;
	background: #fff !important;
	border: 1.5px solid #d8e5de !important;
	border-radius: 12px !important;
	padding: 0 12px !important;
	box-shadow: none !important;
	transition: border-color .18s ease, box-shadow .18s ease;
}

.ksap-orderbox .cp-input-wrap:focus-within,
.ksap-orderbox .cp-phone-wrap:focus-within {
	border-color: #103f39 !important;
	box-shadow: 0 0 0 3px rgba(16, 63, 57, .10) !important;
}

.ksap-orderbox .cp-icon {
	flex: none;
	margin-inline-end: 9px;
	color: #7d938c;
	font-size: 15px;
	line-height: 1;
}

.ksap-orderbox .cp-input,
.ksap-orderbox input[type="text"],
.ksap-orderbox .cp-phone-input {
	flex: 1 1 auto;
	width: 100% !important;
	min-width: 0;
	height: 48px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	outline: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: #123630 !important;
	font-size: 15px !important;
	font-weight: 700 !important;
	font-family: inherit !important;
	line-height: 48px !important;
	border-radius: 0 !important;
}

.ksap-orderbox .cp-input::placeholder,
.ksap-orderbox .cp-phone-input::placeholder {
	color: #9db1aa;
	font-weight: 600;
	opacity: 1;
}

/* phone: keep the +966 prefix chip exactly like the product page */
.ksap-orderbox .cp-phone-wrap { padding: 0 !important; }

.ksap-orderbox .cp-phone-wrap:before {
	content: "🇸🇦 +966";
	position: absolute;
	left: 0;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 48px !important;
	min-width: 86px;
	padding: 0 10px;
	background: #f0fdf7;
	border-left: 0;
	border-right: 1px solid #d4e8df;
	border-radius: 12px 0 0 12px;
	color: #103f39 !important;
	direction: ltr;
	font-size: 12px !important;
	font-weight: 1000 !important;
	line-height: 48px !important;
}

.ksap-orderbox .cp-phone-input,
.ksap-orderbox input[name="customer_phone"] {
	padding: 0 12px 0 100px !important;
	direction: ltr !important;
	text-align: left !important;
}

/* submit ----------------------------------------------------------------- */
.ksap-orderbox .cp-submit-area {
	grid-column: 1 / -1;
	margin: 0 !important;
	padding: 4px 0 0 !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
}

.ksap-orderbox .cp-submit,
.ksap-orderbox .cp-order-form input[type="submit"],
.ksap-orderbox .cp-order-form button[type="submit"] {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 56px !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 14px !important;
	background: linear-gradient(135deg, #103f39, #0b2d28) !important;
	box-shadow: 0 12px 26px rgba(16, 63, 57, .20) !important;
	color: #fff !important;
	cursor: pointer;
	font-size: 18px !important;
	font-weight: 1000 !important;
	font-family: inherit !important;
	letter-spacing: 0;
	text-shadow: none;
	transition: transform .18s ease, box-shadow .18s ease !important;
}

.ksap-orderbox .cp-submit:hover,
.ksap-orderbox .cp-order-form input[type="submit"]:hover,
.ksap-orderbox .cp-order-form button[type="submit"]:hover {
	transform: translateY(-2px);
	box-shadow: 0 16px 34px rgba(16, 63, 57, .28) !important;
}

.ksap-orderbox .cp-submit:active,
.ksap-orderbox .cp-order-form button[type="submit"]:active {
	transform: translateY(0);
}

/* in-form alerts (order accepted / error) */
.ksap-orderbox .cavero-order-alert {
	margin: 0 0 12px;
	padding: 11px 14px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 900;
	line-height: 1.7;
}

.ksap-orderbox .cavero-order-alert.success {
	background: #ecfdf5;
	border: 1px solid #bbf7d0;
	color: #103f39;
}

.ksap-orderbox .cavero-order-alert.error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

/* product footnote link (was rendered as a bare blue link) */
.ksap-orderbox-product {
	margin: 14px 0 0 !important;
	padding-top: 12px;
	border-top: 1px dashed #e2efe9;
	color: #61756f;
	font-size: 12.5px;
	font-weight: 700;
	line-height: 1.7;
}

.ksap-orderbox-product a {
	color: #103f39;
	font-weight: 900;
	text-decoration: none;
	border-bottom: 1px dotted #9fc7b8;
}

.ksap-orderbox-product a:hover { color: #cb4a2f; border-bottom-color: #cb4a2f; }

/* fallback CTA (no order mechanism / product not orderable) */
.ksap-orderbox-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: .4em 0 .2em;
	padding: .85em 1.9em;
	border-radius: 999px;
	background: #103f39;
	color: #fff !important;
	font-size: 1.05em;
	font-weight: 1000;
	line-height: 1.6;
	text-decoration: none !important;
	box-shadow: 0 10px 22px rgba(16, 63, 57, .22);
	transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.ksap-orderbox-cta:hover,
.ksap-orderbox-cta:focus {
	background: #0b2d28;
	transform: translateY(-2px);
	box-shadow: 0 14px 30px rgba(16, 63, 57, .30);
}

.ksap-orderbox-cta-muted { background: #fff; color: #103f39 !important; border: 1.5px solid #d8e5de; box-shadow: none; }

.ksap-orderbox-unavailable {
	margin: .2em 0 .9em;
	color: #92400e;
	font-size: .95em;
	font-weight: 800;
}

/* two boxes on one page (position = both): the second reads as a reminder */
.ksap-orderbox + .ksap-orderbox,
.ksap-orderbox-link {
	background: linear-gradient(180deg, #ffffff 0%, #fbfdf9 100%);
	border-inline-start: 4px solid #d4af37;
}

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 900px) {
	.ksap-orderbox .cp-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 600px) {
	.ksap-orderbox {
		margin: 1.8em .4em;
		padding: 18px 15px 16px;
		border-radius: 18px;
	}

	.ksap-orderbox-title { font-size: 21px !important; }

	.ksap-orderbox .cp-price .amount,
	.ksap-orderbox .ksap-orderbox-price .amount { font-size: 21px !important; }

	.ksap-orderbox .khtyar-offer-option { padding: 11px 12px !important; }

	.ksap-orderbox .khtyar-offer-option span { font-size: 13px !important; }

	.ksap-orderbox .cp-submit,
	.ksap-orderbox .cp-order-form button[type="submit"],
	.ksap-orderbox .cp-order-form input[type="submit"] { height: 52px !important; font-size: 17px !important; }

	.ksap-figure { margin: 1.2em auto; max-width: 100%; }

	img.ksap-img { height: calc(var(--ksap-fig-h, 340px) * .78); }

	.ksap-figure-hero img.ksap-img { height: calc(var(--ksap-fig-hero-h, 420px) * .8); }

	.ksap-faq,
	.ksap-related,
	.ksap-products { padding: 1em; border-radius: 14px; }
}

@media (max-width: 420px) {
	.ksap-orderbox .khtyar-offer-option { flex-wrap: wrap !important; }

	.ksap-orderbox .khtyar-offer-option strong {
		width: 100% !important;
		text-align: right !important;
		padding-inline-start: 29px !important;
	}

	.ksap-orderbox .cp-phone-wrap:before { min-width: 78px; }

	.ksap-orderbox .cp-phone-input,
	.ksap-orderbox input[name="customer_phone"] { padding-left: 92px !important; }
}

/* ---------------------------------------------------------------- print --- */
@media print {
	.ksap-orderbox,
	.ksap-related,
	.ksap-products { box-shadow: none; }
}

/* ------------------------------------------- reduced motion preference ---- */
@media (prefers-reduced-motion: reduce) {
	.ksap-orderbox-cta,
	.ksap-orderbox .cp-submit,
	.ksap-orderbox .khtyar-offer-option,
	.ksap-orderbox .cp-input-wrap,
	.ksap-orderbox .cp-phone-wrap { transition: none !important; }

	.ksap-orderbox-cta:hover,
	.ksap-orderbox .cp-submit:hover { transform: none; }
}
