import { useTheme } from '@/contexts/ThemeContext';
import Link from 'next/link';

interface SimpleHeaderProps {
  title: string;
  subtitle: string;
  syncing?: boolean;
}

export function SimpleHeader({ title, subtitle, syncing = false }: SimpleHeaderProps) {
  const { theme, toggleTheme } = useTheme();

  return (
    <header className="bg-[var(--card)]/80 backdrop-blur-sm border-b border-[var(--border)]/50 shadow-lg shadow-[var(--card)]/20">
      <div className="container mx-auto px-6 py-4">
        <div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-6">
          {/* Titre tech avec glow */}
          <div className="flex items-center gap-6">
            <div className="flex items-center gap-4">
              <div className={`w-3 h-3 rounded-full shadow-lg ${
                syncing 
                  ? 'bg-yellow-400 animate-spin shadow-yellow-400/50' 
                  : 'bg-cyan-400 animate-pulse shadow-cyan-400/50'
              }`}></div>
              <div>
                <h1 className="text-2xl font-mono font-bold text-[var(--foreground)] tracking-wider">
                  {title}
                </h1>
                <p className="text-[var(--muted-foreground)] mt-1 font-mono text-sm">
                  {subtitle} {syncing && '• Synchronisation...'}
                </p>
              </div>
            </div>

            {/* Navigation */}
            <nav className="hidden sm:flex items-center gap-4">
              <Link
                href="/"
                className="text-[var(--muted-foreground)] hover:text-[var(--primary)] transition-colors font-mono text-sm uppercase tracking-wider"
              >
                Kanban
              </Link>
              <Link
                href="/daily"
                className="text-[var(--muted-foreground)] hover:text-[var(--primary)] transition-colors font-mono text-sm uppercase tracking-wider"
              >
                Daily
              </Link>
              <Link
                href="/tags"
                className="text-[var(--muted-foreground)] hover:text-[var(--accent)] transition-colors font-mono text-sm uppercase tracking-wider"
              >
                Tags
              </Link>
              
              {/* Theme Toggle */}
              <button
                onClick={toggleTheme}
                className="text-[var(--muted-foreground)] hover:text-[var(--primary)] transition-colors p-1 rounded-md hover:bg-[var(--card-hover)]"
                title={`Switch to ${theme === 'dark' ? 'light' : 'dark'} theme`}
              >
                {theme === 'dark' ? (
                  <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
                  </svg>
                ) : (
                  <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
                  </svg>
                )}
              </button>
            </nav>
          </div>
        </div>
      </div>
    </header>
  );
}
