/**
 * DrawLeague Image Optimization Styles
 * Supports lazy loading, LQIP, and responsive images
 */

/* Image Loading States */
img.img-placeholder {
  filter: blur(10px);
  transition: filter 300ms ease-out;
}

img.img-loaded {
  filter: blur(0);
}

/* Responsive Image Container */
.img-container {
  position: relative;
  overflow: hidden;
  background: var(--color-light-blue);
  border-radius: var(--radius-md);
}

.img-container img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Aspect Ratio Helpers - Prevent layout shift */
.img-16-9 {
  aspect-ratio: 16 / 9;
}

.img-4-3 {
  aspect-ratio: 4 / 3;
}

.img-1-1 {
  aspect-ratio: 1 / 1;
}

.img-21-9 {
  aspect-ratio: 21 / 9;
}

/* Picture element (for modern browsers with WebP) */
picture {
  display: block;
}

picture img {
  display: block;
  width: 100%;
  height: auto;
}

/**
 * DrawLeague Micro-copy and Micro-interactions
 * Improves UX clarity and delight
 */

/* Help text and hints under form fields */
.field-hint {
  display: block;
  margin-top: var(--space-sm);
  color: var(--color-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Form error messages with better styling */
.form-error {
  background-color: rgba(220, 38, 38, 0.1);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  color: #b91c1c;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.form-error[role="alert"] {
  animation: slideDown 250ms ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Success message */
.form-success {
  background-color: rgba(34, 197, 94, 0.1);
  border: 1px solid #86efac;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  color: #166534;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.5;
  animation: slideDown 250ms ease-out;
}

/* Loading states */
.loading-spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-muted);
  font-size: 0.9375rem;
}

/* Progress bar for uploads */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
  margin: var(--space-md) 0;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover));
  border-radius: 2px;
  transition: width 150ms ease;
  width: 0%;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--color-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  display: block;
}

.empty-state__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.empty-state__description {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

/* Tooltips and popovers */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip::after {
  content: attr(data-tooltip);
  visibility: hidden;
  background-color: var(--color-text);
  color: white;
  text-align: center;
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  position: absolute;
  z-index: 1001;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 200ms ease;
  box-shadow: var(--shadow-lg);
}

.tooltip:hover::after {
  visibility: visible;
  opacity: 1;
}

/* Call-to-Action Improvement */
.cta-context {
  display: block;
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-top: var(--space-sm);
  font-style: italic;
}

.cta-context--secondary {
  font-size: 0.8125rem;
  margin-top: var(--space-xs);
}

/* Animated link */
.link-animated {
  position: relative;
  text-decoration: none;
  color: var(--color-accent);
  font-weight: 500;
  transition: color 150ms ease;
}

.link-animated::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: var(--color-accent);
  transition: width 200ms ease;
}

.link-animated:hover,
.link-animated:focus-visible {
  color: var(--color-accent-hover);
}

.link-animated:hover::after,
.link-animated:focus-visible::after {
  width: 100%;
}

/* Badge animations */
.badge-pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Transition utilities for progressive enhancement */
.transition-smooth {
  transition: all 200ms ease;
}

.transition-fast {
  transition: all 100ms ease;
}

.transition-slow {
  transition: all 400ms ease;
}
