/*
 * scan-hero.css v3 — luxurious multi-ring orb + feature cards + gold CTA.
 * Matches user-provided target mockup (image 1).
 */

.dd-hero-wrap {
  position: relative;
  margin: 10px 14px 12px;
  z-index: 5;
}

/* Hero card — large with violet→gold gradient border (matches profile pill) */
.dd-hero-card {
  position: relative;
  border-radius: 28px;
  padding: 22px 20px 24px;
  background:
    radial-gradient(120% 85% at 100% 35%, rgba(168, 85, 247, 0.30) 0%, transparent 58%),
    radial-gradient(95% 100% at 20% 115%, rgba(245, 166, 35, 0.14) 0%, transparent 55%),
    linear-gradient(170deg, #1a1030 0%, #120a22 55%, #0a0612 100%);
  border: 1.5px solid transparent;
  background-clip: padding-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 24px rgba(168, 85, 247, 0.22),
    0 0 40px rgba(245, 166, 35, 0.10),
    0 18px 48px rgba(0, 0, 0, 0.55);
  color: #F4EEFF;
  overflow: hidden;
  isolation: isolate;
}
/* Gradient border — same technique as profile-hero.css .dd-pbar-wrap::before */
.dd-hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 28px;
  padding: 1.5px;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 40%, #fbbf24 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}

/* Hero inner row */
.dd-hero-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: center;
  min-height: 260px;
}

/* AI FACE ANALYSIS chip */
.dd-hero-chip-label {
  display: inline-flex;
  align-items: center; gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.40);
  color: #E9D6FF;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.8px;
  margin-bottom: 16px;
}
.dd-hero-chip-label::before {
  content:"";
  font-size: 12px;
  color: #C8A4FF;
}

.dd-hero-title {
  font-size: 34px; font-weight: 900; line-height: 1.05;
  letter-spacing: -0.8px;
  margin: 0;
  color: #F6F0FF;
}
.dd-hero-title-accent {
  display: block;
  background: linear-gradient(90deg, #C084FC 0%, #A855F7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.dd-hero-sub {
  font-size: 13px; line-height: 1.55;
  margin: 14px 0 0;
  color: rgba(226,219,245,0.68);
  max-width: 22ch;
}

/* ── ORB ──────────────────────────────────────────────────
   Big aura: 240px container on the right of the hero row.
   Multiple SVG ring layers + center purple circle + sparkles.
   ────────────────────────────────────────────────────────── */
.dd-hero-orb {
  position: relative;
  width: 220px; height: 220px;
  justify-self: center;
  align-self: center;
  filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.35));
}

.dd-hero-orb svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Orb rotation — each layer is an HTML <div> wrapper rotating via CSS.
   HTML elements rotate reliably on every browser including iOS Safari. */
.dd-hero-orb .dd-orb-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  pointer-events: none;
  will-change: transform;
}
.dd-hero-orb .dd-orb-layer > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
/* Rotation is done via SVG SMIL <animateTransform> inside each layer's
   inner <g>. CSS animations disabled to avoid conflict with SMIL. */

/* Center purple camera circle — pixel-perfect centered via calc() */
.dd-hero-orb-center {
  position: absolute;
  width: 92px; height: 92px;
  top: calc(50% - 46px);
  left: calc(50% - 46px);
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.28), transparent 55%),
    linear-gradient(150deg, #a855f7 0%, #7c3aed 60%, #6d28d9 100%);
  border: 2px solid rgba(196, 132, 252, 0.55);
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    0 0 40px rgba(168, 85, 247, 0.7),
    0 0 80px rgba(124, 58, 237, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  z-index: 3;
  pointer-events: none;
}
.dd-hero-orb-center svg {
  position: static; width: 40px; height: 40px; color: #fff;
}

/* Sparkle particles pulse */
.dd-hero-sparkle {
  animation: dd-pulse-glow 2.4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.dd-hero-sparkle:nth-child(1)  { animation-delay: 0s; }
.dd-hero-sparkle:nth-child(2)  { animation-delay: .3s; }
.dd-hero-sparkle:nth-child(3)  { animation-delay: .6s; }
.dd-hero-sparkle:nth-child(4)  { animation-delay: .9s; }
.dd-hero-sparkle:nth-child(5)  { animation-delay: 1.2s; }
.dd-hero-sparkle:nth-child(6)  { animation-delay: 1.5s; }
.dd-hero-sparkle:nth-child(7)  { animation-delay: 1.8s; }
.dd-hero-sparkle:nth-child(8)  { animation-delay: 2.1s; }

@-webkit-keyframes dd-spin-cw  {
  0%   { -webkit-transform: rotate(0deg);   transform: rotate(0deg);   }
  100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}
@keyframes dd-spin-cw  {
  0%   { -webkit-transform: rotate(0deg);   transform: rotate(0deg);   }
  100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}
@-webkit-keyframes dd-spin-ccw {
  0%   { -webkit-transform: rotate(0deg);    transform: rotate(0deg);    }
  100% { -webkit-transform: rotate(-360deg); transform: rotate(-360deg); }
}
@keyframes dd-spin-ccw {
  0%   { -webkit-transform: rotate(0deg);    transform: rotate(0deg);    }
  100% { -webkit-transform: rotate(-360deg); transform: rotate(-360deg); }
}
@keyframes dd-pulse-glow {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

/* Sparkle opacity pulse still respects reduced motion (SMIL rotation continues) */
@media (prefers-reduced-motion: reduce) {
  .dd-hero-sparkle { animation: none; }
}

/* ── FEATURE CARDS ─────────────────────────────────────── */
.dd-hero-feats {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 22px;
}
.dd-hero-feat {
  padding: 16px 10px 14px;
  border-radius: 18px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(26, 17, 48, 0.85) 0%, rgba(16, 9, 30, 0.90) 100%);
  border: 1px solid rgba(168, 85, 247, 0.28);
  color: #F4EEFF;
}
.dd-hero-feat.is-gold {
  background:
    linear-gradient(180deg, rgba(245, 166, 35, 0.18) 0%, rgba(124, 58, 237, 0.08) 100%);
  border-color: rgba(245, 166, 35, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 22px rgba(245, 166, 35, 0.18);
}
.dd-hero-feat-ico {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
  color: #C4B5FD;
}
.dd-hero-feat.is-gold .dd-hero-feat-ico { color: #F5A623; }
.dd-hero-feat-t {
  font-size: 13px; font-weight: 800;
  line-height: 1.2;
  margin-bottom: 5px;
}
.dd-hero-feat-s {
  font-size: 11px; line-height: 1.4;
  color: rgba(226,219,245,0.60);
  white-space: pre-line;
}

/* ── CTA ──────────────────────────────────────────────── */
.dd-hero-cta {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  column-gap: 12px;
  width: 100%;
  margin-top: 22px;
  padding: 16px 18px;
  border: none;
  border-radius: 20px;
  background:
    repeating-linear-gradient(135deg,
      transparent 0, transparent 6px,
      rgba(255,255,255,0.10) 6px, rgba(255,255,255,0.10) 8px),
    linear-gradient(135deg, #F5A623 0%, #FBBF24 50%, #F59E0B 100%);
  color: #1a1008; font-weight: 900; font-size: 16px;
  letter-spacing: 0.2px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.38),
    0 14px 32px rgba(245, 166, 35, 0.36);
  cursor: pointer;
  transition: transform 0.15s ease-out, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}
.dd-hero-cta:active {
  transform: translateY(1px) scale(0.995);
}
.dd-hero-cta-ico {
  display: flex; align-items: center; justify-content: center;
}
.dd-hero-cta-ico svg { width: 24px; height: 24px; }
.dd-hero-cta-label {
  text-align: center;
  line-height: 1.2;
}
.dd-hero-cta-label small {
  display: block;
  font-size: 11px; font-weight: 700;
  color: rgba(26,16,8,0.70);
  margin-top: 2px;
}
.dd-hero-cta-chev {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(26,16,8,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900;
}

/* ── NEW Preview overlay — body-level fullscreen modal after file picked ── */
.dd-hero-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 28px 20px 40px;
  background: rgba(6, 3, 12, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: dd-preview-in 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes dd-preview-in {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}
.dd-hero-preview-frame {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 4 / 3;
  border-radius: 24px;
  overflow: hidden;
  border: 1.5px solid transparent;
  background-clip: padding-box;
  background-color: #0a0612;
  box-shadow:
    0 0 30px rgba(168, 85, 247, 0.35),
    0 0 60px rgba(245, 166, 35, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 20px 44px rgba(0, 0, 0, 0.55);
}
/* Gradient border — same violet→gold as profile pill + hero card */
.dd-hero-preview-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1.5px;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 40%, #fbbf24 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}
.dd-hero-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dd-hero-preview-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px 6px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.92);
  color: #062a1e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
  backdrop-filter: blur(10px);
}
.dd-hero-preview-badge svg { width: 13px; height: 13px; }
.dd-hero-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  width: 100%;
  max-width: 440px;
}
.dd-hero-preview-change,
.dd-hero-preview-analyze {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, filter 200ms ease;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
.dd-hero-preview-change {
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.40);
  color: #E9D6FF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.dd-hero-preview-change:active { transform: scale(0.97); }
.dd-hero-preview-change svg { width: 16px; height: 16px; color: #C084FC; }
.dd-hero-preview-analyze {
  background:
    repeating-linear-gradient(135deg,
      transparent 0, transparent 6px,
      rgba(255, 255, 255, 0.10) 6px, rgba(255, 255, 255, 0.10) 8px),
    linear-gradient(135deg, #F5A623 0%, #FBBF24 50%, #F59E0B 100%);
  border: none;
  color: #1a1008;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 10px 26px rgba(245, 166, 35, 0.4);
}
.dd-hero-preview-analyze:hover { filter: brightness(1.04); }
.dd-hero-preview-analyze:active { transform: scale(0.97); }
.dd-hero-preview-analyze svg { width: 18px; height: 18px; }

/* Preview overlay on orb center (legacy — kept for compatibility) */
.dd-hero-orb img.dd-preview {
  position: absolute !important;
  top: 50% !important; left: 50% !important;
  width: 110px !important; height: 110px !important;
  transform: translate(-50%, -50%) !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  z-index: 4 !important;
  opacity: 1 !important;
  display: block !important;
  border: 3px solid rgba(168, 85, 247, 0.75) !important;
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.55) !important;
  inset: auto !important;
}
.dd-hero-orb:has(img.dd-preview) .dd-hero-orb-center { opacity: 0; }

/* Hide React's upload card + any duplicate CTA once our hero is present */
/* ── React's "เริ่มวิเคราะห์" button — restyle to match "เลือกรูปภาพ"
   VISUAL ONLY — pseudo-elements + inline background. We never touch
   pointer-events or touch-action because React Native Web's onPress
   depends on children receiving touch events. ────────────────────── */
[data-dd-gold-cta="1"] {
  position: relative !important;
  padding-left: 56px !important;
  padding-right: 56px !important;
  padding-top: 18px !important;
  padding-bottom: 18px !important;
  border-radius: 22px !important;
  border: none !important;
  background:
    repeating-linear-gradient(135deg,
      transparent 0, transparent 6px,
      rgba(255,255,255,0.10) 6px, rgba(255,255,255,0.10) 8px),
    linear-gradient(135deg, #F5A623 0%, #FBBF24 50%, #F59E0B 100%) !important;
  color: #1a1008 !important;
  font-weight: 900 !important;
  font-size: 16px !important;
  letter-spacing: 0.3px !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    0 14px 32px rgba(245, 166, 35, 0.36) !important;
  overflow: hidden !important;
}
[data-dd-gold-cta="1"] * {
  color: #1a1008 !important;
  -webkit-text-fill-color: #1a1008 !important;
}
/* Camera icon on left */
[data-dd-gold-cta="1"]::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a1008' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'><path d='M4 8h3l2-3h6l2 3h3v11H4z'/><circle cx='12' cy='13' r='3.5'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 2;
}
/* Chevron in a circle on right */
[data-dd-gold-cta="1"]::after {
  content: "›";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: rgba(26, 16, 8, 0.18);
  color: #1a1008 !important;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

/* ── React rank/dashboard card — add our violet→gold gradient border ── */
[data-dd-gradient-card="1"] {
  position: relative !important;
  border-radius: 28px !important;
  border: 1.5px solid transparent !important;
  background-clip: padding-box !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 24px rgba(168, 85, 247, 0.18),
    0 0 40px rgba(245, 166, 35, 0.08),
    0 18px 48px rgba(0, 0, 0, 0.45) !important;
}
[data-dd-gradient-card="1"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 28px;
  padding: 1.5px;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 40%, #fbbf24 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 5;
}

/* Hide the React card + duplicate CTAs but keep them in the DOM so their
   <input type="file"> and click handlers still work when we delegate to them. */
body:has(.dd-hero-wrap) [data-dd-hero-hide="1"],
body:has(.dd-hero-wrap) [data-dd-hero-hide-cta="1"] {
  position: absolute !important;
  left: -99999px !important;
  top: -99999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
}

/* Mobile */
@media (max-width: 420px) {
  .dd-hero-row { grid-template-columns: 1fr 180px; }
  .dd-hero-orb { width: 180px; height: 180px; }
  .dd-hero-orb-center { width: 72px; height: 72px; }
  .dd-hero-orb-center svg { width: 30px; height: 30px; }
  .dd-hero-title { font-size: 28px; }
  .dd-hero-feat-t { font-size: 12px; }
  .dd-hero-feat-s { font-size: 10.5px; }
}
@media (max-width: 360px) {
  .dd-hero-row { grid-template-columns: 1fr 150px; }
  .dd-hero-orb { width: 150px; height: 150px; }
  .dd-hero-orb-center { width: 60px; height: 60px; }
}
