/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores principales */
    --primary-color: #007aff;
    --primary-dark: #0056cc;
    --secondary-color: #ff3b30;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --info-color: #5ac8fa;
    
    /* Colores de fondo */
    --bg-primary: #ffffff;
    --bg-secondary: #f2f2f7;
    --bg-tertiary: #e5e5ea;
    --bg-dark: #1d1d1f;
    
    /* Colores de texto */
    --text-primary: #1d1d1f;
    --text-secondary: #8e8e93;
    --text-tertiary: #c7c7cc;
    --text-light: #ffffff;
    
    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    
    /* Bordes */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    /* Espaciado */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Tipografía */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Configuración base */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Contenedor */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Header PWA */
.pwa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pwa-menu-btn {
  background: none;
  border: none;
  color: #007aff;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-menu-btn:hover {
  background: rgba(0, 122, 255, 0.1);
  transform: scale(1.05);
}

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

.pwa-logo {
  width: 28px;
  height: 28px;
  margin-right: 0.75rem;
  border-radius: 6px;
}

.pwa-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-live-indicator {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.pwa-logout {
  background: #007aff;
  border: none;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-logout:hover:not(:disabled) {
  background: #0056cc;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.4);
}

.pwa-logout:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.3);
}

.pwa-logout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.pwa-logout:disabled svg {
  animation: spin 1s linear infinite;
}

.pwa-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}



.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-md);
}

.logo-text {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--secondary-color);
    color: var(--text-light);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-light);
    border-radius: 50%;
    animation: liveBlink 1.5s ease-in-out infinite;
}

.logo-icon-bg {
    width: 100px;
    height: 100px;
}

@keyframes liveBlink {
    0%, 50% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 6px rgba(255, 59, 48, 0.8);
    }
    51%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
        box-shadow: 0 0 3px rgba(255, 59, 48, 0.3);
    }
}

/* Main Content */
.main {
    min-height: calc(100vh - 200px);
    padding: var(--spacing-xl) 0;
}

/* Main PWA */
.pwa-main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 80px; /* Espacio para la navegación inferior */
}

.pwa-live-matches {
  padding: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

/* Estados de carga, error y vacío */
.loading-state,
.error-state,
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-md);
    max-width: 500px;
    margin: 0 auto;
}

/* Estados PWA */
.pwa-loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #8e8e93;
}

.pwa-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f2f2f7;
  border-top: 3px solid #007aff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.pwa-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #8e8e93;
}

.pwa-empty-state svg {
  margin-bottom: 1rem;
  color: #c7c7cc;
}

.pwa-empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 0.5rem 0;
}

.pwa-empty-state p {
  margin: 0 0 1.5rem 0;
}

.pwa-error-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #ff3b30;
}

.pwa-error-state svg {
  margin-bottom: 1rem;
  color: #ff3b30;
}

.pwa-error-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ff3b30;
  margin: 0 0 0.5rem 0;
}

.pwa-error-state p {
  margin: 0 0 1.5rem 0;
  color: #ff3b30;
}

.pwa-btn-secondary {
  background: #f2f2f7;
  color: #1d1d1f;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.pwa-btn-secondary:hover {
  background: #e5e5ea;
}

/* Clases para manejar visibilidad sin estilos inline */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Estados específicos */
.error-state.hidden,
.empty-state.hidden,
.live-matches.hidden,
.updating-indicator.hidden {
    display: none !important;
}

/* Notificaciones */
.warning-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff9500;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
    z-index: 10000;
    max-width: 300px;
    animation: slideInRight 0.3s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.warning-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animación suave para actualizaciones de partidos */
.match-card {
    transition: all 0.3s ease;
}

.matches-list {
    transition: opacity 0.2s ease;
}

.matches-list.updating {
    opacity: 0.8;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-icon,
.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
}

.error-state h2,
.empty-state h2 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.error-state p,
.empty-state p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.empty-info {
    background: var(--bg-primary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-lg);
    margin-top: var(--spacing-lg);
    text-align: left;
}

.empty-info p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.empty-info p:last-child {
    margin-bottom: 0;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-light);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Botón de actualizar con estados mejorados */
.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--bg-tertiary);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Estado de actualización del botón */
.btn-secondary.updating {
    background: var(--primary-color);
    color: var(--text-light);
    animation: updatingPulse 1.5s ease-in-out infinite;
}

.btn-secondary.updating .refresh-icon {
    animation: spin 1s linear infinite;
}

@keyframes updatingPulse {
    0%, 100% {
        background: var(--primary-color);
        transform: scale(1);
    }
    50% {
        background: var(--primary-dark);
        transform: scale(1.02);
    }
}

/* Indicador de actualización mejorado */
.updating-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--primary-color);
    font-size: var(--font-size-sm);
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
}

.updating-indicator:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.updating-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: updatingDot 1.5s ease-in-out infinite;
}

@keyframes updatingDot {
    0%, 50% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 6px rgba(0, 122, 255, 0.8);
    }
    51%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
        box-shadow: 0 0 3px rgba(0, 122, 255, 0.3);
    }
}

/* Mensaje de advertencia temporal */
.warning-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--warning-color);
    color: var(--text-light);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
    box-shadow: var(--shadow-md);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.refresh-icon {
    width: 16px;
    height: 16px;
}

.btn:disabled .refresh-icon {
    animation: spin 1s linear infinite;
}

/* Live Matches */
.live-matches {
    max-width: 800px;
    margin: 0 auto;
}

.live-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    gap: var(--spacing-md);
    text-align: center;
}

.live-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.live-title h2 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.live-subtitle {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.live-dot-small {
    width: 6px;
    height: 6px;
    background-color: white;
    border-radius: 50%;
    animation: liveBlink 1.5s ease-in-out infinite;
}

.updating-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--primary-color);
    font-weight: 600;
    animation: fadeInOut 1.5s ease-in-out infinite;
}

.auto-refresh-info {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: 400;
    margin-left: var(--spacing-sm);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    transition: all 0.3s ease;
}

.connection-dot.connected {
    background-color: #28a745;
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.4);
    animation: pulse 2s infinite;
}

.connection-dot.connecting {
    background-color: #ffc107;
    box-shadow: 0 0 6px rgba(255, 193, 7, 0.4);
    animation: pulse 1s infinite;
}

.connection-dot.error {
    background-color: #dc3545;
    box-shadow: 0 0 6px rgba(220, 53, 69, 0.4);
    animation: pulse 0.5s infinite;
}

.connection-dot.disconnected {
    background-color: var(--text-secondary);
    opacity: 0.5;
}

.connection-dot.polling {
    background-color: #17a2b8;
    box-shadow: 0 0 6px rgba(23, 162, 184, 0.4);
    animation: pulse 3s infinite;
}

.updating-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

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

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Lista de partidos */
.matches-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.match-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    transition: all 0.2s;
}

.match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.live-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #ff3b30;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
}

.match-header {
    margin-bottom: 1rem;
}

.match-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.match-details {
    font-size: 0.9rem;
    color: #8e8e93;
}

.match-score {
    margin-bottom: 1rem;
}

.score-display {
    background: #1a2330;
    border-radius: 12px;
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #2e3a4d;
    padding: 0.5rem 0;
}

.player-row:last-child {
    border-bottom: none;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
}

.player-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
}

.player-sets {
    display: flex;
    gap: 0.7rem;
    margin-left: auto;
    margin-right: 1.5rem;
}

.set-score {
    font-size: 1.3rem;
    color: #00eaff;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #8e8e93;
    margin-bottom: 1rem;
}

.last-update svg {
    width: 14px;
    height: 14px;
}

/* Footer */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--bg-tertiary);
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-2xl);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.footer-info p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-xs);
}

.footer-info p:last-child {
    margin-bottom: 0;
}

.last-update {
    font-weight: 500;
}

.footer-links {
    display: flex;
    gap: var(--spacing-md);
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .header-content {
        padding: var(--spacing-sm) 0;
    }
    
    .logo-text {
        font-size: var(--font-size-lg);
    }
    
    .live-header {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .live-title h2 {
        font-size: var(--font-size-xl);
    }
    
    .match-card {
        padding: var(--spacing-md);
    }
    
    .match-header {
        padding-right: 0;
        margin-bottom: var(--spacing-md);
    }
    
    .score-display {
        padding: var(--spacing-md);
    }
    
    .player-name {
        font-size: var(--font-size-base);
    }
    
    .set-score {
        font-size: var(--font-size-lg);
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-sm);
    }
    
    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main {
        padding: var(--spacing-md) 0;
    }
    
    .live-matches {
        padding: 0 var(--spacing-xs);
    }
    
    .match-card {
        padding: var(--spacing-sm);
    }
    
    .score-display {
        padding: var(--spacing-sm);
    }
    
    .player-sets {
        margin-right: var(--spacing-sm);
    }
}

/* Animaciones de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.match-card {
    animation: fadeInUp 0.6s ease-out;
}

.match-card:nth-child(1) { animation-delay: 0.1s; }
.match-card:nth-child(2) { animation-delay: 0.2s; }
.match-card:nth-child(3) { animation-delay: 0.3s; }
.match-card:nth-child(4) { animation-delay: 0.4s; }
.match-card:nth-child(5) { animation-delay: 0.5s; }

/* Estados de carga mejorados */
.loading-state {
    animation: fadeInUp 0.3s ease-out;
}

.error-state,
.empty-state {
    animation: fadeInUp 0.4s ease-out;
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Modo oscuro (opcional) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1d1d1f;
        --bg-secondary: #2c2c2e;
        --bg-tertiary: #3a3a3c;
        --text-primary: #ffffff;
        --text-secondary: #8e8e93;
        --text-tertiary: #48484a;
    }
}

/* Animaciones para actualizaciones específicas */
.match-card.updated {
    animation: updateFlash 0.3s ease-in-out;
}

@keyframes updateFlash {
    0% {
        background-color: var(--bg-primary);
    }
    50% {
        background-color: rgba(0, 122, 255, 0.1);
    }
    100% {
        background-color: var(--bg-primary);
    }
}

.set-score.updated {
    animation: scoreUpdate 0.5s ease-in-out;
    font-weight: bold;
    color: var(--primary-color);
}

@keyframes scoreUpdate {
    0% {
        transform: scale(1);
        color: var(--text-primary);
    }
    50% {
        transform: scale(1.2);
        color: var(--primary-color);
    }
    100% {
        transform: scale(1);
        color: var(--text-primary);
    }
}

/* Indicador de actualización en tiempo real */
.match-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--success-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.match-card.updated::after {
    opacity: 1;
    animation: updateIndicator 2s ease-in-out;
}

@keyframes updateIndicator {
    0% {
        opacity: 0;
        transform: scaleY(0);
    }
    50% {
        opacity: 1;
        transform: scaleY(1);
    }
    100% {
        opacity: 0;
        transform: scaleY(1);
    }
}

/* Animación para partidos nuevos */
.match-card.new-match {
    animation: newMatchHighlight 3s ease-out;
    border: 2px solid var(--success-color);
    box-shadow: 0 0 20px rgba(52, 199, 89, 0.3);
}

@keyframes newMatchHighlight {
    0% {
        transform: scale(1.02);
        border-color: var(--success-color);
        box-shadow: 0 0 30px rgba(52, 199, 89, 0.5);
    }
    50% {
        transform: scale(1.01);
        border-color: var(--success-color);
        box-shadow: 0 0 15px rgba(52, 199, 89, 0.4);
    }
    100% {
        transform: scale(1);
        border-color: transparent;
        box-shadow: var(--shadow-md);
    }
}

/* Indicador de partido nuevo */
.match-card.new-match::before {
    content: "🆕 NUEVO";
    position: absolute;
    top: -8px;
    right: 10px;
    background: var(--success-color);
    color: var(--text-light);
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    z-index: 10;
    animation: newMatchBadge 3s ease-out;
}

@keyframes newMatchBadge {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Mejorar animación de actualización de lista */
.matches-list.updating {
    opacity: 0.8;
    transform: scale(0.98);
    transition: all 0.15s ease;
}

.matches-list.updating .match-card {
    animation: none;
}

/* Animación suave para partidos que se agregan */
.match-card {
    animation: fadeInUp 0.5s ease-out;
}

.match-card.new-match {
    animation: newMatchSlideIn 0.6s ease-out;
}

@keyframes newMatchSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-20px) scale(0.95);
    }
    50% {
        opacity: 0.8;
        transform: translateX(-5px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Estilos para actualizaciones granulares */
.score.updated {
    animation: scoreUpdate 1s ease-in-out;
    background-color: #e3f2fd;
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.3s ease;
}

.match-card.updated {
    animation: highlight 2s ease-in-out;
    border-left: 4px solid var(--success-color);
}

@keyframes highlight {
    0% { 
        background-color: #e8f5e8; 
        border-left-color: var(--success-color);
    }
    50% { 
        background-color: #f0f8f0; 
        border-left-color: var(--success-color);
    }
    100% { 
        background-color: transparent; 
        border-left-color: transparent;
    }
}

/* Optimización para evitar reflow */
.match-card {
    contain: layout style paint;
}

.matches-list {
    contain: layout style;
}

/* Indicador de actualización granular */
.granular-update-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background-color: var(--success-color);
    border-radius: 50%;
    opacity: 0;
    animation: granularUpdate 2s ease-in-out;
}

@keyframes granularUpdate {
    0% { 
        opacity: 0; 
        transform: scale(0);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.2);
    }
    100% { 
        opacity: 0; 
        transform: scale(0);
    }
} 





 /* Estilos específicos para polling rápido */
 .polling-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(37, 99, 235, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.polling-indicator.fast {
    background: rgba(34, 197, 94, 0.9);
}

.polling-indicator.slow {
    background: rgba(239, 68, 68, 0.9);
}

.stats-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-size: 12px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    max-width: 300px;
    display: none;
}

.stats-panel.show {
    display: block;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.stats-label {
    color: #9ca3af;
}

.stats-value {
    font-weight: 600;
}

.performance-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.performance-excellent { background: #22c55e; }
.performance-good { background: #eab308; }
.performance-poor { background: #ef4444; }

.footer-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 5px;
}

/* Estilos del componente LiveMatchCard */
.pwa-live-match-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  transition: all 0.2s;
}

.pwa-live-match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.pwa-live-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #ff3b30;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
}

.pwa-live-dot-small {
  width: 6px;
  height: 6px;
  background-color: white;
  border-radius: 50%;
  animation: liveBlink 1.5s ease-in-out infinite;
}

.pwa-match-header {
  margin-bottom: 1rem;
}

.pwa-match-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-match-details {
  font-size: 0.9rem;
  color: #8e8e93;
}

.pwa-match-score {
  margin-bottom: 1rem;
}

.pwa-score-display-tennis {
  background: #1a2330;
  border-radius: 12px;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #2e3a4d;
  padding: 0.5rem 0;
}

.player-row:last-child {
  border-bottom: none;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.player-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  letter-spacing: 1px;
}

.player-sets {
  display: flex;
  gap: 0.7rem;
  margin-left: auto;
  margin-right: 1.5rem;
}

.set-score {
  font-size: 1.3rem;
  color: #00eaff;
  font-weight: bold;
  min-width: 24px;
  text-align: center;
}

.pwa-last-update {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #8e8e93;
  margin-top: 1rem;
}

.pwa-last-update svg {
  width: 14px;
  height: 14px;
  color: #8e8e93;
}

/* Estilos adicionales PWA */
.pwa-matches-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pwa-live-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.pwa-live-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 0.5rem 0;
}

.pwa-live-subtitle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #8e8e93;
  font-weight: 500;
}

.pwa-updating-indicator {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #007aff;
  font-weight: 600;
  animation: fadeInOut 1.5s ease-in-out infinite;
}

.pwa-updating-dot {
  width: 6px;
  height: 6px;
  background-color: #007aff;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}