/**
 * Generation Status Pill
 * Shows AI thinking status during image generation
 * Small frosted pill anchored bottom-right, expands left with text
 */

/* Container - positioned at bottom-right of generation area */
.generation-status-pill-container {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  padding: 8px;
  
  /* GPU acceleration for smooth pan/zoom */
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

/* The status pill - anchored right, expands left */
.generation-status-pill {
  --gs-pill-scale: 1;
  --gs-pill-opacity: 1;
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  
  /* 70% transparent frosted background */
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  
  /* Subtle border for definition */
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50px;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.06);
  
  /* Tight sizing - auto width based on content, compact base size */
  padding: 5px 8px 5px 12px;
  height: 24px;
  white-space: nowrap;
  
  /* Text styling - smaller base for proportional scaling */
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1px;
  color: rgba(0, 0, 0, 0.8);
  text-align: center;
  
  /* Anchor to right - expand left */
  transform-origin: right bottom;
  transform: scale(var(--gs-pill-scale));
  opacity: var(--gs-pill-opacity);
  
  /* GPU acceleration for smooth updates */
  will-change: transform, opacity;
  backface-visibility: hidden;
  
  /* Prevent text selection */
  user-select: none;
  -webkit-user-select: none;
}

/* Subtle breathing animation */
.generation-status-pill.active {
  animation: pill-breathe 2.5s ease-in-out infinite;
}

@keyframes pill-breathe {
  0%, 100% {
    opacity: calc(var(--gs-pill-opacity) * 0.85);
  }
  50% {
    opacity: var(--gs-pill-opacity);
  }
}

/* Status text with fade transition */
.generation-status-pill .status-text {
  display: inline-block;
  line-height: 1;
  text-align: center;
  transition: opacity 0.25s ease-out;
}

.generation-status-pill .status-text.fading {
  opacity: 0;
}

/* Spinning wheel - fixed on right side, compact, clickable for cancel */
.generation-status-pill .status-spinner {
  width: 10px;
  height: 10px;
  min-width: 10px;
  flex-shrink: 0;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  border-top-color: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  order: 1; /* Always on the right */
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  transition: all 0.2s ease;
}

/* Hover state - show red X circle */
.generation-status-pill .status-spinner:hover {
  animation: none;
  background: #ff4444;
  border-color: #ff4444;
  transform: scale(1.3);
}

.generation-status-pill .status-spinner:hover::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 1.5px;
  background: white;
  transform: translate(-50%, -50%) rotate(45deg);
}

.generation-status-pill .status-spinner:hover::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 1.5px;
  background: white;
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Cancel Confirmation Dialog - sleek pill style */
.generation-cancel-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08);
  
  padding: 16px 24px;
  
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  pointer-events: auto;
  
  animation: dialog-enter 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes dialog-enter {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.generation-cancel-dialog.exiting {
  animation: dialog-exit 0.2s ease-out forwards;
}

@keyframes dialog-exit {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
}

.generation-cancel-dialog-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.85);
  text-align: center;
  margin: 0;
}

.generation-cancel-dialog-buttons {
  display: flex;
  gap: 10px;
}

.generation-cancel-dialog-btn {
  padding: 8px 18px;
  border-radius: 20px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.generation-cancel-dialog-btn.cancel {
  background: #ff4444;
  color: white;
}

.generation-cancel-dialog-btn.cancel:hover {
  background: #e63333;
  transform: scale(1.02);
}

.generation-cancel-dialog-btn.continue {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.75);
}

.generation-cancel-dialog-btn.continue:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: scale(1.02);
}

@keyframes spinner-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Entry animation - from right */
.generation-status-pill.entering {
  animation: pill-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pill-enter {
  0% {
    opacity: 0;
    transform: scale(0.85) translateX(8px);
  }
  100% {
    opacity: var(--gs-pill-opacity, 1);
    transform: scale(var(--gs-pill-scale, 1)) translateX(0);
  }
}

/* Exit animation */
.generation-status-pill.exiting {
  animation: pill-exit 0.25s ease-out forwards;
}

@keyframes pill-exit {
  0% {
    opacity: var(--gs-pill-opacity, 1);
    transform: scale(var(--gs-pill-scale, 1));
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateX(6px);
  }
}

/* Hidden state */
.generation-status-pill.hidden {
  display: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .generation-status-pill {
    font-size: 10px;
    padding: 5px 8px 5px 12px;
    height: 24px;
    gap: 6px;
  }
  
  .generation-status-pill .status-spinner {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-width: 1.5px;
  }
  
  .generation-status-pill-container {
    padding: 6px;
  }
}
