<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Elementor Widget: Carei Search Form — kompaktowy mini formularz do hero.
 */
class Carei_Search_Widget extends \Elementor\Widget_Base {

    public function get_name() {
        return 'carei-search-form';
    }

    public function get_title() {
        return 'Carei Search Form';
    }

    public function get_icon() {
        return 'eicon-search';
    }

    public function get_categories() {
        return array( 'general' );
    }

    public function get_style_depends() {
        return array( 'carei-reservation-css' );
    }

    public function get_script_depends() {
        return array( 'carei-reservation-js' );
    }

    protected function register_controls() {}

    protected function render() {
        ?>
        <div class="carei-search-form">
            <h2 class="carei-search-form__title">Wypełnij formularz rezerwacji<span>.</span></h2>

            <div class="carei-search-form__fields">
                <!-- Segment -->
                <div class="carei-search-form__field carei-search-form__field--full">
                    <div class="carei-search-form__select-wrap">
                        <select id="carei-search-segment">
                            <option value="" disabled selected>Wybierz segment</option>
                        </select>
                        <svg class="carei-search-form__select-arrow" width="16" height="16" viewBox="0 0 16 16"><path d="M4 6l4 4 4-4" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"/></svg>
                    </div>
                </div>

                <!-- Daty -->
                <div class="carei-search-form__row">
                    <div class="carei-search-form__field">
                        <div class="carei-search-form__date-wrap">
                            <svg class="carei-search-form__date-icon" width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="2.5" y="3" width="11" height="10" rx="0.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/><path d="M11 1.5v2M5 1.5v2M2.5 5.5h11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/></svg>
                            <label class="carei-search-form__date-label" for="carei-search-date-from">Od kiedy?</label>
                            <input type="datetime-local" id="carei-search-date-from" class="carei-search-form__input carei-search-form__input--date">
                        </div>
                    </div>
                    <div class="carei-search-form__field">
                        <div class="carei-search-form__date-wrap">
                            <svg class="carei-search-form__date-icon" width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="2.5" y="3" width="11" height="10" rx="0.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/><path d="M11 1.5v2M5 1.5v2M2.5 5.5h11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/></svg>
                            <label class="carei-search-form__date-label" for="carei-search-date-to">Do kiedy?</label>
                            <input type="datetime-local" id="carei-search-date-to" class="carei-search-form__input carei-search-form__input--date">
                        </div>
                    </div>
                </div>

                <!-- Miejsce odbioru -->
                <div class="carei-search-form__field carei-search-form__field--full">
                    <div class="carei-search-form__select-wrap carei-search-form__select-wrap--icon">
                        <svg class="carei-search-form__pin-icon" width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 1C5.24 1 3 3.24 3 6c0 3.75 5 9 5 9s5-5.25 5-9c0-2.76-2.24-5-5-5zm0 7a2 2 0 110-4 2 2 0 010 4z" fill="currentColor"/></svg>
                        <select id="carei-search-pickup">
                            <option value="" disabled selected>Miejsce odbioru</option>
                        </select>
                        <svg class="carei-search-form__select-arrow" width="16" height="16" viewBox="0 0 16 16"><path d="M4 6l4 4 4-4" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"/></svg>
                    </div>
                </div>

                <!-- Checkbox zwrot -->
                <div class="carei-search-form__field carei-search-form__field--full">
                    <label class="carei-search-form__checkbox-label">
                        <input type="checkbox" id="carei-search-same-return" checked>
                        <span class="carei-search-form__checkbox-box">
                            <svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M2 7l3.5 3.5L12 4" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
                        </span>
                        <span class="carei-search-form__checkbox-text">Zwrot w tej samej lokalizacji</span>
                    </label>
                </div>
            </div>

            <!-- Przycisk -->
            <button type="button" class="carei-search-form__submit" id="carei-search-submit">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>
                Złóż zapytanie o rezerwację
            </button>
        </div>
        <?php
    }
}
