<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

<IfModule mod_headers.c>
  # Security Headers
  Header set X-Content-Type-Options "nosniff"
  Header set X-Frame-Options "SAMEORIGIN"
  Header set X-XSS-Protection "1; mode=block"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
  Header set Permissions-Policy "geolocation=(), microphone=(), camera=()"
  Header set Strict-Transport-Security "max-age=31536000; includeSubDomains" env=HTTPS
  
  # Cache Control
  Header set Cache-Control "public, max-age=3600"
  <FilesMatch "\.(js|css|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|eot)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  <FilesMatch "(index\.html|robots\.txt|sitemap\.xml)$">
    Header set Cache-Control "public, max-age=3600"
  </FilesMatch>
  # Cjenik (NN 101/2026): cjenik.csv, arhiva i popis verzija bez kesa, jer se
  # azuriraju pri svakoj promjeni cijena (do 8:00 na dan primjene)
  <FilesMatch "\.csv$|^index\.json$">
    Header set Cache-Control "no-cache, must-revalidate"
  </FilesMatch>
</IfModule>

# Cjenik (NN 101/2026): tocan MIME tip + UTF-8 da ga Excel i automatizirani alati procitaju
<IfModule mod_mime.c>
  AddType text/csv .csv
  AddCharset UTF-8 .csv
</IfModule>

