/* ===================================
   🏓 CPBC Tablet Interface Design
   Modern, Clean & Professional
   =================================== */

/* ===== CSS VARIABLES ===== */
:root {
  /* Primary Colors */
  --primary-50: #f0fdf4;
  --primary-100: #dcfce7;
  --primary-200: #bbf7d0;
  --primary-300: #86efac;
  --primary-400: #4ade80;
  --primary-500: #22c55e;
  --primary-600: #16a34a;
  --primary-700: #15803d;
  --primary-800: #166534;
  --primary-900: #14532d;

  /* Secondary Colors */
  --secondary-50: #eff6ff;
  --secondary-100: #dbeafe;
  --secondary-200: #bfdbfe;
  --secondary-300: #93c5fd;
  --secondary-400: #60a5fa;
  --secondary-500: #3b82f6;
  --secondary-600: #2563eb;
  --secondary-700: #1d4ed8;
  --secondary-800: #1e40af;
  --secondary-900: #1e3a8a;

  /* Accent Colors */
  --accent-50: #fefce8;
  --accent-100: #fef9c3;
  --accent-200: #fef08a;
  --accent-300: #fde047;
  --accent-400: #facc15;
  --accent-500: #eab308;
  --accent-600: #ca8a04;
  --accent-700: #a16207;
  --accent-800: #854d0e;
  --accent-900: #713f12;

  /* Neutral Colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Status Colors */
  --success-50: #f0fdf4;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --info-50: #eff6ff;
  --info-500: #3b82f6;
  --info-600: #2563eb;

  /* Typography */
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family-sans);
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 50%, #581c87 100%);
  color: white;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== LAYOUT COMPONENTS ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ===== TABLET HEADER ===== */
.tablet-header {
  text-align: center;
  margin-bottom: var(--space-8);
  padding: var(--space-6);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-2xl);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-xl);
}

.tablet-header h1 {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: var(--space-2);
  background: linear-gradient(135deg, #60a5fa, #f87171);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.tablet-header p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

/* ===== CARD COMPONENTS ===== */
.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2xl);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--gray-200);
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-subtitle {
  color: var(--gray-600);
  font-size: 0.875rem;
  margin-top: var(--space-1);
}

/* ===== SCORE DISPLAY ===== */
.score-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-8);
  align-items: center;
  padding: var(--space-8);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  margin-bottom: var(--space-8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.team-display {
  text-align: center;
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  transition: all var(--transition-normal);
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
}

.team-display.serving {
  background: linear-gradient(135deg, var(--accent-100), var(--accent-200));
  border: 2px solid var(--accent-500);
  box-shadow: 0 0 30px rgba(234, 179, 8, 0.3);
  color: var(--accent-900);
}

.team-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
  color: rgba(255, 255, 255, 0.9);
}

.team-display.serving .team-name {
  color: var(--accent-900);
}

.team-players {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: var(--space-4);
  line-height: 1.4;
}

.team-display.serving .team-players {
  color: var(--accent-800);
}

.team-score {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-fast);
}

.team1 .team-score {
  color: #60a5fa;
}

.team2 .team-score {
  color: #f87171;
}

.vs-divider {
  font-size: 2rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== STATUS INDICATORS ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-live {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  animation: pulse 2s infinite;
}

.status-paused {
  background: rgba(251, 191, 36, 0.2);
  color: #f59e0b;
}

.status-completed {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ===== TIMER DISPLAY ===== */
.timer-display {
  font-family: var(--font-family-mono);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  padding: var(--space-4);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
  color: white;
}

.timer-display.warning {
  border-color: var(--warning-500);
  background: rgba(251, 191, 36, 0.2);
  color: #f59e0b;
}

.timer-display.critical {
  border-color: var(--error-500);
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  animation: pulse 1s infinite;
}

.timer-display.expired {
  border-color: var(--error-600);
  background: rgba(239, 68, 68, 0.3);
  color: #fecaca;
  animation: flash 0.5s infinite;
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== BUTTON COMPONENTS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 48px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-slow);
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Button Variants */
.btn-primary {
  background: rgba(59, 130, 246, 0.8);
  color: white;
}

.btn-primary:hover {
  background: rgba(59, 130, 246, 0.9);
}

.btn-secondary {
  background: rgba(239, 68, 68, 0.8);
  color: white;
}

.btn-secondary:hover {
  background: rgba(239, 68, 68, 0.9);
}

.btn-success {
  background: rgba(34, 197, 94, 0.8);
  color: white;
}

.btn-success:hover {
  background: rgba(34, 197, 94, 0.9);
}

.btn-warning {
  background: rgba(251, 191, 36, 0.8);
  color: white;
}

.btn-warning:hover {
  background: rgba(251, 191, 36, 0.9);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled::before {
  display: none;
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-6) var(--space-8);
  font-size: 1.125rem;
  min-height: 56px;
}

/* ===== GRID SYSTEM ===== */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto-fit-sm { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-auto-fit-md { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ===== CONTROL BUTTONS ===== */
.control-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}

/* ===== GAME HISTORY & UPCOMING ===== */
.game-history-card {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  backdrop-filter: blur(20px);
  transition: all var(--transition-normal);
}

.game-history-card:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.game-history-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.game-item {
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.game-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.game-item:last-child {
  margin-bottom: 0;
}

.game-players {
  font-weight: 600;
  color: white;
  margin-bottom: var(--space-1);
}

.game-score {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-1);
}

.game-time {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.game-winner {
  font-size: 0.75rem;
  color: var(--success-400);
  font-weight: 500;
}

/* ===== MODAL COMPONENTS ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.modal-body {
  padding: var(--space-6);
  color: var(--gray-800);
}

.modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ===== ALERTS ===== */
.alert {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  font-weight: 500;
  border-left: 4px solid;
  backdrop-filter: blur(10px);
}

.alert-success {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border-color: var(--success-500);
}

.alert-warning {
  background: rgba(251, 191, 36, 0.2);
  color: #f59e0b;
  border-color: var(--warning-500);
}

.alert-error {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: var(--error-500);
}

.alert-info {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  border-color: var(--info-500);
}

/* ===== LOADING STATES ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10);
  color: rgba(255, 255, 255, 0.8);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== FORM COMPONENTS ===== */
.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 600;
  color: white;
  font-size: 0.875rem;
}

.form-input {
  width: 100%;
  padding: var(--space-4);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transition: all var(--transition-fast);
  font-family: inherit;
  backdrop-filter: blur(10px);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  background: rgba(255, 255, 255, 0.15);
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .container {
    padding: 0 var(--space-4);
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-3);
  }
  
  .tablet-header {
    padding: var(--space-4);
  }
  
  .tablet-header h1 {
    font-size: 2rem;
  }
  
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .score-container {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  
  .team-score {
    font-size: 3rem;
  }
  
  .card {
    padding: var(--space-6);
  }
  
  .control-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .tablet-header {
    padding: var(--space-3);
  }
  
  .tablet-header h1 {
    font-size: 1.75rem;
  }
  
  .card {
    padding: var(--space-4);
  }
  
  .btn {
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
  }
  
  .team-score {
    font-size: 2.5rem;
  }
  
  .control-buttons {
    grid-template-columns: 1fr;
  }
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.m-0 { margin: 0; }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* ===== SPECIAL EFFECTS ===== */
.score-flash {
  animation: scoreFlash 0.5s ease-in-out;
}

@keyframes scoreFlash {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); background-color: rgba(34, 197, 94, 0.3); }
  100% { transform: scale(1); }
}

.serving-indicator {
  position: relative;
}

.serving-indicator::after {
  content: '🏓';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 1.5rem;
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* ===== TABLET SPECIFIC STYLES ===== */
.tablet-locked {
  pointer-events: none;
  opacity: 0.7;
  filter: blur(2px);
}

.tablet-locked::after {
  content: '🔒 Tablet Locked - Timer Expired';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: var(--space-8);
  border-radius: var(--radius-xl);
  font-size: 1.5rem;
  font-weight: 700;
  z-index: 9999;
  pointer-events: all;
}

/* ===== NO GAME STATE ===== */
.no-game-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
}

.no-game-icon {
  width: 8rem;
  height: 8rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-6);
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.6);
}

.no-game-title {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-4);
}

.no-game-description {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-8);
  font-size: 1.125rem;
}