/**
 * SpeedBadge Component Styles
 * Glass morphism design with builder-hub theme compatibility
 *
 * Colors (palette-compliant):
 * - Primary: #22D3EE (cyan-400)
 * - Success: #22C55E (green-500)
 * - Text: #F5F7FA (slate-50)
 * - Glass: rgba(255, 255, 255, 0.08)
 */

.speed-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 9999px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: #F5F7FA;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease-in-out;
}

/* Size variants */
.speed-badge--sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  gap: 0.375rem;
}

.speed-badge--sm .speed-badge-icon {
  width: 14px;
  height: 14px;
}

.speed-badge--md {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  gap: 0.5rem;
}

.speed-badge--md .speed-badge-icon {
  width: 16px;
  height: 16px;
}

/* Hover state */
.speed-badge:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.15),
              0 3px 6px -1px rgba(0, 0, 0, 0.08),
              0 0 0 1px rgba(34, 211, 238, 0.15);
}

/* Loading state */
.speed-badge--loading {
  opacity: 0.7;
}

.speed-badge--loading .speed-badge-icon {
  animation: speed-badge-pulse 1.5s ease-in-out infinite;
}

@keyframes speed-badge-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Update animation (motion-safe only) */
@media (prefers-reduced-motion: no-preference) {
  .speed-badge--updated {
    animation: speed-badge-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  @keyframes speed-badge-pop {
    0% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.05);
    }
    100% {
      transform: scale(1);
    }
  }
}

/* Icon styling */
.speed-badge-icon {
  flex-shrink: 0;
  color: #22D3EE;
  stroke-width: 2.5;
}

.speed-badge--loading .speed-badge-icon {
  color: #FCD34D; /* yellow-300 */
}

/* Text styling */
.speed-badge-text {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 300px;
  line-height: 1.2;
}

/* Dark theme compatibility */
@media (prefers-color-scheme: dark) {
  .speed-badge {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(34, 211, 238, 0.25);
  }

  .speed-badge:hover {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(34, 211, 238, 0.4);
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .speed-badge {
    background: rgba(0, 0, 0, 0.9);
    border-width: 2px;
    border-color: #22D3EE;
  }

  .speed-badge-text {
    font-weight: 600;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .speed-badge,
  .speed-badge-icon {
    animation: none !important;
    transition: none !important;
  }
}

/* Print styles */
@media print {
  .speed-badge {
    display: none;
  }
}

/* Container positioning helper */
.speed-badge-container {
  position: relative;
  display: inline-block;
}

.speed-badge-container .speed-badge {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.5rem;
  z-index: 50;
}

/* Inline variant (for prompt bars) */
.speed-badge--inline {
  position: static;
  margin-left: 0.5rem;
}
