{% extends "base.html" %}

{% block title %}Nowe ogloszenie - Norda Biznes Partner{% endblock %}

{% block extra_css %}
<style>
    .form-container {
        max-width: 700px;
        margin: 0 auto;
    }

    .form-header {
        margin-bottom: var(--spacing-xl);
    }

    .form-header h1 {
        font-size: var(--font-size-3xl);
        color: var(--text-primary);
    }

    .form-card {
        background: var(--surface);
        border-radius: var(--radius-lg);
        padding: var(--spacing-xl);
        box-shadow: var(--shadow);
    }

    .form-group {
        margin-bottom: var(--spacing-lg);
    }

    .form-group label {
        display: block;
        font-weight: 500;
        margin-bottom: var(--spacing-xs);
        color: var(--text-primary);
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: var(--spacing-sm) var(--spacing-md);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        font-size: var(--font-size-base);
        transition: var(--transition);
    }

    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-md);
    }

    .form-hint {
        font-size: var(--font-size-sm);
        color: var(--text-secondary);
        margin-top: var(--spacing-xs);
    }

    .form-actions {
        display: flex;
        gap: var(--spacing-md);
        margin-top: var(--spacing-xl);
    }

    .back-link {
        display: inline-flex;
        align-items: center;
        gap: var(--spacing-xs);
        color: var(--text-secondary);
        text-decoration: none;
        margin-bottom: var(--spacing-lg);
    }

    .back-link:hover {
        color: var(--primary);
    }

    .type-selector {
        display: flex;
        gap: var(--spacing-md);
    }

    .type-option {
        flex: 1;
        position: relative;
    }

    .type-option input {
        position: absolute;
        opacity: 0;
    }

    .type-option label {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: var(--spacing-lg);
        border: 2px solid var(--border);
        border-radius: var(--radius-lg);
        cursor: pointer;
        transition: var(--transition);
    }

    .type-option input:checked + label {
        border-color: var(--primary);
        background: rgba(37, 99, 235, 0.05);
    }

    .type-option label:hover {
        border-color: var(--primary);
    }

    .type-icon {
        font-size: 24px;
        margin-bottom: var(--spacing-sm);
    }

    .info-box {
        background: var(--background);
        border-radius: var(--radius);
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
        font-size: var(--font-size-sm);
        color: var(--text-secondary);
    }
</style>
{% endblock %}

{% block content %}
<div class="form-container">
    <a href="{{ url_for('classifieds.classifieds_index') }}" class="back-link">
        <svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
            <path d="M19 12H5M12 19l-7-7 7-7"/>
        </svg>
        Powrot do tablicy
    </a>

    <div class="form-header">
        <h1>Nowe ogloszenie</h1>
        <p class="text-muted">Dodaj ogloszenie biznesowe dla czlonkow Norda Biznes</p>
    </div>

    <div class="form-card">
        <div class="info-box">
            Ogloszenie bedzie widoczne przez 30 dni. Po tym czasie wygasnie automatycznie.
        </div>

        <form method="POST" action="{{ url_for('classifieds.classifieds_new') }}">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

            <div class="form-group">
                <label>Typ ogloszenia *</label>
                <div class="type-selector">
                    <div class="type-option">
                        <input type="radio" id="type_szukam" name="listing_type" value="szukam" required>
                        <label for="type_szukam">
                            <span class="type-icon">🔍</span>
                            <strong>Szukam</strong>
                            <span style="font-size: var(--font-size-xs); color: var(--text-secondary);">Potrzebuje uslug, produktow</span>
                        </label>
                    </div>
                    <div class="type-option">
                        <input type="radio" id="type_oferuje" name="listing_type" value="oferuje" required>
                        <label for="type_oferuje">
                            <span class="type-icon">✨</span>
                            <strong>Oferuje</strong>
                            <span style="font-size: var(--font-size-xs); color: var(--text-secondary);">Mam do zaoferowania</span>
                        </label>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="category">Kategoria *</label>
                <select id="category" name="category" required>
                    <option value="">Wybierz kategorie...</option>
                    <option value="uslugi">Uslugi profesjonalne</option>
                    <option value="produkty">Produkty, materialy</option>
                    <option value="wspolpraca">Propozycje wspolpracy</option>
                    <option value="praca">Oferty pracy, zlecenia</option>
                    <option value="inne">Inne</option>
                </select>
            </div>

            <div class="form-group">
                <label for="title">Tytul ogloszenia *</label>
                <input type="text" id="title" name="title" required maxlength="255" placeholder="np. Szukam firmy do wykonania strony www">
            </div>

            <div class="form-group">
                <label for="description">Opis *</label>
                <textarea id="description" name="description" rows="6" required placeholder="Opisz szczegolowo czego szukasz lub co oferujesz..."></textarea>
            </div>

            <div class="form-row">
                <div class="form-group">
                    <label for="budget_info">Budzet / Cena</label>
                    <input type="text" id="budget_info" name="budget_info" maxlength="255" placeholder="np. 5000-10000 PLN lub 'do negocjacji'">
                </div>

                <div class="form-group">
                    <label for="location_info">Lokalizacja</label>
                    <input type="text" id="location_info" name="location_info" maxlength="255" placeholder="np. Wejherowo, Cala Polska, Online">
                </div>
            </div>

            <div class="form-actions">
                <button type="submit" class="btn btn-primary">Dodaj ogloszenie</button>
                <a href="{{ url_for('classifieds.classifieds_index') }}" class="btn btn-secondary">Anuluj</a>
            </div>
        </form>
    </div>
</div>
{% endblock %}
