import { View, Text, StyleSheet, Platform } from 'react-native';
import { colors, spacing } from '../theme';

const isWeb = Platform.OS === 'web';

// La navigation (Recettes, Planning, Compte...) vit désormais dans AppNavBar.tsx
// (rail/barre d'onglets persistante) — ce header ne porte plus que le mot-symbole.
// L'icône produit (ClemIcon) ne s'affiche plus ici ni dans le rail : elle vit
// désormais en tête du tiroir du menu burger (TopMenuBar, AppNavBar.tsx —
// `drawerBrand`), pas sur le bouton ☰ lui-même, demande explicite utilisateur
// (2026-08-21).
export function AppHeader() {
  return (
    <View style={styles.row}>
      <View style={styles.brand}>
        <Text style={styles.wordmark}>
          CLEM <Text style={styles.wordmarkAccent}>AI</Text>
        </Text>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  row: {
    flexDirection: 'row',
    alignItems: 'center',
    paddingHorizontal: spacing.lg,
    paddingVertical: spacing.sm,
    // Même correctif que AppNavBar (railWeb) : sur mobile-web, la fenêtre
    // défile (pas un ScrollView interne), donc ce header disparaît en
    // scrollant sur les pages à contenu long (ex. liste "Idées repas") sans
    // le fixer au viewport.
    ...(isWeb ? ({ position: 'sticky', top: 0, zIndex: 40, backgroundColor: '#fff' } as object) : {}),
  },
  brand: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
  wordmark: { fontSize: 16, fontWeight: '700', color: colors.text },
  wordmarkAccent: { color: colors.primary },
});
