/**
 * Recent Form Component - Modern, Clean Design
 * Inspired by esports stats (Tracker.gg, OP.GG style)
 */

/* ============================================================================
   RECENT FORM CARD
   ============================================================================ */

.recent-form-card {
  background: var(--bg-card, #1a1d29);
  border: 1px solid var(--border, #2d3142);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.recent-form-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    #10b981 0%, 
    #10b981 50%, 
    #22d3ee 100%
  );
}

/* ============================================================================
   HEADER
   ============================================================================ */

.recent-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.recent-form-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #f0f0f0);
  margin: 0;
}

.recent-form-title .icon {
  font-size: 1.125rem;
}

.recent-form-view-all {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent, #22d3ee);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.recent-form-view-all:hover {
  background: rgba(34, 211, 238, 0.1);
  color: var(--accent);
}

/* ============================================================================
   MATCH SEQUENCE (Last 5)
   ============================================================================ */

.form-sequence-section {
  margin-bottom: 1.5rem;
}

.form-sequence-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted, #8b92a8);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.form-sequence {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.form-result-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.form-result-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.form-result-badge:hover {
  transform: translateY(-3px) scale(1.05);
}

.form-result-badge.win {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
  color: #10b981;
  border: 2px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.form-result-badge.loss {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
  color: #ef4444;
  border: 2px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.form-result-badge.current {
  box-shadow: 0 0 0 3px var(--accent, #22d3ee), 0 4px 12px rgba(16, 185, 129, 0.3);
}

.form-result-badge.current::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent, #22d3ee);
  border-radius: 50%;
}

.form-result-icon {
  font-size: 1.125rem;
  font-weight: 700;
}

.form-result-letter {
  font-size: 0.875rem;
}

/* ============================================================================
   STATS GRID
   ============================================================================ */

.form-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.form-stat-box {
  background: var(--bg-elevated, #232735);
  border: 1px solid var(--border, #2d3142);
  border-radius: 12px;
  padding: 1rem 0.75rem;
  text-align: center;
  transition: all 0.2s ease;
}

.form-stat-box:hover {
  border-color: var(--accent, #22d3ee);
  transform: translateY(-2px);
}

.form-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.375rem;
}

.form-stat-value.win {
  color: #10b981;
}

.form-stat-value.loss {
  color: #ef4444;
}

.form-stat-value.neutral {
  color: var(--text, #f0f0f0);
}

.form-stat-value.positive {
  color: #10b981;
}

.form-stat-value.negative {
  color: #ef4444;
}

.form-stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted, #8b92a8);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.form-stat-sublabel {
  font-size: 0.75rem;
  color: var(--text-muted, #8b92a8);
}

/* ============================================================================
   STREAK DISPLAY
   ============================================================================ */

.form-streak-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-elevated, #232735);
  border-radius: 12px;
  border: 1px solid var(--border, #2d3142);
}

.streak-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  line-height: 1;
}

.streak-icon .ui-icon {
  width: 18px;
  height: 18px;
}

.streak-content {
  flex: 1;
}

.streak-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted, #8b92a8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.streak-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text, #f0f0f0);
}

.streak-value.winning {
  color: #10b981;
}

.streak-value.losing {
  color: #ef4444;
}

.streak-value.neutral {
  color: var(--text-muted, #8b92a8);
}

/* ============================================================================
   MINI RATING TREND CHART
   ============================================================================ */

.form-mini-chart {
  height: 40px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding-top: 0.5rem;
}

.form-mini-chart-bar {
  flex: 1;
  min-height: 4px;
  border-radius: 2px;
  background: var(--accent, #22d3ee);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.form-mini-chart-bar:hover {
  opacity: 1;
}

.form-mini-chart-bar.win {
  background: #10b981;
}

.form-mini-chart-bar.loss {
  background: #ef4444;
}

.form-mini-chart-bar.current {
  background: var(--accent, #22d3ee);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.5);
}

/* ============================================================================
   MATCH TOOLTIP
   ============================================================================ */

.form-result-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card, #1a1d29);
  border: 1px solid var(--border, #2d3142);
  border-radius: 12px;
  padding: 0.875rem;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.form-result-badge:hover .form-result-tooltip {
  opacity: 1;
  visibility: visible;
}

.form-result-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border, #2d3142);
}

.tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border, #2d3142);
}

.tooltip-result {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.tooltip-result.win {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.tooltip-result.loss {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.tooltip-date {
  font-size: 0.75rem;
  color: var(--text-muted, #8b92a8);
}

.tooltip-opponent {
  font-size: 0.8125rem;
  color: var(--text, #f0f0f0);
  margin-bottom: 0.375rem;
  font-weight: 500;
}

.tooltip-score {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent, #22d3ee);
}

.tooltip-elo {
  font-size: 0.75rem;
  color: var(--text-muted, #8b92a8);
  margin-top: 0.375rem;
}

.tooltip-elo.positive {
  color: #10b981;
}

.tooltip-elo.negative {
  color: #ef4444;
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */

.recent-form-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted, #8b92a8);
}

.recent-form-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.recent-form-empty-icon .ui-icon {
  width: 32px;
  height: 32px;
}

.recent-form-empty-text {
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
  color: var(--text, #f0f0f0);
}

.recent-form-empty-subtext {
  font-size: 0.8125rem;
  opacity: 0.7;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes formBadgePop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.form-result-badge {
  animation: formBadgePop 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.form-result-item:nth-child(1) .form-result-badge { animation-delay: 0ms; }
.form-result-item:nth-child(2) .form-result-badge { animation-delay: 80ms; }
.form-result-item:nth-child(3) .form-result-badge { animation-delay: 160ms; }
.form-result-item:nth-child(4) .form-result-badge { animation-delay: 240ms; }
.form-result-item:nth-child(5) .form-result-badge { animation-delay: 320ms; }

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

.streak-icon.fire {
  animation: streakPulse 1.5s ease-in-out infinite;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 576px) {
  .recent-form-card {
    padding: 1rem;
  }
  
  .recent-form-title {
    font-size: 0.9375rem;
  }
  
  .form-sequence {
    gap: 0.5rem;
  }
  
  .form-result-badge {
    width: 38px;
    height: 38px;
    font-size: 0.875rem;
  }
  
  .form-stats-grid {
    gap: 0.5rem;
  }
  
  .form-stat-box {
    padding: 0.75rem 0.5rem;
  }
  
  .form-stat-value {
    font-size: 1.375rem;
  }
  
  .form-stat-label {
    font-size: 0.625rem;
  }
  
  .form-result-tooltip {
    min-width: 160px;
    padding: 0.625rem;
  }
}

@media (max-width: 400px) {
  .form-result-badge {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
  
  .form-stat-value {
    font-size: 1.125rem;
  }
}
