<view class="container">
  <form bindsubmit="onSubmit">
    <view class="form-section">
      <view class="form-item">
        <view class="label">聚会名称</view>
        <input class="input" placeholder="请输入聚会名称" value="{{name}}" bindinput="onNameInput" />
      </view>

      <view class="form-item">
        <view class="label">聚会地点类型</view>
        <view class="keywords-grid">
          <view
            class="keyword-item {{keyword === item ? 'active' : ''}}"
            wx:for="{{keywords}}"
            wx:key="index"
            bindtap="onSelectKeyword"
            data-keyword="{{item}}"
          >
            {{item}}
          </view>
        </view>
      </view>

      <view class="form-item">
        <view class="label">聚会时间（可选）</view>
        <view class="time-picker-row">
          <picker mode="date" value="{{meetDate}}" bindchange="onDateChange" class="picker">
            <view class="picker-value">
              {{meetDate || '选择日期'}}
            </view>
          </picker>
          <picker mode="time" value="{{meetTimeOnly}}" bindchange="onTimeChange" class="picker">
            <view class="picker-value">
              {{meetTimeOnly || '选择时间'}}
            </view>
          </picker>
        </view>
      </view>

      <view class="form-item">
        <view class="label">特殊需求（可选）</view>
        <textarea
          class="textarea"
          placeholder="如：需要停车位、环境安静、有Wi-Fi等"
          value="{{requirements}}"
          bindinput="onRequirementsInput"
          maxlength="200"
          show-confirm-bar="{{false}}"
        />
        <view class="char-count">{{requirements.length}}/200</view>
      </view>

      <view class="form-item">
        <view class="label">你的信息</view>
        <view class="user-info-section">
          <button class="avatar-wrapper" open-type="chooseAvatar" bindchooseavatar="onChooseAvatar">
            <image class="avatar" src="{{userInfo.avatarUrl || '/images/default-avatar.png'}}" mode="aspectFill"></image>
          </button>
          <input type="nickname" class="nickname-input" placeholder="请输入昵称" value="{{userInfo.nickName}}" bindchange="onNicknameChange" />
        </view>
      </view>
    </view>

    <view class="btn-area">
      <button class="submit-btn" form-type="submit">创建聚会</button>
      <button class="cancel-btn" bindtap="onCancel">取消</button>
    </view>
  </form>
</view>
