@extends('layouts.public')

@section('title', "Contact - Pirras'Associe")
@section('meta_description', "Contactez Pirras'Associe pour vos projets Chine-Afrique.")
@php($activeNav = 'contact')

@push('styles')
<style>
:root {
            --orange: #f05a1a;
            --orange-2: #ff7a3d;
            --text: #101418;
            --muted: #5f6b76;
            --line: #e7eaee;
            --white: #ffffff;
            --shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
        }

        * { box-sizing: border-box; margin: 0; padding: 0; }
        body { font-family: "DM Sans", sans-serif; color: var(--text); background: var(--white); line-height: 1.6; }
        h1, h2, h3 { font-family: "Syne", sans-serif; line-height: 1.15; }
        a { color: inherit; text-decoration: none; }
        .container { width: min(1160px, 92%); margin: 0 auto; }

        nav {
            position: sticky;
            top: 0;
            z-index: 100;
            background: rgba(255, 255, 255, 0.92);
            backdrop-filter: blur(8px);
            border-bottom: 1px solid var(--line);
        }
        .nav-wrap {
            height: 74px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
        }
        .brand { font-family: "Syne", sans-serif; font-size: 22px; font-weight: 800; }
        .brand span { color: var(--orange); }
        .nav-links {
            display: flex;
            align-items: center;
            gap: 14px;
            font-size: 14px;
            color: #2b3540;
        }
        .nav-links a {
            padding: 7px 10px;
            border-radius: 8px;
            transition: 0.2s ease;
        }
        .nav-links a:hover { background: #f2f4f7; color: var(--orange); }
        .nav-dropdown { position: relative; }
        .nav-dropdown-toggle {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 7px 10px;
            border-radius: 8px;
            transition: 0.2s ease;
            cursor: pointer;
            border: 0;
            background: transparent;
            font: inherit;
            color: inherit;
        }
        .nav-dropdown-toggle::after {
            content: "▾";
            font-size: 10px;
            transform: translateY(1px);
        }
        .nav-dropdown:hover .nav-dropdown-toggle,
        .nav-dropdown.open .nav-dropdown-toggle {
            background: #f2f4f7;
            color: var(--orange);
        }
        .nav-dropdown-menu {
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            min-width: 230px;
            background: #ffffff;
            border: 1px solid var(--line);
            border-radius: 12px;
            box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
            padding: 8px;
            opacity: 0;
            transform: translateY(6px);
            pointer-events: none;
            transition: 0.2s ease;
            z-index: 120;
        }
        .nav-dropdown:hover .nav-dropdown-menu,
        .nav-dropdown.open .nav-dropdown-menu {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }
        .nav-dropdown-menu a {
            display: block;
            padding: 10px 12px;
            border-radius: 8px;
            color: #334155;
        }
        .nav-dropdown-menu a:hover { background: #f7f8fb; color: var(--orange); }

        .hero {
            color: #fff;
            padding: 90px 0 82px;
            background:
                linear-gradient(120deg, rgba(8, 14, 20, 0.8), rgba(8, 14, 20, 0.55)),
                url("https://images.unsplash.com/photo-1565793298595-6a879b1d9492?auto=format&fit=crop&w=1800&q=80") center/cover no-repeat;
        }
        .kicker { color: #ffb088; text-transform: uppercase; letter-spacing: 1.5px; font-size: 12px; font-weight: 700; margin-bottom: 10px; }
        .hero h1 { font-size: clamp(34px, 6vw, 62px); margin-bottom: 14px; max-width: 800px; }
        .hero p { font-size: 18px; color: #f5f7fa; max-width: 700px; }

        section { padding: 72px 0; border-bottom: 1px solid var(--line); }
        .title { font-size: clamp(28px, 3.5vw, 42px); margin-bottom: 12px; }
        .sub { color: var(--muted); margin-bottom: 28px; }

        .contact-grid {
            display: grid;
            grid-template-columns: 1.3fr 1fr;
            gap: 24px;
        }

        .card {
            background: #fff;
            border: 1px solid var(--line);
            border-radius: 16px;
            padding: 24px;
            box-shadow: var(--shadow);
        }

        .label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 7px; }
        .input, .select, .textarea {
            width: 100%;
            border: 1px solid #d8dee6;
            border-radius: 10px;
            padding: 12px 13px;
            font: inherit;
            outline: none;
            transition: border-color 0.2s ease;
        }
        .input:focus, .select:focus, .textarea:focus { border-color: var(--orange); }
        .textarea { min-height: 120px; resize: vertical; }
        .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
        .form-group { margin-bottom: 12px; }

        .need-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
            margin-top: 6px;
        }
        .need-option {
            border: 1px solid #d8dee6;
            border-radius: 10px;
            padding: 10px 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .need-option input { accent-color: var(--orange); }

        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 13px 22px;
            border-radius: 10px;
            font-family: "Syne", sans-serif;
            font-weight: 700;
            border: 0;
            color: #fff;
            background: linear-gradient(135deg, var(--orange), var(--orange-2));
            box-shadow: 0 10px 22px rgba(240, 90, 26, 0.28);
            cursor: pointer;
        }

        .direct-list {
            display: grid;
            gap: 12px;
        }
        .direct-item {
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            transition: 0.2s ease;
        }
        .direct-item:hover { border-color: #ffceb8; background: #fff9f6; }
        .direct-left strong { display: block; font-family: "Syne", sans-serif; }
        .direct-left span { color: var(--muted); font-size: 14px; }
        .direct-cta { color: var(--orange); font-weight: 700; font-size: 14px; }

        footer {
            background: #06090d;
            color: #cbd5e1;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
            padding: 62px 0 28px;
        }
        .footer-grid {
            display: grid;
            grid-template-columns: 1.8fr 1fr 1fr 1fr;
            gap: 34px;
            margin-bottom: 28px;
        }
        .footer-brand .brand {
            display: inline-block;
            color: #fff;
            margin-bottom: 14px;
        }
        .footer-brand p {
            color: #9ca3af;
            max-width: 360px;
            margin-bottom: 20px;
        }
        .footer-flags {
            display: flex;
            gap: 10px;
            color: #d1d5db;
            font-size: 14px;
            letter-spacing: 0.5px;
        }
        .footer-col h4 {
            color: #fff;
            font-size: 17px;
            margin-bottom: 12px;
        }
        .footer-col a {
            display: block;
            color: #9ca3af;
            margin-bottom: 8px;
            transition: color 0.2s ease;
        }
        .footer-col a:hover { color: #fff; }
        .footer-bottom {
            border-top: 1px solid rgba(255, 255, 255, 0.09);
            padding-top: 18px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: #9ca3af;
            font-size: 14px;
            gap: 12px;
        }

        @media (max-width: 1024px) {
            .nav-links { gap: 8px; font-size: 13px; }
            .footer-grid { grid-template-columns: 1fr 1fr; }
        }
        @media (max-width: 900px) {
            .contact-grid { grid-template-columns: 1fr; }
        }
        @media (max-width: 768px) {
            .form-row, .need-grid { grid-template-columns: 1fr; }
            .nav-links { display: none; }
            .footer-grid { grid-template-columns: 1fr; gap: 24px; }
            .footer-bottom { flex-direction: column; text-align: center; }
        }
</style>
@endpush

@section('content')
<section class="hero">
        <div class="container">
            <div class="kicker">{{ $heroKicker ?? 'Contact' }}</div>
            <h1>{{ $heroTitle ?? 'Parlons de votre projet' }}</h1>
            <p>{{ $heroText ?? 'Choisissez votre besoin, partagez vos objectifs, et notre equipe vous recontacte rapidement avec une approche concrete.' }}</p>
        </div>
    </section>

    <section>
        <div class="container contact-grid">
            <div class="card">
                <h2 class="title">Formulaire intelligent</h2>
                <p class="sub">Precisez le type de besoin pour un accompagnement adapte.</p>

                @if(session('contact_ok'))
                    <p style="background:#dcfce7;color:#166534;padding:14px 16px;border-radius:12px;margin-bottom:16px;font-size:15px;">
                        Merci — votre message a bien été envoyé. Nous vous recontactons très bientot.
                    </p>
                @endif

                @if($errors->any())
                    <p style="background:#fee2e2;color:#991b1b;padding:14px 16px;border-radius:12px;margin-bottom:16px;font-size:14px;">
                        {{ $errors->first() }}
                    </p>
                @endif

                <form method="post" action="{{ route('contact.store') }}">
                    @csrf
                    <div class="form-row">
                        <div class="form-group">
                            <label class="label" for="fullName">Nom complet</label>
                            <input id="fullName" class="input" type="text" name="name" value="{{ old('name') }}" required placeholder="Votre nom" autocomplete="name">
                        </div>
                        <div class="form-group">
                            <label class="label" for="email">Email</label>
                            <input id="email" class="input" type="email" name="email" value="{{ old('email') }}" required placeholder="vous@email.com" autocomplete="email">
                        </div>
                    </div>

                    <div class="form-group">
                        <span class="label">Type de besoin</span>
                        <div class="need-grid">
                            <label class="need-option"><input id="needSourcing" type="radio" name="besoin" value="sourcing" required @checked(old('besoin', 'sourcing') === 'sourcing')> Sourcing</label>
                            <label class="need-option"><input id="needLogistique" type="radio" name="besoin" value="logistique" @checked(old('besoin') === 'logistique')> Logistique</label>
                            <label class="need-option"><input id="needVente" type="radio" name="besoin" value="vente" @checked(old('besoin') === 'vente')> Vente</label>
                            <label class="need-option"><input id="needCbt" type="radio" name="besoin" value="cbt" @checked(old('besoin') === 'cbt')> CBT</label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="label" for="message">Votre message</label>
                        <textarea id="message" class="textarea" name="message" required placeholder="Decrivez votre projet...">{{ old('message') }}</textarea>
                    </div>

                    <button type="submit" class="btn">Envoyer ma demande</button>
                </form>
            </div>

            <div class="card">
                <h2 class="title">Contact direct</h2>
                <p class="sub">Choisissez le canal le plus rapide pour echanger avec nous.</p>

                <div class="direct-list">
                    <a class="direct-item" href="{{ $whatsappUrl ?? 'https://wa.me/22500000000?text=Bonjour%2C%20je%20souhaite%20des%20informations.' }}" target="_blank" rel="noopener noreferrer">
                        <div class="direct-left">
                            <strong>WhatsApp</strong>
                            <span>Discussion instantanee</span>
                        </div>
                        <span class="direct-cta">Ecrire →</span>
                    </a>

                    <a class="direct-item" href="mailto:{{ $emailDisplay ?? 'contact@pirras-associe.com' }}">
                        <div class="direct-left">
                            <strong>Email</strong>
                            <span>{{ $emailDisplay ?? 'contact@pirras-associe.com' }}</span>
                        </div>
                        <span class="direct-cta">Envoyer →</span>
                    </a>

                    <a class="direct-item" href="{{ $calendlyUrl ?? 'https://calendly.com' }}" target="_blank" rel="noopener noreferrer">
                        <div class="direct-left">
                            <strong>RDV calendrier</strong>
                            <span>Planifier un rendez-vous</span>
                        </div>
                        <span class="direct-cta">Reserver →</span>
                    </a>
                </div>
            </div>
        </div>
    </section>
@endsection
