/* ==========================================================================
   ACTIVE GENERATION FLOATING WIDGET (Persistent Across Navigation & Refresh)
   ========================================================================== */

.active-gen-widget {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 17, 26, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(236, 72, 153, 0.42);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 22px rgba(236, 72, 153, 0.22);
  cursor: pointer;
  max-width: 380px;
  user-select: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  animation: widgetSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes widgetSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes widgetSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
}

.active-gen-widget.slide-out {
  animation: widgetSlideOut 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
  pointer-events: none;
}

.active-gen-widget:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(236, 72, 153, 0.75);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 30px rgba(236, 72, 153, 0.4);
}

.active-gen-widget:active {
  transform: translateY(-1px) scale(0.99);
}

/* Thumbnail with Radar Ring */
.active-gen-thumb-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(236, 72, 153, 0.4);
  background: #0d0f17;
}

.active-gen-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.9);
}

.active-gen-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.1);
}

.active-gen-radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 2px solid transparent;
  border-top-color: var(--accent-pink);
  animation: spinRadar 1.4s linear infinite;
  pointer-events: none;
}

@keyframes spinRadar {
  to {
    transform: rotate(360deg);
  }
}

.active-gen-check-badge {
  position: absolute;
  inset: 0;
  background: rgba(16, 185, 129, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.6rem;
  color: #fff;
  border: 2px solid #10b981;
  animation: checkPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Info Details */
.active-gen-body {
  flex: 1;
  min-width: 0;
}

.active-gen-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.active-gen-mode {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-gen-status-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.active-gen-status-pill::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-pink);
  animation: pulseDot 1.2s infinite ease-in-out;
}

.active-gen-status-pill.success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.active-gen-status-pill.success::before {
  display: none;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Mini Progress Bar */
.active-gen-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 4px 0;
  position: relative;
}

.active-gen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #3b82f6);
  border-radius: 999px;
  transition: width 0.4s ease;
  position: relative;
}

.active-gen-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmerWidget 1.5s infinite;
}

.active-gen-progress-fill.is-done {
  background: #10b981 !important;
  box-shadow: 0 0 10px #10b981;
}

.active-gen-progress-fill.is-done::after {
  display: none;
}

@keyframes shimmerWidget {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.active-gen-hint {
  font-size: 0.74rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.active-gen-hint-link {
  color: #f472b6;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s ease;
}

.active-gen-widget:hover .active-gen-hint-link {
  color: #fff;
}

/* Arrow / Action Indicator */
.active-gen-arrow {
  color: var(--accent-pink);
  font-size: 1.3rem;
  transition: transform 0.2s ease;
}

.active-gen-widget:hover .active-gen-arrow {
  transform: translateX(3px);
}

.active-gen-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: color 0.15s ease, background 0.15s ease;
  margin-left: 2px;
}

.active-gen-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Completed State */
.active-gen-widget.is-completed {
  border-color: rgba(16, 185, 129, 0.7);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75), 0 0 30px rgba(16, 185, 129, 0.35);
  animation: completeFlash 0.5s ease-out;
}

@keyframes completeFlash {
  0% { transform: scale(0.97); box-shadow: 0 0 50px rgba(16, 185, 129, 0.8); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.active-gen-widget.is-completed:hover {
  border-color: #10b981;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.8), 0 0 35px rgba(16, 185, 129, 0.5);
}

.active-gen-widget.is-completed .active-gen-arrow {
  color: #10b981;
}

.active-gen-widget.is-completed .active-gen-hint-link {
  color: #34d399;
}

/* Mobile Positioning: Bottom Center (Naturally Centered & Clear of Support FAB) */
@media (max-width: 768px) {
  .active-gen-widget {
    left: 16px !important;
    right: 16px !important;
    margin: 0 auto !important;
    bottom: 84px !important;
    width: auto !important;
    max-width: 380px !important;
    box-sizing: border-box !important;
    padding: 10px 14px !important;
    transform: none !important;
    animation: widgetSlideInMobile 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  }

  .active-gen-thumb-wrap {
    width: 44px;
    height: 44px;
    border-radius: 8px;
  }

  .active-gen-mode {
    font-size: 0.78rem;
    max-width: 140px;
  }

  .active-gen-status-pill {
    font-size: 0.65rem;
    padding: 1px 6px;
  }

  .active-gen-hint {
    font-size: 0.71rem;
  }

  .active-gen-widget:hover {
    transform: translateY(-2px) !important;
  }

  .active-gen-widget:active {
    transform: scale(0.98) !important;
  }

  @keyframes widgetSlideInMobile {
    from {
      opacity: 0;
      transform: translateY(20px) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @keyframes widgetSlideOutMobile {
    from {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    to {
      opacity: 0;
      transform: translateY(20px) scale(0.96);
    }
  }

  .active-gen-widget.slide-out {
    animation: widgetSlideOutMobile 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
  }
}
