@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

:root {
  /* Brand Colors */
  --brand-primary: #203F9A;
  --brand-blue-1: #0654A7;
  --brand-blue-2: #0171BC;
  --brand-blue-3: #0196DA;
  --brand-dark: #222121;
  --brand-orange: #FF7C10;

  /* Dark Theme Colors */
  --bg-primary: #214788;
  --bg-secondary: #0f1419;
  --bg-card: rgba(30, 41, 59, 0.6);
  --bg-card-hover: rgba(30, 41, 59, 0.8);

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #ecf0f1;
  --text-muted: #64748b;

  /* Status Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-blue-1) 100%);
  --gradient-blue: linear-gradient(135deg, var(--brand-blue-2) 0%, var(--brand-blue-3) 100%);
  --gradient-orange: linear-gradient(135deg, var(--brand-orange) 0%, #ff9642 100%);
  --gradient-progress: linear-gradient(90deg, var(--brand-blue-2), var(--brand-blue-3));

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Professional Animated Gradient Background */
  background: linear-gradient(-45deg, #7898e2, #286675, #2c4da0, #1c545e);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Subtle Dot Pattern */
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
  z-index: -1;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

body {
  min-height: 100vh;
}

/* Glassmorphism Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(59, 130, 246, 0.3);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Badge Styles */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-bronze {
  background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
  color: white;
}

.badge-silver {
  background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 100%);
  color: #1f2937;
}

.badge-gold {
  background: var(--gradient-gold);
  color: #1f2937;
}

.badge-platinum {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  color: #1f2937;
  box-shadow: 0 0 15px rgba(229, 231, 235, 0.5);
}

/* Avatar */
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(59, 130, 246, 0.3);
  background: var(--gradient-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
}

/* Utilities */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* When exactly 2 cards exist */
.grid-auto-fit:has(> :nth-child(2)):not(:has(> :nth-child(3))) {
  grid-template-columns: repeat(2, minmax(200px, 1fr));
}

@media (min-width: 640px) {
  .grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

@media (min-width: 1024px) {
  .grid-auto-fit {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Text Utilities */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

/* Ticker/Marquee */
@keyframes scroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

.ticker-wrap {
  width: 100%;
  overflow: hidden;
  background: rgba(59, 130, 246, 0.1);
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  padding: var(--space-sm) 0;
}

.ticker {
  display: flex;
  animation: scroll 30s linear infinite;
}

.ticker-item {
  white-space: nowrap;
  padding: 0 var(--space-xl);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.5);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.7);
}

/* Card Highlighting */
.card-top-performer {
  border: 2px solid #10b981 !important;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.5) !important;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.1), rgba(6, 78, 59, 0.2)) !important;
}

.card-lowest-performer {
  border: 2px solid #ef4444 !important;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.5) !important;
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.1), rgba(127, 29, 29, 0.2)) !important;
}

/* --- Responsive Dashboard Styles (TV & Single Screen Mode) --- */

/* Root Layout for TV Mode */
.app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header should not grow */
.app-header {
  flex-shrink: 0;
}

/* Ticker container should not grow and stay at bottom */
.app-ticker {
  flex-shrink: 0;
  position: relative !important;
  bottom: auto !important;
}

/* Main Grid Container fills remaining space */
.dashboard-grid-container {
  flex: 1;
  overflow: hidden;
  padding: 0.5vh 1vw 8vh 1vw;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.grid-auto-fit {
  height: 100%;
  width: 100%;
  align-content: center;
}

/* Compact Performance Card */
.performance-card {
  height: clamp(250px, 48vh, 500px);
  min-height: 0;
  padding: clamp(0.5rem, 1.25vh, 1.25rem);

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  background: linear-gradient(145deg, rgba(20, 30, 48, 0.95), rgba(36, 59, 85, 0.95));
  border: 1px solid rgba(1, 150, 218, 0.15);
  border-radius: clamp(0.5rem, 1vh, 1rem);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Profile Section */
.card-profile-section {
  text-align: center;
  margin-bottom: 0.5vh;
  flex-shrink: 0;
}

.card-avatar-container {
  width: clamp(60px, 10vh, 100px);
  height: clamp(60px, 10vh, 100px);
  margin: 0 auto 0.5vh;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(1, 150, 218, 0.3);
}

.card-name-text {
  font-size: clamp(0.9rem, 2.2vh, 1.25rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0.25vh 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-team-name {
  font-size: clamp(0.7rem, 1.4vh, 0.9rem);
  color: var(--brand-blue-3);
  font-weight: 500;
}

/* Stats Section */
.card-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5vh;
  flex-shrink: 0;
}

.stat-box {
  padding: clamp(0.4rem, 1.25vh, 1rem);
  border-radius: 0.75rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
  font-size: clamp(0.55rem, 1.1vh, 0.7rem);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25vh;
}

.stat-value {
  font-size: clamp(1.25rem, 3.5vh, 2rem);
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* Revenue/Progress Section */
.card-revenue-section {
  background: rgba(255, 255, 255, 0.04);
  padding: clamp(0.5rem, 1.25vh, 1rem);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.5vh;
  flex-grow: 1;
}

.revenue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.revenue-label {
  font-size: clamp(0.65rem, 1.2vh, 0.75rem);
  color: #aaa;
}

.revenue-value {
  font-size: clamp(0.75rem, 1.4vh, 0.85rem);
  font-weight: 700;
}

@keyframes gradient-animation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}
