/**
 * ═══════════════════════════════════════════════════════════════════════════
 * BLAZE SPORTS INTEL - COMPONENT LIBRARY
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * Production-grade component library for blazesportsintel.com
 * Version: 2.0.0
 * Dependencies: blaze-design-system.css
 *
 * Components:
 * - Cards (game cards, data cards, interactive cards)
 * - Buttons (primary, secondary, ghost, danger)
 * - Badges (status, tags, labels)
 * - Tables (data tables, standings, statistics)
 * - Loading States (skeletons, spinners, progress bars)
 * - Toast Notifications
 * - Modals
 * - Tooltips
 * ═══════════════════════════════════════════════════════════════════════════
 */

@import url('blaze-design-system.css');

/* ========================================================================== */
/* 1. CARD COMPONENTS                                                         */
/* ========================================================================== */

.blaze-card {
  background: var(--glass-bg-light);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--transition-duration-base) var(--transition-timing-ease-out);
  position: relative;
  overflow: hidden;
}

.blaze-card-interactive {
  cursor: pointer;
}

.blaze-card-interactive:hover {
  background: var(--glass-bg-medium);
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-brand-primary);
}

.blaze-card-interactive:hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-brand-primary);
  animation: shimmer 1.5s infinite;
}

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

.blaze-card-elevated {
  box-shadow: var(--shadow-lg);
}

.blaze-card-elevated:hover {
  box-shadow: var(--shadow-2xl);
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--glass-border);
}

.card-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1-5) var(--space-3);
  background: var(--color-brand-primary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
}

/* Card Body */
.card-body {
  margin-bottom: var(--space-4);
}

/* Card Footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--glass-border);
}

/* Game Card Specific */
.game-card {
  composes: blaze-card blaze-card-interactive;
}

.game-card.live {
  border-color: var(--color-error);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
  animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
  }
}

.game-matchup {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  transition: background var(--transition-duration-fast) var(--transition-timing-ease-out);
}

.team:hover {
  background: rgba(255, 255, 255, 0.05);
}

.team.winner {
  background: rgba(191, 87, 0, 0.1);
}

.team-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.team-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.team-conference {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

.team-record {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  color: var(--text-quaternary);
}

.team-score {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-brand-primary);
  min-width: 4rem;
  text-align: center;
}

.team.winner .team-score {
  color: var(--color-brand-tertiary);
  animation: score-flash 0.5s ease-out;
}

@keyframes score-flash {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
    text-shadow: 0 0 20px var(--color-brand-primary);
  }
  100% {
    transform: scale(1);
  }
}

/* ========================================================================== */
/* 2. BUTTON COMPONENTS                                                       */
/* ========================================================================== */

.blaze-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-duration-base) var(--transition-timing-ease-out);
  position: relative;
  overflow: hidden;
}

.blaze-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button */
.blaze-btn-primary {
  background: var(--gradient-brand-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
}

.blaze-btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-brand-secondary);
  opacity: 0;
  transition: opacity var(--transition-duration-base) var(--transition-timing-ease-out);
}

.blaze-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-md);
}

.blaze-btn-primary:hover::before {
  opacity: 0.4;
}

.blaze-btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

/* Secondary Button */
.blaze-btn-secondary {
  background: var(--glass-bg-medium);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.blaze-btn-secondary:hover {
  background: var(--glass-bg-heavy);
  border-color: var(--color-brand-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.blaze-btn-secondary:active {
  transform: translateY(0);
}

/* Ghost Button */
.blaze-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

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

/* Danger Button */
.blaze-btn-danger {
  background: var(--color-error);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
}

.blaze-btn-danger:hover {
  background: var(--color-error-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Success Button */
.blaze-btn-success {
  background: var(--color-success);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
}

.blaze-btn-success:hover {
  background: var(--color-success-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Button Sizes */
.blaze-btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
}

.blaze-btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

/* Button Group */
.blaze-btn-group {
  display: inline-flex;
  gap: var(--space-2);
}

/* ========================================================================== */
/* 3. BADGE COMPONENTS                                                        */
/* ========================================================================== */

.blaze-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1-5) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
}

.blaze-badge-primary {
  background: var(--color-brand-primary);
  color: var(--text-primary);
}

.blaze-badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.blaze-badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

.blaze-badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
  border: 1px solid var(--color-warning);
}

.blaze-badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: var(--color-info);
  border: 1px solid var(--color-info);
}

.blaze-badge-live {
  background: linear-gradient(135deg, var(--color-error) 0%, var(--color-error-dark) 100%);
  color: var(--text-primary);
  animation: pulse-live 2s ease-in-out infinite;
}

.blaze-badge-live::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--text-primary);
  border-radius: 50%;
  margin-right: var(--space-1);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ========================================================================== */
/* 4. DATA TABLE COMPONENTS                                                   */
/* ========================================================================== */

.blaze-table-container {
  width: 100%;
  overflow-x: auto;
  background: var(--glass-bg-light);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
}

.blaze-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.blaze-table thead {
  background: rgba(191, 87, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.blaze-table th {
  padding: var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  white-space: nowrap;
  border-bottom: 2px solid var(--glass-border);
}

.blaze-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 11;
  background: rgba(191, 87, 0, 0.2);
}

.blaze-table td {
  padding: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.blaze-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--glass-bg-light);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  font-weight: var(--font-weight-medium);
}

.blaze-table tbody tr {
  transition: background var(--transition-duration-fast) var(--transition-timing-ease-out);
}

.blaze-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.blaze-table tbody tr:hover td:first-child {
  background: rgba(255, 255, 255, 0.08);
}

.blaze-table tbody tr.highlight {
  background: rgba(191, 87, 0, 0.1);
}

/* Sortable Columns */
.blaze-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.blaze-table th.sortable:hover {
  background: rgba(191, 87, 0, 0.3);
}

.blaze-table th.sortable::after {
  content: '↕';
  margin-left: var(--space-2);
  opacity: 0.3;
}

.blaze-table th.sortable.asc::after {
  content: '↑';
  opacity: 1;
}

.blaze-table th.sortable.desc::after {
  content: '↓';
  opacity: 1;
}

/* Monospace Numbers */
.blaze-table .stat-cell {
  font-family: var(--font-family-mono);
  text-align: right;
  tabular-nums;
}

/* ========================================================================== */
/* 5. LOADING STATES                                                          */
/* ========================================================================== */

/* 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: shimmer-skeleton 1.5s infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-line {
  height: 1rem;
  margin-bottom: var(--space-2);
}

.skeleton-line:last-child {
  width: 60%;
}

.skeleton-circle {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

.skeleton-card {
  padding: var(--space-6);
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
}

/* Spinner */
.blaze-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.blaze-spinner-lg {
  width: 3rem;
  height: 3rem;
  border-width: 4px;
}

/* Progress Bar */
.blaze-progress {
  width: 100%;
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.blaze-progress-bar {
  height: 100%;
  background: var(--gradient-brand-primary);
  transition: width var(--transition-duration-base) var(--transition-timing-ease-out);
}

.blaze-progress-bar.indeterminate {
  width: 30%;
  animation: progress-indeterminate 1.5s infinite;
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}

/* ========================================================================== */
/* 6. TOAST NOTIFICATIONS                                                     */
/* ========================================================================== */

.blaze-toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-index-notification);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
}

.blaze-toast {
  padding: var(--space-4) var(--space-5);
  background: var(--glass-bg-heavy);
  backdrop-filter: blur(var(--glass-blur-heavy));
  -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  display: flex;
  align-items: start;
  gap: var(--space-3);
  animation: toast-slide-in 0.3s var(--transition-timing-ease-out);
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.blaze-toast.dismissing {
  animation: toast-slide-out 0.3s var(--transition-timing-ease-out);
}

@keyframes toast-slide-out {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.blaze-toast-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: var(--font-size-sm);
}

.blaze-toast-success .blaze-toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.blaze-toast-error .blaze-toast-icon {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-error);
}

.blaze-toast-warning .blaze-toast-icon {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}

.blaze-toast-info .blaze-toast-icon {
  background: rgba(59, 130, 246, 0.2);
  color: var(--color-info);
}

.blaze-toast-content {
  flex: 1;
}

.blaze-toast-title {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.blaze-toast-message {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.blaze-toast-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-duration-fast) var(--transition-timing-ease-out);
}

.blaze-toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Mobile */
@media (max-width: 768px) {
  .blaze-toast-container {
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }
}

/* ========================================================================== */
/* 7. MODAL COMPONENTS                                                        */
/* ========================================================================== */

.blaze-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-index-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fade-in 0.2s var(--transition-timing-ease-out);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.blaze-modal {
  background: var(--color-background-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  animation: modal-slide-up 0.3s var(--transition-timing-ease-out);
}

@keyframes modal-slide-up {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.blaze-modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.blaze-modal-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0;
}

.blaze-modal-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: var(--space-2);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--transition-duration-fast) var(--transition-timing-ease-out);
}

.blaze-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.blaze-modal-body {
  padding: var(--space-6);
}

.blaze-modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ========================================================================== */
/* 8. TOOLTIP COMPONENTS                                                      */
/* ========================================================================== */

.blaze-tooltip {
  position: absolute;
  z-index: var(--z-index-tooltip);
  padding: var(--space-2) var(--space-3);
  background: rgba(0, 0, 0, 0.95);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-duration-fast) var(--transition-timing-ease-out);
  white-space: nowrap;
  max-width: 200px;
}

.blaze-tooltip.show {
  opacity: 1;
}

.blaze-tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}

.blaze-tooltip[data-position="top"] .blaze-tooltip-arrow {
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: rgba(0, 0, 0, 0.95);
}

.blaze-tooltip[data-position="bottom"] .blaze-tooltip-arrow {
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: rgba(0, 0, 0, 0.95);
}

.blaze-tooltip[data-position="left"] .blaze-tooltip-arrow {
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: rgba(0, 0, 0, 0.95);
}

.blaze-tooltip[data-position="right"] .blaze-tooltip-arrow {
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: rgba(0, 0, 0, 0.95);
}

/* ========================================================================== */
/* END OF COMPONENT LIBRARY                                                   */
/* ========================================================================== */
