/**
 * ============================================================================
 * BLAZE SPORTS INTEL - ENHANCED COMPONENT LIBRARY
 * ============================================================================
 * Version: 3.0.0
 * Description: Premium component library implementing ESPN GameCenter × Fintech UI
 * Dependencies: blaze-design-system-enhanced.css
 * Last Updated: 2025-01-20
 * ============================================================================
 */

/**
 * ============================================================================
 * 1. GAME CARD COMPONENTS
 * ============================================================================
 * Premium game cards with team identity, live indicators, and win probability
 */

/* Base Game Card */
.game-card {
  position: relative;
  background: var(--glass-surface-light);
  backdrop-filter: blur(var(--glass-blur-md));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--rhythm-md);
  box-shadow: var(--shadow-card);
  transition: all var(--duration-normal) var(--ease-smooth);
  overflow: hidden;
}

/* Elevated cards for live games */
.game-card--elevated {
  background: var(--glass-surface-medium);
  box-shadow: var(--shadow-card-elevated);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Live game cards with electric border */
.game-card--live {
  border: 2px solid var(--color-live-primary);
  box-shadow:
    var(--shadow-card-elevated),
    var(--shadow-glow-live-md);
  animation: live-pulse 2s ease-in-out infinite;
}

/* Completed game cards (de-emphasized) */
.game-card--completed {
  opacity: 0.4;
  filter: saturate(0.5);
  transition: all var(--duration-normal) var(--ease-smooth);
}

.game-card--completed:hover {
  opacity: 0.7;
  filter: saturate(1);
}

/* Hover states */
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
}

.game-card--live:hover {
  box-shadow:
    var(--shadow-card-hover),
    var(--shadow-glow-live-lg);
}

/* Team color accent strip */
.card-accent-strip {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--team-color, var(--color-brand-primary)) 0%,
    var(--team-color, var(--color-brand-primary)) 50%,
    transparent 50%,
    transparent 100%
  );
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Card header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--rhythm-sm);
  padding-bottom: var(--rhythm-xs);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Card body */
.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--rhythm-sm);
}

/* Card footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--rhythm-sm);
  padding-top: var(--rhythm-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--font-size-sm);
  color: var(--color-text-quaternary);
}

/**
 * ============================================================================
 * 2. LIVE INDICATOR BADGES
 * ============================================================================
 * Electric red badges with pulse animations
 */

/* Base live badge */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--gradient-live);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-glow-live-sm);
  transition: all var(--duration-fast) var(--ease-smooth);
}

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

/* Live dot indicator */
.live-dot {
  display: block;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: live-dot-blink 1s ease-in-out infinite;
}

/* Bright variant for high-visibility */
.live-badge--bright {
  background: var(--color-live-bright);
  box-shadow: var(--shadow-glow-live-md);
}

/* Subtle variant for secondary indicators */
.live-badge--subtle {
  background: rgba(255, 45, 85, 0.2);
  color: var(--color-live-primary);
  border: 1px solid var(--color-live-primary);
  box-shadow: none;
}

/**
 * ============================================================================
 * 3. GAME TIME & STATUS
 * ============================================================================
 * Clear, high-contrast time displays
 */

.game-time {
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--color-text-secondary);
  letter-spacing: 0.025em;
}

.game-time--live {
  color: var(--color-live-primary);
  font-weight: 700;
}

.game-status {
  font-size: var(--font-size-xs);
  color: var(--color-text-quaternary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/**
 * ============================================================================
 * 4. TEAM DISPLAY
 * ============================================================================
 * Team names, logos, and identity colors
 */

.team-container {
  display: flex;
  align-items: center;
  gap: var(--rhythm-sm);
  padding: var(--rhythm-xs) 0;
}

.team-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--glass-surface-light);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.team-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Team color indicator */
.team-color-indicator {
  width: 4px;
  height: 40px;
  background: var(--team-color, var(--color-team-home));
  border-radius: var(--radius-full);
  margin-right: var(--rhythm-xs);
  flex-shrink: 0;
}

.team-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0; /* Enable text truncation */
}

.team-name {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-record {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Home/Away indicators */
.team-location {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  color: var(--color-text-quaternary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.team-location--home::before {
  content: "●";
  color: var(--color-team-home);
}

.team-location--away::before {
  content: "○";
  color: var(--color-team-away);
}

/**
 * ============================================================================
 * 5. SCORE DISPLAY
 * ============================================================================
 * Large, bold scores with optical sizing
 */

.score-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rhythm-md);
  margin: var(--rhythm-sm) 0;
}

.score {
  font-size: var(--font-size-3xl);
  font-weight: 900;
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Featured score (larger for top live game) */
.score--featured {
  font-size: var(--font-size-4xl);
}

/* Winning team score */
.score--winning {
  color: var(--color-success);
  text-shadow: 0 0 16px rgba(34, 197, 94, 0.3);
}

/* Score separator */
.score-separator {
  font-size: var(--font-size-2xl);
  color: var(--color-text-quaternary);
  font-weight: 300;
}

/**
 * ============================================================================
 * 6. WIN PROBABILITY DISPLAY
 * ============================================================================
 * Neon green gradient bars with percentage
 */

.win-probability-container {
  display: flex;
  flex-direction: column;
  gap: var(--rhythm-xs);
  margin-top: var(--rhythm-sm);
}

.win-probability-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-quaternary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.win-probability-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  font-family: var(--font-heading);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px currentColor;
}

/* Color coding based on probability */
.win-probability-value--high {
  color: var(--color-win-high);
}

.win-probability-value--medium {
  color: var(--color-win-medium);
}

.win-probability-value--low {
  color: var(--color-win-low);
}

/* Progress bar */
.win-probability-bar {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.win-probability-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-smooth);
}

.win-probability-fill--high {
  background: linear-gradient(90deg, var(--color-win-high) 0%, var(--color-success) 100%);
  box-shadow: 0 0 12px var(--color-win-high);
}

.win-probability-fill--medium {
  background: linear-gradient(90deg, var(--color-win-medium) 0%, #FFA500 100%);
  box-shadow: 0 0 12px var(--color-win-medium);
}

.win-probability-fill--low {
  background: linear-gradient(90deg, var(--color-win-low) 0%, #4B5563 100%);
}

/**
 * ============================================================================
 * 7. BUTTON COMPONENTS
 * ============================================================================
 * Tactile buttons with clear states
 */

/* Base button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: var(--font-size-base);
  font-weight: 600;
  font-family: var(--font-heading);
  letter-spacing: 0.025em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  white-space: nowrap;
  user-select: none;
}

/* Primary button */
.btn-primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow:
    0 4px 12px rgba(191, 87, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 20px rgba(191, 87, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow:
    0 2px 8px rgba(191, 87, 0, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Secondary button */
.btn-secondary {
  background: var(--glass-surface-medium);
  color: var(--color-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: var(--glass-surface-heavy);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Ghost button */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--color-text-primary);
}

/* Small button variant */
.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
}

/* Large button variant */
.btn-lg {
  padding: 16px 32px;
  font-size: var(--font-size-lg);
}

/* Icon-only button */
.btn-icon {
  padding: 12px;
  aspect-ratio: 1;
}

/* Button with icon */
.btn-icon-left {
  padding-left: 20px;
}

.btn-icon-right {
  padding-right: 20px;
}

/* Disabled state */
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/**
 * ============================================================================
 * 8. NAVIGATION COMPONENTS
 * ============================================================================
 * Quick action links and breadcrumbs
 */

.quick-actions {
  display: flex;
  gap: var(--rhythm-xs);
  margin-top: var(--rhythm-sm);
  flex-wrap: wrap;
}

.quick-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.quick-action-link:hover {
  color: var(--color-brand-primary);
  background: rgba(255, 107, 0, 0.1);
  border-color: var(--color-brand-primary);
}

/**
 * ============================================================================
 * 9. NETWORK & BROADCAST INFO
 * ============================================================================
 * De-emphasized tertiary information
 */

.network-info {
  display: flex;
  align-items: center;
  gap: var(--rhythm-xs);
  font-size: var(--font-size-xs);
  color: var(--color-text-quaternary);
}

.network-logo {
  height: 16px;
  width: auto;
  opacity: 0.7;
}

/**
 * ============================================================================
 * 10. LOADING & EMPTY STATES
 * ============================================================================
 * Skeleton loaders and empty state messaging
 */

/* Skeleton loader */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-card {
  height: 200px;
  width: 100%;
}

.skeleton-text {
  height: 16px;
  width: 100%;
  margin-bottom: 8px;
}

.skeleton-text--short {
  width: 60%;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--rhythm-xl);
  text-align: center;
  min-height: 300px;
}

.empty-state-icon {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: var(--rhythm-md);
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--rhythm-xs);
}

.empty-state-description {
  font-size: var(--font-size-base);
  color: var(--color-text-tertiary);
  max-width: 400px;
}

/**
 * ============================================================================
 * 11. RESPONSIVE UTILITIES
 * ============================================================================
 * Mobile, tablet, and desktop optimizations
 */

/* Mobile (<640px) */
@media (max-width: 639px) {
  .game-card {
    padding: var(--rhythm-sm);
  }

  .score {
    font-size: var(--font-size-2xl);
  }

  .score--featured {
    font-size: var(--font-size-3xl);
  }

  .team-name {
    font-size: var(--font-size-base);
  }

  .team-logo {
    width: 40px;
    height: 40px;
  }

  .win-probability-value {
    font-size: var(--font-size-xl);
  }

  .btn {
    padding: 10px 20px;
    font-size: var(--font-size-sm);
  }
}

/* Tablet (640px - 1024px) */
@media (min-width: 640px) and (max-width: 1023px) {
  .game-card {
    padding: 20px;
  }

  .score {
    font-size: 2.5rem;
  }

  .team-logo {
    width: 44px;
    height: 44px;
  }
}

/* Desktop (>1024px) */
@media (min-width: 1024px) {
  .game-card {
    padding: var(--rhythm-md);
  }

  .game-card:hover {
    transform: translateY(-6px);
  }
}

/**
 * ============================================================================
 * 12. ACCESSIBILITY ENHANCEMENTS
 * ============================================================================
 * Focus states and keyboard navigation
 */

/* Focus visible styles for all interactive elements */
.game-card:focus-visible,
.btn:focus-visible,
.quick-action-link:focus-visible {
  outline: 3px solid var(--color-brand-primary);
  outline-offset: 2px;
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-brand-primary);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: 10000;
  transition: top var(--duration-fast) var(--ease-smooth);
}

.skip-link:focus {
  top: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .live-badge--pulse,
  .live-dot,
  .game-card--live {
    animation: none;
  }

  .game-card:hover,
  .btn:hover {
    transform: none;
  }

  .skeleton {
    animation: none;
  }
}

/**
 * ============================================================================
 * 13. PRINT STYLES
 * ============================================================================
 * Optimized for printing game summaries
 */

@media print {
  .game-card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }

  .live-badge,
  .btn,
  .quick-actions {
    display: none;
  }

  .game-card--completed {
    opacity: 1;
    filter: none;
  }

  .score {
    color: #000;
  }
}
