{% extends "company_base.html" %}

{% block title %}Strategie - {{ session.company_name }}{% endblock %}

{% block content %}
<div class="max-w-3xl mx-auto">
    <h1 class="text-2xl font-bold text-white mb-2">Unternehmensstrategie</h1>
    <p class="text-gray-400 mb-8">Diese Strategie wird bei der Erstellung aller LinkedIn-Posts deiner Mitarbeiter berücksichtigt.</p>

    {% if success %}
    <div class="bg-green-900/50 border border-green-500 text-green-200 px-4 py-3 rounded-lg mb-6">
        Strategie erfolgreich gespeichert!
    </div>
    {% endif %}

    {% if error %}
    <div class="bg-red-900/50 border border-red-500 text-red-200 px-4 py-3 rounded-lg mb-6">
        {{ error }}
    </div>
    {% endif %}

    <form method="POST" action="/company/strategy" class="space-y-6">
        <!-- Mission & Vision -->
        <div class="card-bg border rounded-xl p-6">
            <h2 class="text-lg font-semibold text-white mb-4">Mission & Vision</h2>
            <div class="space-y-4">
                <div>
                    <label for="mission" class="block text-sm font-medium text-gray-300 mb-1">Mission</label>
                    <textarea id="mission" name="mission" rows="2"
                              class="w-full input-bg border rounded-lg px-4 py-3 text-white"
                              placeholder="Was ist der Zweck deines Unternehmens?">{{ strategy.mission or '' }}</textarea>
                </div>
                <div>
                    <label for="vision" class="block text-sm font-medium text-gray-300 mb-1">Vision</label>
                    <textarea id="vision" name="vision" rows="2"
                              class="w-full input-bg border rounded-lg px-4 py-3 text-white"
                              placeholder="Wo soll dein Unternehmen in Zukunft stehen?">{{ strategy.vision or '' }}</textarea>
                </div>
            </div>
        </div>

        <!-- Brand Voice -->
        <div class="card-bg border rounded-xl p-6">
            <h2 class="text-lg font-semibold text-white mb-4">Brand Voice</h2>
            <div class="space-y-4">
                <div>
                    <label for="brand_voice" class="block text-sm font-medium text-gray-300 mb-1">Markenstimme</label>
                    <textarea id="brand_voice" name="brand_voice" rows="2"
                              class="w-full input-bg border rounded-lg px-4 py-3 text-white"
                              placeholder="Wie soll deine Marke klingen? (z.B. professionell, freundlich, innovativ)">{{ strategy.brand_voice or '' }}</textarea>
                </div>
                <div>
                    <label for="tone_guidelines" class="block text-sm font-medium text-gray-300 mb-1">Tonalität-Richtlinien</label>
                    <textarea id="tone_guidelines" name="tone_guidelines" rows="3"
                              class="w-full input-bg border rounded-lg px-4 py-3 text-white"
                              placeholder="Spezifische Anweisungen zur Tonalität (z.B. Duzen/Siezen, Fachsprache, etc.)">{{ strategy.tone_guidelines or '' }}</textarea>
                </div>
            </div>
        </div>

        <!-- Target Audience -->
        <div class="card-bg border rounded-xl p-6">
            <h2 class="text-lg font-semibold text-white mb-4">Zielgruppe</h2>
            <div>
                <label for="target_audience" class="block text-sm font-medium text-gray-300 mb-1">Beschreibung der Zielgruppe</label>
                <textarea id="target_audience" name="target_audience" rows="3"
                          class="w-full input-bg border rounded-lg px-4 py-3 text-white"
                          placeholder="Wer ist deine Zielgruppe auf LinkedIn?">{{ strategy.target_audience or '' }}</textarea>
            </div>
        </div>

        <!-- Content Pillars -->
        <div class="card-bg border rounded-xl p-6">
            <h2 class="text-lg font-semibold text-white mb-4">Content-Säulen</h2>
            <p class="text-gray-400 text-sm mb-4">Die Hauptthemen, über die dein Unternehmen postet.</p>
            <div id="content-pillars" class="space-y-2">
                {% for pillar in strategy.content_pillars or [] %}
                <div class="flex gap-2">
                    <input type="text" name="content_pillar" value="{{ pillar }}"
                           class="flex-1 input-bg border rounded-lg px-4 py-2 text-white"
                           placeholder="z.B. Innovation, Nachhaltigkeit, Teamkultur">
                    <button type="button" onclick="this.parentElement.remove()"
                            class="px-3 py-2 text-red-400 hover:text-red-300">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
                        </svg>
                    </button>
                </div>
                {% endfor %}
                {% if not strategy.content_pillars %}
                <div class="flex gap-2">
                    <input type="text" name="content_pillar"
                           class="flex-1 input-bg border rounded-lg px-4 py-2 text-white"
                           placeholder="z.B. Innovation, Nachhaltigkeit, Teamkultur">
                    <button type="button" onclick="this.parentElement.remove()"
                            class="px-3 py-2 text-red-400 hover:text-red-300">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
                        </svg>
                    </button>
                </div>
                {% endif %}
            </div>
            <button type="button" onclick="addPillar()"
                    class="mt-3 text-brand-highlight text-sm hover:underline flex items-center gap-1">
                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
                </svg>
                Weitere Säule hinzufügen
            </button>
        </div>

        <!-- Do's and Don'ts -->
        <div class="grid md:grid-cols-2 gap-6">
            <!-- Do's -->
            <div class="card-bg border rounded-xl p-6">
                <h2 class="text-lg font-semibold text-green-400 mb-4">Do's</h2>
                <div id="dos-list" class="space-y-2">
                    {% for do in strategy.dos or [] %}
                    <div class="flex gap-2">
                        <input type="text" name="do_item" value="{{ do }}"
                               class="flex-1 input-bg border rounded-lg px-4 py-2 text-white text-sm"
                               placeholder="z.B. Erfolge feiern">
                        <button type="button" onclick="this.parentElement.remove()"
                                class="px-2 py-2 text-red-400 hover:text-red-300">
                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
                            </svg>
                        </button>
                    </div>
                    {% endfor %}
                    {% if not strategy.dos %}
                    <div class="flex gap-2">
                        <input type="text" name="do_item"
                               class="flex-1 input-bg border rounded-lg px-4 py-2 text-white text-sm"
                               placeholder="z.B. Erfolge feiern">
                        <button type="button" onclick="this.parentElement.remove()"
                                class="px-2 py-2 text-red-400 hover:text-red-300">
                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
                            </svg>
                        </button>
                    </div>
                    {% endif %}
                </div>
                <button type="button" onclick="addDo()"
                        class="mt-3 text-green-400 text-sm hover:underline flex items-center gap-1">
                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
                    </svg>
                    Hinzufügen
                </button>
            </div>

            <!-- Don'ts -->
            <div class="card-bg border rounded-xl p-6">
                <h2 class="text-lg font-semibold text-red-400 mb-4">Don'ts</h2>
                <div id="donts-list" class="space-y-2">
                    {% for dont in strategy.donts or [] %}
                    <div class="flex gap-2">
                        <input type="text" name="dont_item" value="{{ dont }}"
                               class="flex-1 input-bg border rounded-lg px-4 py-2 text-white text-sm"
                               placeholder="z.B. Konkurrenz kritisieren">
                        <button type="button" onclick="this.parentElement.remove()"
                                class="px-2 py-2 text-red-400 hover:text-red-300">
                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
                            </svg>
                        </button>
                    </div>
                    {% endfor %}
                    {% if not strategy.donts %}
                    <div class="flex gap-2">
                        <input type="text" name="dont_item"
                               class="flex-1 input-bg border rounded-lg px-4 py-2 text-white text-sm"
                               placeholder="z.B. Konkurrenz kritisieren">
                        <button type="button" onclick="this.parentElement.remove()"
                                class="px-2 py-2 text-red-400 hover:text-red-300">
                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
                            </svg>
                        </button>
                    </div>
                    {% endif %}
                </div>
                <button type="button" onclick="addDont()"
                        class="mt-3 text-red-400 text-sm hover:underline flex items-center gap-1">
                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
                    </svg>
                    Hinzufügen
                </button>
            </div>
        </div>

        <!-- Submit Button -->
        <div class="flex justify-end">
            <button type="submit" class="btn-primary font-medium py-3 px-8 rounded-lg transition-colors">
                Strategie speichern
            </button>
        </div>
    </form>
</div>

<script>
function addPillar() {
    const container = document.getElementById('content-pillars');
    const div = document.createElement('div');
    div.className = 'flex gap-2';
    div.innerHTML = `
        <input type="text" name="content_pillar"
               class="flex-1 input-bg border rounded-lg px-4 py-2 text-white"
               placeholder="z.B. Innovation, Nachhaltigkeit, Teamkultur">
        <button type="button" onclick="this.parentElement.remove()"
                class="px-3 py-2 text-red-400 hover:text-red-300">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
            </svg>
        </button>
    `;
    container.appendChild(div);
}

function addDo() {
    const container = document.getElementById('dos-list');
    const div = document.createElement('div');
    div.className = 'flex gap-2';
    div.innerHTML = `
        <input type="text" name="do_item"
               class="flex-1 input-bg border rounded-lg px-4 py-2 text-white text-sm"
               placeholder="z.B. Erfolge feiern">
        <button type="button" onclick="this.parentElement.remove()"
                class="px-2 py-2 text-red-400 hover:text-red-300">
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
            </svg>
        </button>
    `;
    container.appendChild(div);
}

function addDont() {
    const container = document.getElementById('donts-list');
    const div = document.createElement('div');
    div.className = 'flex gap-2';
    div.innerHTML = `
        <input type="text" name="dont_item"
               class="flex-1 input-bg border rounded-lg px-4 py-2 text-white text-sm"
               placeholder="z.B. Konkurrenz kritisieren">
        <button type="button" onclick="this.parentElement.remove()"
                class="px-2 py-2 text-red-400 hover:text-red-300">
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
            </svg>
        </button>
    `;
    container.appendChild(div);
}
</script>
{% endblock %}
