server {
    listen 80;
    root /usr/share/nginx/html;
    index index.html;

    # SPA routing — todas las rutas van a index.html
    location / {
        try_files $uri $uri/ /index.html;
    }

    # Cache agresivo para assets con hash en el nombre
    location /assets/ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }

    # No cachear index.html
    location = /index.html {
        add_header Cache-Control "no-cache, no-store, must-revalidate";
    }

    gzip on;
    gzip_types text/plain text/css application/javascript application/json image/svg+xml;
    gzip_min_length 1000;
}