.smd-ai-widget {
  --smd-primary: #7d74eb;
  --smd-primary-soft: #8a82ef;
  --smd-primary-deep: #21245d;
  --smd-surface: #ffffff;
  --smd-border: rgba(34, 39, 98, 0.16);
  --smd-text: #17203c;
  --smd-muted: rgba(23, 32, 60, 0.68);
  --smd-shadow: 0 24px 48px rgba(25, 31, 85, 0.1);
  --smd-stage-width: 1080px;
  --smd-stage-height: 540px;
  --smd-upload-stage-height: 432px;
  --smd-upload-panel-height: 432px;
  --smd-upload-dropzone-height: 394px;
  --smd-standard-ratio: 16 / 9;
  --smd-compare-max-width: 820px;
  --smd-processing-width: 832px;
  --smd-processing-height: 500px;
  --smd-result-frame-width: 1000px;
  --smd-result-frame-height: 550px;
  --smd-compare-aspect-ratio: 1000 / 550;
  display: block;
  width: 100%;
  max-width: var(--smd-stage-width);
  margin: 0 auto;
  color: var(--smd-text);
  font-family: "Poppins", sans-serif;
}

.elementor-widget-smd_ai_widget,
.elementor-widget-smd_ai_widget .elementor-widget-container,
.smd-ai-widget {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.smd-ai-widget *,
.smd-ai-widget *::before,
.smd-ai-widget *::after {
  box-sizing: border-box;
}

.smd-ai-widget__surface {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
}

.smd-ai-widget__step {
  display: none;
}

.smd-ai-widget__step.is-active {
  display: block;
  width: 100%;
}

.smd-ai-widget__card,
.smd-ai-widget__processing-card,
.smd-ai-widget__result-card {
  background: linear-gradient(135deg, var(--smd-primary-soft) 0%, var(--smd-primary) 100%);
  border-radius: 24px;
  box-shadow: var(--smd-shadow);
}

.smd-ai-widget__upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  padding: 0;
  width: 100%;
  min-height: var(--smd-upload-stage-height);
}

.smd-ai-widget__preview-shell,
.smd-ai-widget__upload-shell,
.smd-ai-widget__compare {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
}

.smd-ai-widget__preview-shell {
  min-height: var(--smd-upload-panel-height);
  background: #7a75e6;
  border: 2px solid #54579d;
  box-shadow: none;
}

.smd-ai-widget__preview-placeholder,
.smd-ai-widget__preview-image {
  position: absolute;
  inset: 0;
}

.smd-ai-widget__preview-placeholder {
  background: transparent;
}

.smd-ai-widget__preview-image,
.smd-ai-widget__compare-base,
.smd-ai-widget__compare-result {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.smd-ai-widget__preview-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.82);
  z-index: 2;
}

.smd-ai-widget__preview-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  z-index: 3;
}

.smd-ai-widget__preview-handle span {
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  color: #7a75e6;
  margin-top: -2px;
}

.smd-ai-widget__upload-shell {
  background: #fff;
  min-height: var(--smd-upload-panel-height);
  padding: 14px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  border: 2px solid #54579d;
  box-shadow: none;
}

.smd-ai-widget__dropzone {
  width: 100%;
  min-height: var(--smd-upload-dropzone-height);
  border: 2px dashed #6a70ac;
  border-radius: 12px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 9px;
  color: var(--smd-text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.smd-ai-widget__dropzone.is-dragging {
  border-color: var(--smd-primary);
  background: rgba(123, 116, 234, 0.08);
  transform: translateY(-2px);
}

.smd-ai-widget__dropzone input {
  display: none;
}

.smd-ai-widget__upload-icon {
  width: 85px;
  height: 85px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #7a75e6;
  color: #fff;
  margin-bottom: 2px;
}

.smd-ai-widget__upload-icon svg {
  width: 50%;
  height: 50px;
  fill: currentColor;
}

.smd-ai-widget__dropzone strong {
  max-width: 100%;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 700;
  color: #171b46;
}

.smd-ai-widget__dropzone small {
  font-size: 10px;
  line-height: 1.3;
  color: rgba(23, 32, 60, 0.6);
}

.smd-ai-widget__card,
.smd-ai-widget__processing-card,
.smd-ai-widget__result-card {
  padding: 24px;
  width: min(100%, 100%);
  min-height: var(--smd-stage-height);
}

.smd-ai-widget__title {
  margin: 0 0 18px;
  color: #fff;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
}

.smd-ai-widget__card,
.smd-ai-widget__processing-card,
.smd-ai-widget__result-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.smd-ai-widget__form {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
}

.smd-ai-widget__form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.smd-ai-widget__form-grid textarea {
  grid-column: 1 / -1;
  resize: vertical;
  min-height: 120px;
}

.smd-ai-widget__form-grid input,
.smd-ai-widget__form-grid select,
.smd-ai-widget__form-grid textarea {
  border: 0;
  outline: 0;
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--smd-text);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 0 0 1px rgba(17, 22, 58, 0.06);
}

.smd-ai-widget__form-grid select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--smd-primary-deep) 50%), linear-gradient(135deg, var(--smd-primary-deep) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.smd-ai-widget__actions,
.smd-ai-widget__result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.smd-ai-widget__button {
  border: 0;
  border-radius: 10px;
  min-width: 160px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.smd-ai-widget__reset {
  display: none !important;
}

.smd-ai-widget__button:hover {
  transform: translateY(-1px);
}

.smd-ai-widget__button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.smd-ai-widget__button--primary {
  background: var(--smd-primary-deep);
  color: #fff;
  box-shadow: 0 14px 26px rgba(15, 20, 55, 0.24);
}

.smd-ai-widget__button--light {
  background: #fff;
  color: var(--smd-primary-deep);
}

.smd-ai-widget__button--ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.smd-ai-widget__message {
  margin: 14px 0 0;
  color: #fff;
  text-align: center;
}

.smd-ai-widget__processing-card {
  width: 100%;
  max-width: var(--smd-processing-width);
  min-height: var(--smd-processing-height);
  margin: 0 auto;
  color: #fff;
  text-align: center;
}

.smd-ai-widget__spinner {
  width: 66px;
  height: 66px;
  margin: 6px auto 20px;
  border-radius: 999px;
  border: 6px solid rgba(255, 255, 255, 0.26);
  border-top-color: #fff;
  animation: smd-spin 0.9s linear infinite;
}

.smd-ai-widget__progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.smd-ai-widget__progress-bar {
  width: 12%;
  height: 100%;
  border-radius: 999px;
  background: var(--smd-primary-deep);
  transition: width 0.4s ease;
}

.smd-ai-widget__progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.smd-ai-widget__progress-row strong {
  font-size: 24px;
}

.smd-ai-widget__processing-text,
.smd-ai-widget__processing-card small {
  color: rgba(255, 255, 255, 0.84);
}

.smd-ai-widget__result-card {
  padding: 24px;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  align-items: center;
}

.smd-ai-widget__compare {
  width: 100%;
  max-width: var(--smd-result-frame-width);
  margin: 0 auto;
  aspect-ratio: var(--smd-compare-aspect-ratio);
  background: linear-gradient(180deg, rgba(240, 242, 248, 0.96) 0%, rgba(223, 228, 240, 0.92) 100%);
  border: 2px solid rgba(255, 255, 255, 0.24);
  min-height: 0;
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 42px rgba(17, 21, 53, 0.18);
  isolation: isolate;
  height: min(var(--smd-result-frame-height), calc(100vh - 240px));
}

.smd-ai-widget__compare::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(10, 14, 32, 0) 24%, rgba(8, 10, 22, 0.16) 100%);
  pointer-events: none;
  z-index: 1;
}

.smd-ai-widget__compare-base,
.smd-ai-widget__compare-overlay,
.smd-ai-widget__compare-result {
  position: absolute;
  inset: 0;
}

.smd-ai-widget__compare-base,
.smd-ai-widget__compare-result {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
  object-position: center center;
}

.smd-ai-widget__compare-overlay {
  width: auto;
  overflow: hidden;
  clip-path: inset(0 50% 0 0);
  -webkit-clip-path: inset(0 50% 0 0);
  z-index: 2;
}

.smd-ai-widget__compare-line,
.smd-ai-widget__compare-handle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.smd-ai-widget__compare-line {
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 0 22px rgba(255, 255, 255, 0.45);
  z-index: 4;
}

.smd-ai-widget__compare-handle {
  top: 50%;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-top: -23px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 30px rgba(19, 22, 55, 0.22);
  z-index: 5;
}

.smd-ai-widget__compare-handle span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid var(--smd-primary);
  position: relative;
}

.smd-ai-widget__compare-handle span::before,
.smd-ai-widget__compare-handle span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  border-top: 2px solid var(--smd-primary);
  border-right: 2px solid var(--smd-primary);
}

.smd-ai-widget__compare-handle span::before {
  left: 2px;
  transform: translateY(-50%) rotate(-135deg);
}

.smd-ai-widget__compare-handle span::after {
  right: 2px;
  transform: translateY(-50%) rotate(45deg);
}

.smd-ai-widget__compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 6;
}

@keyframes smd-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1024px) {
  .smd-ai-widget {
    --smd-stage-height: 500px;
    --smd-upload-stage-height: 400px;
    --smd-upload-panel-height: 400px;
    --smd-upload-dropzone-height: 220px;
    --smd-compare-max-width: 720px;
    --smd-processing-width: 100%;
    --smd-processing-height: 540px;
  }

  .smd-ai-widget__upload-layout {
    grid-template-columns: 1fr;
  }

  .smd-ai-widget__preview-shell {
    min-height: 260px;
  }

  .smd-ai-widget__upload-shell {
    min-height: 240px;
  }

  .smd-ai-widget__dropzone {
    min-height: var(--smd-upload-dropzone-height);
  }

  .smd-ai-widget__card,
  .smd-ai-widget__processing-card,
  .smd-ai-widget__result-card {
    min-height: var(--smd-stage-height);
  }
}

@media (max-width: 767px) {
  .smd-ai-widget {
    --smd-stage-height: 420px;
    --smd-upload-stage-height: 220px;
    --smd-upload-panel-height: 220px;
    --smd-upload-dropzone-height: 178px;
    --smd-compare-max-width: 100%;
    --smd-processing-width: 100%;
    --smd-processing-height: 420px;
  }

  .smd-ai-widget__upload-layout {
    gap: 14px;
    min-height: auto;
  }

  .smd-ai-widget__preview-shell {
    min-height: var(--smd-upload-panel-height);
  }

  .smd-ai-widget__upload-shell {
    padding: 12px;
    min-height: 220px;
  }

  .smd-ai-widget__dropzone {
    min-height: 178px;
    padding: 18px 14px;
    border-radius: 12px;
  }

  .smd-ai-widget__dropzone strong {
    font-size: 18px;
  }

  .smd-ai-widget__form-grid {
    grid-template-columns: 1fr;
  }

  .smd-ai-widget__title {
    font-size: 20px;
  }

  .smd-ai-widget__progress-row {
    flex-direction: column;
  }

  .smd-ai-widget__button {
    width: 100%;
  }

  .smd-ai-widget__compare {
    width: 100%;
    border-radius: 18px;
    height: auto;
  }

  .smd-ai-widget__card,
  .smd-ai-widget__processing-card,
  .smd-ai-widget__result-card {
    min-height: auto;
    padding: 18px;
  }
}
