/**
 * HAWK MEDIA — FLOATING CALLBACK WIDGET
 * Apple-inspired minimalist design system, glassmorphism, responsive positioning
 */

/* 1. Floating Launcher Button */
.hm-callback-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #182848 0%, #0d172e 100%);
  border: 1.5px solid rgba(252, 163, 17, 0.4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(252, 163, 17, 0.15);
  z-index: 9990;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.25s ease, 
              border-color 0.25s ease,
              visibility 0s linear;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.hm-callback-launcher:hover {
  transform: scale(1.06);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(252, 163, 17, 0.3);
  border-color: var(--hm-amber, #FCA311);
}

.hm-callback-launcher:active {
  transform: scale(0.95);
}

.hm-callback-launcher:focus-visible {
  outline: 2px solid var(--hm-amber, #FCA311);
  outline-offset: 4px;
}

/* Launcher Icon Glyphs */
.hm-callback-launcher svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--hm-amber, #FCA311);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.hm-callback-launcher.is-open svg.icon-chat {
  transform: scale(0) rotate(-90deg);
  opacity: 0;
  position: absolute;
}

.hm-callback-launcher svg.icon-close {
  transform: scale(0) rotate(90deg);
  opacity: 0;
  position: absolute;
}

.hm-callback-launcher.is-open svg.icon-close {
  transform: scale(1) rotate(0deg);
  opacity: 1;
  stroke: #ffffff;
}

/* Pulsing Status Dot */
.hm-callback-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--hm-amber, #FCA311);
  border: 2px solid #0d172e;
  border-radius: 50%;
  animation: hmPulseDot 2.4s infinite cubic-bezier(0.45, 0, 0.55, 1);
}

.hm-callback-launcher.is-open .hm-callback-dot {
  display: none;
}

@keyframes hmPulseDot {
  0% { box-shadow: 0 0 0 0 rgba(252, 163, 17, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(252, 163, 17, 0); }
  100% { box-shadow: 0 0 0 0 rgba(252, 163, 17, 0); }
}

/* 2. Callback Popup Window */
.hm-callback-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: rgba(14, 22, 44, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.08) inset;
  z-index: 9995;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.92) translateY(16px);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
}

.hm-callback-window.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

/* Window Header */
.hm-cb-header {
  padding: 20px 22px 16px;
  background: linear-gradient(180deg, rgba(20, 33, 61, 0.6) 0%, rgba(14, 22, 44, 0) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  flex-shrink: 0;
}

.hm-cb-title-wrap h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px 0;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hm-cb-title-wrap h3::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hm-amber, #FCA311);
}

.hm-cb-title-wrap p {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.45;
  margin: 0;
}

.hm-cb-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  outline: none;
  flex-shrink: 0;
  margin-left: 12px;
}

.hm-cb-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: scale(1.05);
}

.hm-cb-close-btn:focus-visible {
  outline: 2px solid var(--hm-amber, #FCA311);
}

/* Window Form Body */
.hm-cb-body {
  padding: 18px 22px 22px;
  overflow-y: auto;
  max-height: calc(100vh - 240px);
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.hm-cb-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hm-cb-field label {
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  justify-content: space-between;
}

.hm-cb-field label .opt {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
}

.hm-cb-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  transition: all 0.2s ease;
  outline: none;
  min-height: 44px;
  box-sizing: border-box;
}

.hm-cb-input:focus {
  border-color: var(--hm-amber, #FCA311);
  box-shadow: 0 0 0 3px rgba(252, 163, 17, 0.2);
  background: rgba(0, 0, 0, 0.5);
}

.hm-cb-input.is-invalid {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.hm-cb-error-msg {
  font-size: 0.72rem;
  color: #f87171;
  display: none;
}

.hm-cb-input.is-invalid + .hm-cb-error-msg {
  display: block;
}

textarea.hm-cb-input {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

/* Global Alert in Callback Form */
.hm-cb-alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  display: none;
}

/* Submit Button */
.hm-cb-submit {
  width: 100%;
  height: 48px;
  background: var(--hm-amber, #FCA311);
  color: #000;
  border: none;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 18px rgba(252, 163, 17, 0.25);
  margin-top: 4px;
  outline: none;
}

.hm-cb-submit:hover:not(:disabled) {
  background: #e5930e;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(252, 163, 17, 0.35);
}

.hm-cb-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.hm-cb-submit:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.hm-cb-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Success State */
.hm-cb-success {
  display: none;
  padding: 44px 24px;
  text-align: center;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.hm-cb-success.is-active {
  display: flex;
}

.hm-cb-check-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(40, 167, 69, 0.15);
  border: 2px solid #28a745;
  color: #28a745;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  animation: checkPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes checkPop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.hm-cb-success h4 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.hm-cb-success p {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.55;
  margin: 0;
  max-width: 280px;
}

/* Fullscreen Particle Dissolve Overlay */
.hm-particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10000;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .hm-callback-launcher {
    bottom: 18px;
    right: 18px;
    width: 54px;
    height: 54px;
  }

  .hm-callback-window {
    bottom: 84px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 100px);
    border-radius: 16px;
  }

  .hm-cb-header {
    padding: 16px 18px 14px;
  }

  .hm-cb-body {
    padding: 14px 18px 18px;
    max-height: calc(100vh - 180px);
  }
}

/* --------------------------------------------------------------------------
   Smart Floating Widget Suppression State (Overlay-Aware System)
   Fades out and moves subtly downward on modal open; restores on modal close.
   -------------------------------------------------------------------------- */
.hm-callback-launcher.is-suppressed {
  opacity: 0 !important;
  transform: translateY(20px) scale(0.92) !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              visibility 0.28s step-end !important;
}

/* Defense-in-depth: Body overlay state guarantee */
body.has-modal-open .hm-callback-launcher,
body.has-modal-open .hm-callback-window,
.modal-backdrop.is-active ~ .hm-callback-root .hm-callback-launcher,
.modal-backdrop.is-active ~ .hm-callback-root .hm-callback-window {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transform: translateY(20px) scale(0.92) !important;
}

/* Accessibility: Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .hm-callback-launcher.is-suppressed,
  body.has-modal-open .hm-callback-launcher {
    transition: none !important;
    transform: none !important;
  }
}

