/* ============================================================
   Digital Wingzz — Floating Mascot Widget
   Add this file's contents to your theme (or link it) AFTER
   elementor-post-191-custom.css so it isn't overridden.
   ============================================================ */

#dw-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999999;
  font-family: "Poppins", Arial, sans-serif;
}

/* ---- Floating button + ping rings ---- */
#dw-widget-btn {
  position: relative;
  width: 78px;
  height: 78px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#dw-widget-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(230, 126, 20, 0.45));
  position: relative;
  z-index: 3;
  transition: transform 0.25s ease;
}

#dw-widget-btn:hover img {
  transform: translateY(-3px) scale(1.04);
}

/* ping rings — the "pinging from right side" pulse */
#dw-widget-btn::before,
#dw-widget-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(247, 147, 30, 0.55);
  transform: scale(1);
  animation: dw-ping 2.2s cubic-bezier(0, 0, 0.3, 1) infinite;
  z-index: 1;
}
#dw-widget-btn::after {
  animation-delay: 1.1s;
}

@keyframes dw-ping {
  0% {
    transform: scale(0.85);
    opacity: 0.65;
  }
  70% {
    transform: scale(1.55);
    opacity: 0;
  }
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

/* little "need a service?" nudge bubble */
#dw-nudge {
  position: absolute;
  right: 90px;
  bottom: 18px;
  background: #fff;
  color: #2b2b2b;
  padding: 10px 16px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(10px);
  animation:
    dw-nudge-in 0.4s ease 1.4s forwards,
    dw-nudge-out 0.4s ease 6s forwards;
  pointer-events: none;
}
#dw-nudge::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: #fff;
}
@keyframes dw-nudge-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes dw-nudge-out {
  to {
    opacity: 0;
    transform: translateX(10px);
  }
}

/* ---- Popup panel ---- */
#dw-panel {
  position: absolute;
  right: 0;
  bottom: 96px;
  width: 300px;
  max-width: 86vw;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: dw-panel-in 0.25s ease;
}
#dw-panel.dw-open {
  display: flex;
}

@keyframes dw-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#dw-panel-head {
  background: linear-gradient(135deg, #f7931e, #f15a24);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#dw-panel-head img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
#dw-panel-head .dw-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}
#dw-panel-head .dw-sub {
  font-size: 12px;
  opacity: 0.9;
}
#dw-panel-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

#dw-panel-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dw-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #f0e3d3;
  background: #fff8f1;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.dw-option:hover {
  border-color: #f7931e;
  background: #fff1e2;
  transform: translateX(2px);
}
.dw-option .dw-emoji {
  font-size: 22px;
}
.dw-option .dw-opt-title {
  font-weight: 600;
  font-size: 14px;
  color: #2b2b2b;
}
.dw-option .dw-opt-sub {
  font-size: 12px;
  color: #7a7a7a;
}

/* ---- Avatar generator view ---- */
#dw-avatar-view {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}
#dw-avatar-view.dw-open {
  display: flex;
}

#dw-avatar-view label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
}
#dw-avatar-view textarea {
  resize: none;
  height: 56px;
  border: 1px solid #e6d9c7;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}
#dw-avatar-view textarea:focus {
  outline: none;
  border-color: #f7931e;
}

.dw-back-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.dw-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #f15a24;
  padding: 0;
}
.dw-back-row span {
  font-size: 13px;
  font-weight: 600;
  color: #2b2b2b;
}

#dw-generate-btn {
  background: linear-gradient(135deg, #f7931e, #f15a24);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#dw-generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#dw-avatar-result {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
#dw-avatar-result.dw-open {
  display: flex;
}
#dw-avatar-result img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #eee;
}
#dw-avatar-result a {
  font-size: 12px;
  font-weight: 600;
  color: #f15a24;
  text-decoration: none;
}

#dw-avatar-loading {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #7a7a7a;
  padding: 6px 0;
}
#dw-avatar-loading.dw-open {
  display: flex;
}
.dw-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #f0e3d3;
  border-top-color: #f15a24;
  border-radius: 50%;
  animation: dw-spin 0.7s linear infinite;
}
@keyframes dw-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 480px) {
  #dw-widget {
    right: 14px;
    bottom: 14px;
  }
  #dw-widget-btn {
    width: 64px;
    height: 64px;
  }
  #dw-panel {
    width: 88vw;
  }
  #dw-nudge {
    display: none;
  }
}

/* ---- Photo upload for astronaut avatar ---- */
#dw-avatar-view label {
  display: block;
  margin: 2px 0 0;
}
#dw-avatar-view label small {
  font-weight: 400;
  color: #7a7a7a;
}
.dw-upload-box {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px dashed #f7931e;
  border-radius: 10px;
  background: #fff8f1;
  color: #3d3d3d !important;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.dw-upload-box:hover {
  background: #fff1e2;
  border-color: #f15a24;
}
.dw-upload-box strong {
  font-size: 12px;
}
.dw-upload-box small {
  font-size: 11px;
  color: #777;
}
.dw-upload-icon {
  font-size: 25px;
  line-height: 1;
}
#dw-upload-preview-wrap {
  position: relative;
  display: none;
  width: 100%;
}
#dw-upload-preview-wrap.dw-open {
  display: block;
}
#dw-upload-preview {
  display: block;
  width: 100%;
  max-height: 145px;
  object-fit: cover;
  border: 1px solid #eee;
  border-radius: 10px;
}
#dw-remove-upload {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 50%;
  background: #2b2b2b;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.dw-privacy-note {
  margin: -2px 0 0;
  color: #777;
  font-size: 10px;
  line-height: 1.35;
}

/* ---- Astronaut page-entry landing animation ---- */
#dw-widget-btn.dw-astronaut-landing {
  pointer-events: none;
  animation: dw-astronaut-land 1.8s cubic-bezier(0.18, 0.78, 0.22, 1) both;
}

/* The mascot flies in from the right, then bounces into its widget position. */
@keyframes dw-astronaut-land {
  0% {
    opacity: 0;
    transform: translate3d(125vw, -12px, 0) rotate(25deg) scale(0.55);
  }
  12% {
    opacity: 1;
  }
  58% {
    transform: translate3d(-13px, 8px, 0) rotate(-7deg) scale(1.06);
  }
  71% {
    transform: translate3d(17px, -10px, 0) rotate(4deg) scale(0.98);
  }
  84% {
    transform: translate3d(-7px, 4px, 0) rotate(-2deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0) scale(1);
  }
}

/* Brief landing dust/glow under the astronaut. */
#dw-widget-btn.dw-astronaut-landing::before {
  animation: dw-landing-glow 1.8s ease-out both;
}
#dw-widget-btn.dw-astronaut-landing::after {
  animation: dw-landing-glow 1.8s 0.1s ease-out both;
}
@keyframes dw-landing-glow {
  0%,
  44% {
    opacity: 0;
    transform: scale(0.4);
  }
  61% {
    opacity: 0.62;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}

@media (prefers-reduced-motion: reduce) {
  #dw-widget-btn.dw-astronaut-landing {
    animation: none;
  }
  #dw-widget-btn.dw-astronaut-landing::before,
  #dw-widget-btn.dw-astronaut-landing::after {
    animation: none;
  }
}
