/*
 * AI Interior Design Visualizer — front-end theme
 * Palette pulled from the client's own site (warm cream + espresso + bronze gold).
 * Typography: Vazirmatn for UI/body, Noto Serif for the display heading accent.
 */

.aid-app {
	--aid-cream: #F7F1E6;
	--aid-cream-soft: #FBF8F2;
	--aid-espresso: #2B2419;
	--aid-espresso-soft: #423826;
	--aid-gold: #B8874A;
	--aid-gold-light: #D9B579;
	--aid-gold-pale: #EEDFC2;
	--aid-taupe: #8C7A63;
	--aid-line: rgba(43, 36, 25, 0.1);
	--aid-glass-bg: rgba(255, 255, 255, 0.55);
	--aid-glass-border: rgba(255, 255, 255, 0.65);
	--aid-radius: 20px;
	--aid-shadow: 0 20px 60px -20px rgba(43, 36, 25, 0.35);

	position: relative;
	max-width: 620px;
	margin: 0 auto;
	font-family: 'Vazirmatn', Tahoma, sans-serif;
	color: var(--aid-espresso);
	isolation: isolate;
	/* Backstop for the same mobile "jumps to footer on step change" issue
	   the showStep() scroll-restore in frontend.js fixes: some mobile
	   browsers try to keep the scroll position "anchored" to content that
	   just got hidden, which fights our manual restore. Turning it off here
	   makes our own restore the only thing in control of scroll position. */
	overflow-anchor: none;
}

.aid-app * { box-sizing: border-box; }

/* ambient warm glows behind the glass card */
.aid-glow {
	position: absolute;
	border-radius: 50%;
	filter: blur(60px);
	z-index: -1;
	opacity: 0.55;
	pointer-events: none;
}
.aid-glow-1 {
	width: 280px; height: 280px;
	background: radial-gradient(circle, var(--aid-gold-light), transparent 70%);
	top: -60px; right: -60px;
}
.aid-glow-2 {
	width: 240px; height: 240px;
	background: radial-gradient(circle, var(--aid-gold-pale), transparent 70%);
	bottom: -40px; left: -60px;
}

.aid-card {
	position: relative;
	background: var(--aid-glass-bg);
	border: 1px solid var(--aid-glass-border);
	border-radius: var(--aid-radius);
	box-shadow: var(--aid-shadow);
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
	padding: 40px 36px;
	overflow: hidden;
}
.aid-card::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(160deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 40%);
	pointer-events: none;
}

.aid-step { position: relative; }

.aid-eyebrow {
	display: inline-block;
	font-size: 12.5px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--aid-gold);
	background: var(--aid-gold-pale);
	border: 1px solid rgba(184, 135, 74, 0.35);
	padding: 5px 14px;
	border-radius: 999px;
	margin-bottom: 18px;
}

.aid-heading {
	font-family: 'Noto Serif', 'Vazirmatn', serif;
	font-weight: 700;
	font-size: 27px;
	line-height: 1.5;
	margin: 0 0 10px;
	color: var(--aid-espresso);
}
.aid-heading em {
	font-style: normal;
	color: var(--aid-gold);
}
.aid-heading-sm { font-size: 22px; }

.aid-sub {
	color: var(--aid-taupe);
	font-size: 14.5px;
	line-height: 1.9;
	margin: 0 0 26px;
}

/* ---- upload dropzone ---- */
.aid-upload-box {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	border: 1.5px dashed rgba(184, 135, 74, 0.5);
	border-radius: 16px;
	padding: 34px 20px;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.45);
	transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.aid-upload-box:hover {
	border-color: var(--aid-gold);
	background: rgba(255, 255, 255, 0.65);
}
.aid-upload-box:active { transform: scale(0.995); }
.aid-upload-box input[type="file"] { display: none; }

.aid-upload-icon {
	width: 52px; height: 52px;
	display: flex; align-items: center; justify-content: center;
	border-radius: 50%;
	background: linear-gradient(145deg, var(--aid-gold-light), var(--aid-gold));
	color: #fff;
	margin-bottom: 8px;
	box-shadow: 0 8px 20px -6px rgba(184, 135, 74, 0.6);
}

.aid-upload-label {
	font-weight: 600;
	font-size: 15px;
	color: var(--aid-espresso-soft);
}
.aid-upload-hint {
	font-size: 12.5px;
	color: var(--aid-taupe);
	direction: rtl;
}

#aid-preview {
	display: none;
	width: 100%;
	max-height: 220px;
	object-fit: cover;
	margin-top: 14px;
	border-radius: 12px;
	border: 1px solid var(--aid-line);
}

/* ---- fields ---- */
.aid-field { margin: 20px 0; }
/* The Google reCAPTCHA widget itself is always LTR/left-aligned by Google;
   this just centers its box within our RTL form instead of leaving it
   pinned to the right. */
.aid-captcha-field { display: flex; justify-content: center; }
.aid-field label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	font-size: 14px;
	color: var(--aid-espresso-soft);
}
.aid-optional { font-weight: 400; color: var(--aid-taupe); font-size: 12.5px; }

.aid-field input,
.aid-field textarea,
.aid-select-wrap select {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--aid-line);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.6);
	font-family: inherit;
	font-size: 14.5px;
	color: var(--aid-espresso);
	transition: border-color .2s ease, box-shadow .2s ease;
}
.aid-field input:focus,
.aid-field textarea:focus,
.aid-select-wrap select:focus {
	outline: none;
	border-color: var(--aid-gold);
	box-shadow: 0 0 0 3px rgba(184, 135, 74, 0.18);
}
.aid-field textarea { resize: vertical; }

.aid-select-wrap { position: relative; }
.aid-select-wrap::after {
	content: "";
	position: absolute;
	left: 16px; top: 50%;
	width: 8px; height: 8px;
	border-left: 1.5px solid var(--aid-taupe);
	border-bottom: 1.5px solid var(--aid-taupe);
	transform: translateY(-70%) rotate(-45deg);
	pointer-events: none;
}
.aid-select-wrap select { appearance: none; padding-left: 34px; cursor: pointer; }

/* ---- buttons ---- */
.aid-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 13px 26px;
	border-radius: 12px;
	border: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.aid-btn:active { transform: scale(0.98); }
.aid-btn-block { width: 100%; margin-top: 6px; }

.aid-btn-primary {
	background: linear-gradient(145deg, var(--aid-espresso-soft), var(--aid-espresso));
	color: var(--aid-cream);
	box-shadow: 0 12px 26px -10px rgba(43, 36, 25, 0.55);
}
.aid-btn-primary:hover { box-shadow: 0 14px 30px -8px rgba(43, 36, 25, 0.65); }
.aid-btn-primary svg { transition: transform .2s ease; }
.aid-btn-primary:hover svg { transform: translateX(-3px); }

.aid-btn-secondary {
	background: rgba(255, 255, 255, 0.6);
	color: var(--aid-espresso-soft);
	border: 1px solid var(--aid-line);
	margin-inline-start: 10px;
}
.aid-btn-secondary:hover { background: #fff; border-color: var(--aid-gold); }

.aid-result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.aid-result-actions .aid-btn-secondary { margin-inline-start: 0; }

/* ---- loading / AI badge (signature element) ---- */
#aid-step-loading { text-align: center; padding: 20px 0 6px; }

.aid-ai-badge {
	position: relative;
	width: 96px; height: 96px;
	margin: 10px auto 26px;
	display: flex; align-items: center; justify-content: center;
}
.aid-ai-ring {
	position: absolute; inset: 0;
	border-radius: 50%;
	background: conic-gradient(from 0deg, var(--aid-gold-pale), var(--aid-gold) 30%, var(--aid-gold-pale) 60%, var(--aid-gold) 100%);
	animation: aid-rotate 2.2s linear infinite;
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
}
.aid-ai-core {
	position: relative;
	width: 72px; height: 72px;
	border-radius: 50%;
	background: linear-gradient(150deg, var(--aid-espresso-soft), var(--aid-espresso));
	color: var(--aid-gold-light);
	display: flex; align-items: center; justify-content: center;
	font-family: 'Noto Serif', serif;
	font-weight: 700;
	font-size: 20px;
	letter-spacing: 0.03em;
	box-shadow: 0 10px 24px -8px rgba(43, 36, 25, 0.6);
}
@keyframes aid-rotate { to { transform: rotate(360deg); } }

.aid-loading-text {
	color: var(--aid-taupe);
	font-size: 14.5px;
}

.aid-upload-success {
	color: #1a7f37;
	background: #E4F3E7;
	display: inline-block;
	padding: 6px 16px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 10px;
}

/* ---- result compare ---- */
.aid-result-compare {
	display: flex;
	gap: 14px;
	flex-wrap: wrap;
}
.aid-result-frame {
	position: relative;
	flex: 1;
	min-width: 220px;
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid var(--aid-line);
	background: rgba(255, 255, 255, 0.4);
}
.aid-result-frame img {
	display: block;
	width: 100%;
	height: 200px;
	object-fit: cover;
}
.aid-result-tag {
	position: absolute;
	top: 10px; right: 10px;
	font-size: 11.5px;
	font-weight: 700;
	padding: 4px 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.85);
	color: var(--aid-espresso-soft);
	backdrop-filter: blur(4px);
}
.aid-result-tag-gold {
	background: linear-gradient(145deg, var(--aid-gold-light), var(--aid-gold));
	color: #fff;
}

/* ---- error state ---- */
#aid-step-error { text-align: center; padding: 10px 0; }
.aid-error-icon {
	width: 48px; height: 48px;
	line-height: 48px;
	margin: 0 auto 16px;
	border-radius: 50%;
	background: #F6E3DD;
	color: #A64B36;
	font-weight: 800;
	font-size: 20px;
}
.aid-error {
	color: #A64B36;
	font-weight: 600;
	font-size: 14.5px;
	margin-bottom: 20px;
}

/* ---- responsive ---- */
@media (max-width: 520px) {
	.aid-card { padding: 28px 20px; border-radius: 16px; }
	.aid-heading { font-size: 22px; }
	.aid-result-compare { flex-direction: column; }
}

/* respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.aid-ai-ring { animation: none; }
	.aid-btn, .aid-upload-box { transition: none; }
}

/* ---- honeypot (invisible to humans, catches simple bots) ---- */
.aid-honeypot {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none;
}

/* ---- drag & drop active state ---- */
.aid-upload-box.aid-drag-over {
	border-color: var(--aid-gold);
	background: rgba(255, 255, 255, 0.8);
	box-shadow: 0 0 0 4px rgba(184, 135, 74, 0.15);
}

/* ---- consent checkbox ---- */
.aid-checkbox-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 13px;
	color: var(--aid-taupe);
	line-height: 1.7;
	margin: 18px 0 6px;
	cursor: pointer;
}
.aid-checkbox-row input[type="checkbox"] {
	margin-top: 3px;
	accent-color: var(--aid-gold);
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

/* ---- my orders shortcode ---- */
.aid-my-orders { max-width: 640px; margin: 0 auto; font-family: 'Vazirmatn', Tahoma, sans-serif; }
.aid-orders-list { display: flex; flex-direction: column; gap: 12px; }
.aid-order-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px;
	border: 1px solid rgba(43,36,25,0.1);
	border-radius: 12px;
	background: rgba(255,255,255,0.5);
}
.aid-order-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.aid-order-info { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.aid-order-status { font-weight: 700; font-size: 12px; width: fit-content; padding: 2px 10px; border-radius: 999px; }
.aid-status-paid { color: #1a7f37; background: #E4F3E7; }
.aid-status-awaiting_payment { color: #b45309; background: #FBEEDC; }
.aid-status-failed, .aid-status-cancelled, .aid-status-expired { color: #b91c1c; background: #FBE7E4; }

/* ---- usage status badge (visible across all steps) ---- */
.aid-usage-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 18px;
	padding: 6px 14px;
	border-radius: 999px;
	background: var(--aid-gold-pale);
	color: var(--aid-espresso-soft);
	font-size: 12.5px;
	font-weight: 600;
	width: fit-content;
}
.aid-usage-badge.aid-usage-badge-limited {
	background: #FBE7E4;
	color: #b91c1c;
}

/* ---- step nav (AJAX prev/next between steps 1, 3, 4) ----
   Pulled out of document flow and pinned to a single corner of the card so it
   no longer pushes the heading/content down or reads as a heavy bordered bar.
   Tiny ghost icon buttons; the label is muted and only appears on hover so
   the resting state is just two quiet arrows. */
.aid-step-nav {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	gap: 2px;
}
.aid-nav-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: var(--aid-taupe);
	cursor: pointer;
	opacity: 0.55;
	transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.aid-nav-arrow svg { width: 14px; height: 14px; }
.aid-nav-arrow:hover {
	opacity: 1;
	background: var(--aid-gold-pale);
	color: var(--aid-espresso-soft);
}
.aid-nav-arrow:disabled,
.aid-nav-arrow.aid-nav-arrow-hidden {
	visibility: hidden;
}
.aid-step-nav-label {
	font-size: 10.5px;
	font-weight: 600;
	color: var(--aid-taupe);
	opacity: 0;
	max-width: 0;
	overflow: hidden;
	white-space: nowrap;
	transition: opacity .15s ease, max-width .15s ease;
}
.aid-step-nav:hover .aid-step-nav-label {
	opacity: 1;
	max-width: 60px;
	margin: 0 2px;
}
@media (max-width: 520px) {
	.aid-step-nav { top: 10px; left: 10px; }
}

/* ---- disabled buttons (hourly cap reached) ---- */
.aid-btn:disabled,
.aid-btn.aid-btn-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

.aid-limit-msg {
	margin: 10px 0 0;
	font-size: 13px;
	color: #b91c1c;
	text-align: center;
}

/* ---- prepay amount box (step 4, before checkout submit) ---- */
.aid-prepay-box {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 6px 0 18px;
	padding: 14px 18px;
	border-radius: 14px;
	background: var(--aid-cream-soft);
	border: 1px solid var(--aid-line);
}
.aid-prepay-label {
	font-size: 13.5px;
	color: var(--aid-taupe);
	font-weight: 600;
}
.aid-prepay-amount {
	font-size: 16px;
	font-weight: 800;
	color: var(--aid-gold);
}

/* ---- payment result popup (shown on return from the gateway) ---- */
.aid-popup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(43, 36, 25, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	padding: 20px;
	direction: rtl;
	font-family: 'Vazirmatn', sans-serif;
}
.aid-popup-box {
	background: var(--aid-cream-soft, #FBF8F2);
	border-radius: 18px;
	max-width: 380px;
	width: 100%;
	padding: 32px 26px;
	text-align: center;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
	border-top: 5px solid var(--aid-gold, #B8874A);
}
.aid-popup-box.aid-popup-failed {
	border-top-color: #b91c1c;
}
.aid-popup-icon {
	font-size: 40px;
	line-height: 1;
	margin-bottom: 10px;
}
.aid-popup-title {
	margin: 0 0 10px;
	font-size: 19px;
	font-weight: 800;
	color: var(--aid-espresso, #2B2419);
}
.aid-popup-message {
	margin: 0 0 22px;
	font-size: 14.5px;
	line-height: 1.9;
	color: var(--aid-espresso-soft, #423826);
}
.aid-popup-close-btn {
	background: var(--aid-gold, #B8874A);
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 10px 26px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
}
.aid-popup-close-btn:hover {
	background: var(--aid-gold-light, #D9B579);
}
