/*!
 * Dr. Hilo Skin Advisor – frontend styles
 * Powered by Areej Abumuhfouz – https://areejmuhfouz.com
 */

.dhsa-root {
	--dhsa-primary: #d3c176;
	--dhsa-on-primary: #10131e;
	--dhsa-ink: #10131e;
	--dhsa-soft: #faeee4;
	--dhsa-muted: #5f6270;
	--dhsa-line: #ece6dc;
	--dhsa-fab-size: 68px;
	--dhsa-fab-offset: 24px;
	--dhsa-bg: #ffffff;
	--dhsa-good: #2e8b57;
	--dhsa-mid: #d99a2b;
	--dhsa-high: #c8553d;
	--dhsa-radius: 16px;
	--dhsa-shadow: 0 24px 60px rgba(16, 24, 22, .18);
	font-family: inherit;
	color: var(--dhsa-ink);
	direction: rtl;
	text-align: right;
	box-sizing: border-box;
	line-height: 1.6;
}
.dhsa-root *, .dhsa-root *::before, .dhsa-root *::after { box-sizing: inherit; }
.dhsa-root[hidden], .dhsa-root [hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.dhsa-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 0 22px; border-radius: 999px;
	border: 1.5px solid transparent; font: inherit; font-size: 15px; font-weight: 700;
	cursor: pointer; text-decoration: none !important; line-height: 1.2;
	transition: transform .15s ease, background-color .2s ease, opacity .2s ease, box-shadow .2s ease;
	-webkit-tap-highlight-color: transparent; user-select: none;
}
.dhsa-btn:active { transform: scale(.98); }
.dhsa-btn:focus-visible, .dhsa-icon-btn:focus-visible, .dhsa-shutter:focus-visible, .dhsa-fab:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--dhsa-primary) 45%, transparent); outline-offset: 2px;
}
.dhsa-btn--primary { background: var(--dhsa-primary); color: var(--dhsa-on-primary) !important; box-shadow: 0 6px 18px color-mix(in srgb, var(--dhsa-primary) 40%, transparent); }
.dhsa-btn--primary:hover { filter: brightness(1.06); }
.dhsa-btn--ghost { background: transparent; color: var(--dhsa-ink) !important; border-color: var(--dhsa-primary); }
.dhsa-btn--ghost:hover { background: color-mix(in srgb, var(--dhsa-primary) 14%, transparent); }
.dhsa-btn--wa { background: #25d366; color: #fff !important; }
.dhsa-btn--sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; width: 100%; }
.dhsa-btn[disabled], .dhsa-btn.is-disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.dhsa-btn.is-done { background: var(--dhsa-ink); color: #fff !important; opacity: 1; box-shadow: none; }

.dhsa-icon-btn {
	width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--dhsa-soft);
	color: var(--dhsa-ink); display: inline-grid; place-items: center; cursor: pointer;
}

/* ---------- Inline card (shortcode) ---------- */
.dhsa-card {
	display: flex; align-items: center; gap: 18px; padding: 22px 24px; margin: 24px 0;
	background: linear-gradient(135deg, var(--dhsa-soft), #fff 75%);
	border: 1px solid var(--dhsa-line); border-radius: 20px;
}
.dhsa-card__icon {
	flex: 0 0 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
	background: var(--dhsa-primary); color: var(--dhsa-on-primary);
}
.dhsa-card__icon svg { width: 40px; height: 40px; }
.dhsa-card__icon.has-custom { border-radius: 50%; overflow: hidden; }
.dhsa-card__body { flex: 1; min-width: 0; }
.dhsa-card__title { margin: 0 0 4px; font-size: 19px; line-height: 1.4; color: var(--dhsa-ink); }
.dhsa-card__text { margin: 0; color: var(--dhsa-muted); font-size: 14.5px; }

/* ---------- Floating button (round face-scan badge) ---------- */
.dhsa-fab {
	position: fixed; bottom: var(--dhsa-fab-offset); z-index: 99990;
	width: var(--dhsa-fab-size); height: var(--dhsa-fab-size); padding: 0; border: 3px solid #fff; border-radius: 50%;
	background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--dhsa-primary) 65%, #fff), var(--dhsa-primary) 70%);
	color: var(--dhsa-on-primary); cursor: pointer; display: grid; place-items: center;
	box-shadow: 0 10px 26px rgba(16, 19, 30, .28);
	animation: dhsa-pop .55s cubic-bezier(.2, .9, .3, 1.2) both .8s;
	transition: transform .2s ease;
}
.dhsa-fab--left { left: var(--dhsa-fab-offset); }
.dhsa-fab--right { right: var(--dhsa-fab-offset); }
.dhsa-fab:hover { transform: scale(1.06); }
.dhsa-fab__icon { position: relative; width: 82%; height: 82%; border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.dhsa-fab__icon svg { width: 100%; height: 100%; }
.dhsa-fab--custom { background: #fff; }
.dhsa-fab--custom .dhsa-fab__icon { width: 100%; height: 100%; }
.dhsa-fab__icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dhsa-fab__pulse { position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--dhsa-primary); animation: dhsa-pulse 2.4s ease-out infinite 1.5s; pointer-events: none; }
.dhsa-fab__label {
	position: absolute; top: 50%; white-space: nowrap; transform: translateY(-50%) scale(.95); opacity: 0; pointer-events: none;
	background: var(--dhsa-ink); color: #fff; font: inherit; font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 999px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .18); transition: opacity .2s ease, transform .2s ease;
}
.dhsa-fab--left .dhsa-fab__label { left: calc(100% + 12px); }
.dhsa-fab--right .dhsa-fab__label { right: calc(100% + 12px); }
.dhsa-fab:hover .dhsa-fab__label, .dhsa-fab:focus-visible .dhsa-fab__label { opacity: 1; transform: translateY(-50%) scale(1); }
.dhsa-scanline { animation: dhsa-scanline 2.2s ease-in-out infinite alternate; }
@keyframes dhsa-scanline { from { transform: translateY(-15px); } to { transform: translateY(15px); } }
@keyframes dhsa-pulse { 0% { transform: scale(1); opacity: .9; } 70%, 100% { transform: scale(1.45); opacity: 0; } }
@keyframes dhsa-pop { from { transform: translateY(20px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Modal ---------- */
html.dhsa-lock, html.dhsa-lock body { overflow: hidden !important; }
html.dhsa-lock .dhsa-fab { opacity: 0; pointer-events: none; }
.dhsa-modal { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.dhsa-modal__backdrop { position: absolute; inset: 0; background: rgba(12, 18, 16, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s ease; }
.dhsa-modal__panel {
	position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
	display: flex; flex-direction: column; background: var(--dhsa-bg); border-radius: 24px; box-shadow: var(--dhsa-shadow);
	transform: translateY(16px) scale(.98); opacity: 0; transition: transform .25s ease, opacity .25s ease; outline: none; overflow: hidden;
}
.dhsa-modal.is-open .dhsa-modal__backdrop { opacity: 1; }
.dhsa-modal.is-open .dhsa-modal__panel { transform: none; opacity: 1; }

.dhsa-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: var(--dhsa-ink); color: #fff; }
.dhsa-modal__head .dhsa-icon-btn { background: rgba(255, 255, 255, .12); color: #fff; }
.dhsa-brand { display: flex; align-items: center; gap: 10px; }
.dhsa-brand__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dhsa-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dhsa-primary) 30%, transparent); }
.dhsa-modal__title { margin: 0; font-size: 17px; font-weight: 800; color: #fff; }
.dhsa-modal__body { padding: 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ---------- Steps ---------- */
.dhsa-step { display: none; animation: dhsa-fade .25s ease; }
.dhsa-step.is-active { display: block; }
@keyframes dhsa-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.dhsa-hero { text-align: center; margin-bottom: 18px; }
.dhsa-hero__icon {
	width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
	background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--dhsa-primary) 70%, #fff), var(--dhsa-primary)); color: var(--dhsa-on-primary);
}
.dhsa-hero__icon svg { width: 60px; height: 60px; }
.dhsa-hero__icon.has-custom, .dhsa-card__icon.has-custom { background: #fff; box-shadow: 0 6px 18px rgba(16, 19, 30, .12); }
.dhsa-custom-icon { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.dhsa-hero__icon--warn { background: #fdf0ec; color: var(--dhsa-high); }
.dhsa-h3 { margin: 0 0 6px; font-size: 21px; line-height: 1.4; color: var(--dhsa-ink); }
.dhsa-h4 { margin: 22px 0 10px; font-size: 15.5px; font-weight: 800; color: var(--dhsa-ink); }
.dhsa-muted { margin: 0; color: var(--dhsa-muted); font-size: 14.5px; }
.dhsa-center { text-align: center; margin: 12px 0 4px; }

.dhsa-points { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.dhsa-points li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: color-mix(in srgb, var(--dhsa-soft) 60%, #fff); border-radius: 12px; font-size: 14.5px; margin: 0; }
.dhsa-points span { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--dhsa-primary); color: var(--dhsa-on-primary); font-size: 13px; font-weight: 800; }

.dhsa-consent { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px dashed var(--dhsa-line); border-radius: 12px; font-size: 13px; color: var(--dhsa-muted); cursor: pointer; margin: 0; }
.dhsa-consent input { margin: 3px 0 0; width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--dhsa-primary); }

.dhsa-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.dhsa-actions > .dhsa-btn { flex: 1 1 180px; }
.dhsa-actions--center { justify-content: space-between; align-items: center; flex-wrap: nowrap; }
.dhsa-actions--center > .dhsa-btn { flex: 0 1 auto; min-width: 88px; }

/* ---------- Camera ---------- */
.dhsa-camera { position: relative; border-radius: 20px; overflow: hidden; background: #0d1110; aspect-ratio: 3 / 4; max-height: 62vh; margin: 0 auto; width: 100%; }
.dhsa-camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.dhsa-camera video.is-mirrored { transform: scaleX(-1); }
.dhsa-camera__guide { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.dhsa-camera__guide span { width: 62%; aspect-ratio: 3 / 4; border-radius: 50%; border: 3px dashed rgba(255, 255, 255, .85); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); }
.dhsa-camera__tip { position: absolute; bottom: 12px; inset-inline: 12px; margin: 0; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.dhsa-shutter { width: 72px; height: 72px; flex: 0 0 72px; border-radius: 50%; border: 4px solid var(--dhsa-primary); background: #fff; padding: 5px; cursor: pointer; }
.dhsa-shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--dhsa-ink); transition: transform .1s ease; }
.dhsa-shutter:active span { transform: scale(.88); }

.dhsa-preview { border-radius: 20px; overflow: hidden; background: var(--dhsa-soft); max-width: 340px; margin: 0 auto; }
.dhsa-preview img { display: block; width: 100%; height: auto; }

/* ---------- Loading ---------- */
.dhsa-loading { text-align: center; padding: 10px 0 18px; }
.dhsa-scan { position: relative; width: 190px; height: 190px; margin: 6px auto 18px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 6px color-mix(in srgb, var(--dhsa-primary) 16%, transparent); }
.dhsa-scan img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }
.dhsa-scan__line { position: absolute; inset-inline: 0; height: 3px; top: 0; background: var(--dhsa-primary); box-shadow: 0 0 18px 6px color-mix(in srgb, var(--dhsa-primary) 55%, transparent); animation: dhsa-scan 1.8s ease-in-out infinite alternate; }
@keyframes dhsa-scan { from { top: 4%; } to { top: 96%; } }
.dhsa-loading__text { font-weight: 700; color: var(--dhsa-ink); min-height: 1.6em; margin: 0; }

/* ---------- Results ---------- */
.dhsa-summary { display: flex; align-items: center; gap: 18px; padding: 16px; border-radius: 18px; background: var(--dhsa-soft); }
.dhsa-ring { --p: 0; position: relative; width: 104px; height: 104px; flex: 0 0 104px; }
.dhsa-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dhsa-ring circle { fill: none; stroke-width: 10; }
.dhsa-ring__bg { stroke: var(--dhsa-line); }
.dhsa-ring__fg { stroke: var(--dhsa-primary); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: calc(326.7 - 326.7 * var(--p) / 100); transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.dhsa-ring__val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.dhsa-ring__val strong { font-size: 30px; font-weight: 800; color: var(--dhsa-ink); }
.dhsa-ring__val small { font-size: 11.5px; color: var(--dhsa-muted); }
.dhsa-summary__text { flex: 1; min-width: 0; }
.dhsa-summary__text p { margin: 8px 0 0; font-size: 14.5px; }
.dhsa-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--dhsa-line); font-size: 13px; color: var(--dhsa-muted); }
.dhsa-badge b { color: var(--dhsa-ink); }

.dhsa-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.dhsa-bar { margin: 0; }
.dhsa-bar__head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.dhsa-bar__val { font-weight: 800; direction: ltr; }
.dhsa-bar__track { height: 8px; border-radius: 99px; background: var(--dhsa-line); overflow: hidden; }
.dhsa-bar__fill { display: block; height: 100%; border-radius: 99px; transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.dhsa-bar--low .dhsa-bar__fill { background: var(--dhsa-good); }
.dhsa-bar--mid .dhsa-bar__fill { background: var(--dhsa-mid); }
.dhsa-bar--high .dhsa-bar__fill { background: var(--dhsa-high); }
.dhsa-bar--low .dhsa-bar__val { color: var(--dhsa-good); }
.dhsa-bar--mid .dhsa-bar__val { color: var(--dhsa-mid); }
.dhsa-bar--high .dhsa-bar__val { color: var(--dhsa-high); }

.dhsa-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.dhsa-product { display: flex; flex-direction: column; border: 1px solid var(--dhsa-line); border-radius: 16px; overflow: hidden; background: #fff; transition: box-shadow .2s ease, transform .2s ease; }
.dhsa-product:hover { box-shadow: 0 10px 24px rgba(0, 0, 0, .08); transform: translateY(-2px); }
.dhsa-product__media { display: block; aspect-ratio: 1 / 1; background: var(--dhsa-soft); }
.dhsa-product__media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dhsa-product__body { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 12px; flex: 1; }
.dhsa-product__name { font-size: 13.5px; font-weight: 700; color: var(--dhsa-ink) !important; text-decoration: none !important; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dhsa-product__reason { font-size: 11.5px; color: var(--dhsa-ink); background: var(--dhsa-soft); border-radius: 8px; padding: 3px 8px; align-self: flex-start; }
.dhsa-product__price { font-size: 14px; font-weight: 800; color: var(--dhsa-ink); margin-top: auto; }
.dhsa-product__price del { color: var(--dhsa-muted); font-weight: 400; font-size: 12px; margin-inline-start: 4px; }
.dhsa-product__price ins { text-decoration: none; }
.dhsa-empty { grid-column: 1 / -1; margin: 0; padding: 14px; border-radius: 12px; background: var(--dhsa-soft); font-size: 14px; }

.dhsa-tips ul { margin: 0; padding: 0 18px 0 0; display: grid; gap: 6px; font-size: 14px; }
.dhsa-tips li { margin: 0; }
.dhsa-tips li::marker { color: var(--dhsa-ink); }

.dhsa-disclaimer { margin: 18px 0 0; font-size: 12px; color: var(--dhsa-muted); background: var(--dhsa-soft); padding: 10px 12px; border-radius: 10px; }
.dhsa-error { font-size: 15px; font-weight: 600; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
	.dhsa-modal { padding: 0; align-items: flex-end; }
	.dhsa-modal__panel { max-width: none; height: 100%; max-height: 100%; border-radius: 0; }
	.dhsa-modal__body { padding: 18px 16px; flex: 1; }
	.dhsa-card { flex-direction: column; text-align: center; padding: 20px; }
	.dhsa-card .dhsa-btn { width: 100%; }
	.dhsa-fab { --dhsa-fab-offset: 16px; width: calc(var(--dhsa-fab-size) * .88); height: calc(var(--dhsa-fab-size) * .88); }
	.dhsa-fab__label { display: none; }
	.dhsa-summary { flex-direction: column; text-align: center; }
	.dhsa-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.dhsa-camera { max-height: 58vh; max-height: 58dvh; }
	.dhsa-h3 { font-size: 19px; }
}
@media (max-width: 360px) {
	.dhsa-actions--center > .dhsa-btn { min-width: 0; padding: 0 12px; }
	.dhsa-shutter { width: 64px; height: 64px; flex-basis: 64px; }
}

@media (prefers-reduced-motion: reduce) {
	.dhsa-root *, .dhsa-root *::before, .dhsa-root *::after { animation: none !important; transition: none !important; }
}

/* Older browsers without color-mix(): sensible fallbacks. */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.dhsa-btn--primary { box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }
	.dhsa-btn--ghost { border-color: var(--dhsa-line); }
	.dhsa-card { background: var(--dhsa-soft); }
	.dhsa-hero__icon, .dhsa-product__reason { background: var(--dhsa-soft); }
	.dhsa-brand__dot, .dhsa-scan { box-shadow: none; }
	.dhsa-scan__line { box-shadow: 0 0 12px 4px rgba(255, 255, 255, .6); }
}
