/* ==========================================
   SCORESFOOTY DESIGN SYSTEM
   Mobile-first, sports-broadcast inspired
   ========================================== */

/* === CUSTOM PROPERTIES === */
:root {
  /* Typography */
  --font-display: 'Barlow Condensed', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Light Background */
  --color-bg-from: #f8fafc;
  --color-bg-via: #eff6ff;
  --color-bg-to: #f1f5f9;

  /* Brand Colors - Enhanced */
  --color-live: #10b981;
  --color-live-glow: #34d399;
  --color-finished: #64748b;
  --color-upcoming: #3b82f6;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  /* Accent Colors */
  --color-home: #6366f1;
  --color-away: #ec4899;

  /* Surfaces */
  --surface-card: rgba(255, 255, 255, 0.95);
  --surface-card-hover: rgba(255, 255, 255, 1);
  --surface-elevated: rgba(255, 255, 255, 0.98);
  --surface-glass: rgba(255, 255, 255, 0.8);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Spacing - Mobile optimized */
  --spacing-touch: 44px; /* iOS recommended minimum */
  --spacing-tight: 8px;
  --spacing-base: 16px;
  --spacing-relaxed: 24px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-base: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* === BASE STYLES === */
* {
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === UTILITY CLASSES === */

/* Light Background - Simple and Clean */
.bg-light {
  background: linear-gradient(135deg, var(--color-bg-from) 0%, var(--color-bg-via) 50%, var(--color-bg-to) 100%);
}

/* Typography Utilities */
.font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.font-body {
  font-family: var(--font-body);
}

.text-scoreboard {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  letter-spacing: 0.05em;
  line-height: 1;
}

/* === ANIMATIONS === */

/* Live Pulse */
@keyframes live-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.animate-live-pulse {
  animation: live-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Score Pop */
@keyframes score-pop {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.15);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

.animate-score-pop {
  animation: score-pop var(--transition-bounce);
}

/* Shimmer Loading */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.animate-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.2) 20%,
    rgba(255, 255, 255, 0.5) 60%,
    rgba(255, 255, 255, 0)
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Slide Up */
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-up {
  animation: slide-up var(--transition-base) ease-out;
}

/* Stagger animations */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }

/* === COMPONENT STYLES === */

/* Match Card */
.match-card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-base);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.match-card:hover {
  background: var(--surface-card-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.match-card:active {
  transform: translateY(0);
  box-shadow: var(--shadow-base);
}

/* Live indicator glow */
.live-glow {
  position: relative;
}

.live-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, var(--color-live), var(--color-live-glow));
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
  filter: blur(8px);
}

.live-glow.is-live::before {
  opacity: 0.3;
  animation: live-pulse 2s ease-in-out infinite;
}

/* Score Display */
.score-display {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Touch-friendly buttons */
.btn-touch {
  min-height: var(--spacing-touch);
  min-width: var(--spacing-touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-weight: 600;
  transition: all var(--transition-base);
  user-select: none;
  -webkit-user-select: none;
}

.btn-touch:active {
  transform: scale(0.95);
}

/* Glass morphism */
.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-live {
  background: linear-gradient(135deg, var(--color-live), var(--color-live-glow));
  color: white;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  animation: live-pulse 2s ease-in-out infinite;
}

.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
  animation: live-pulse 1.5s ease-in-out infinite;
}

.badge-finished {
  background: linear-gradient(135deg, #64748b, #475569);
  color: white;
}

.badge-upcoming {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(96, 165, 250, 0.1));
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Skeleton Loaders */
.skeleton {
  background: linear-gradient(
    90deg,
    #f1f5f9 0%,
    #e2e8f0 20%,
    #f1f5f9 40%,
    #f1f5f9 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-base);
}

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

/* Safe areas for iOS notch */
@supports (padding: max(0px)) {
  .safe-top {
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .safe-bottom {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .safe-left {
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .safe-right {
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* === MOBILE-SPECIFIC === */
@media (max-width: 640px) {
  .match-card {
    border-radius: var(--radius-base);
  }

  /* Increase touch targets on mobile */
  .btn-touch {
    min-height: 48px;
  }
}

/* === PRINT STYLES === */
@media print {
  .no-print {
    display: none !important;
  }

  .match-card {
    break-inside: avoid;
  }
}

/* === ACCESSIBILITY === */

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Improved focus states for buttons and links */
button:focus-visible,
a:focus-visible,
.btn-touch:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Form inputs focus */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 0;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .match-card {
    border: 2px solid currentColor;
  }

  .badge {
    border: 2px solid currentColor;
  }
}
