<div class="prismrpg-roll-dialog-modern">
  {{! Header with character info }}
  <div class="dialog-header">
    <div class="character-info">
      <div class="character-name">{{actorName}}</div>
      {{#if rollTarget.weapon}}
        <div class="item-name weapon">
          <i class="fas fa-sword"></i>
          <strong>{{rollTarget.weapon.name}}</strong>
        </div>
      {{/if}}
      {{#if rollTarget.type}}
        {{#if (eq rollTarget.type "spell")}}
          <div class="item-name spell">
            <i class="fas fa-magic"></i>
            <strong>{{rollTarget.name}}</strong>
          </div>
        {{/if}}
      {{/if}}
    </div>
  </div>

  <div class="dialog-content">
    {{! Weapon Options }}
    {{#if rollTarget.weapon}}
      <div class="option-section weapon-section">
        <div class="section-title">
          <i class="fas fa-crosshairs"></i>
          <span>Weapon Options</span>
        </div>

        {{! Display weapon ranges }}
        {{#if (or (gt rollTarget.weapon.system.shortRange 0) (gt rollTarget.weapon.system.longRange 0))}}
          <div class="info-display">
            <i class="fas fa-bullseye"></i>
            <span class="info-text">
              {{#if (gt rollTarget.weapon.system.shortRange 0)}}
                Short: {{rollTarget.weapon.system.shortRange}} ft
              {{/if}}
              {{#if (gt rollTarget.weapon.system.longRange 0)}}
                {{#if (gt rollTarget.weapon.system.shortRange 0)}} • {{/if}}
                Long: {{rollTarget.weapon.system.longRange}} ft
              {{/if}}
            </span>
          </div>
        {{/if}}

        {{! STR or DEX choice }}
        {{#if (or (eq rollType "weapon-attack") (eq rollType "weapon-damage-small") (eq rollType "weapon-damage-medium"))}}
          <div class="option-row">
            <label>Attack with:</label>
            <select name="attackAttribute" class="styled-select">
              <option value="str" {{#if (eq rollTarget.weapon.system.weaponType "melee")}}selected{{/if}}>
                <i class="fas fa-dumbbell"></i> Strength (+{{rollTarget.strMod}})
              </option>
              <option value="dex" {{#if (eq rollTarget.weapon.system.weaponType "ranged")}}selected{{/if}}>
                <i class="fas fa-running"></i> Dexterity (+{{rollTarget.dexMod}})
              </option>
            </select>
          </div>
        {{/if}}

        {{! Ranged weapon checkboxes }}
        {{#if (eq rollTarget.weapon.system.weaponType "ranged")}}
          {{#if (or (eq rollType "weapon-attack") (eq rollType "monster-attack"))}}
            <div class="checkbox-group">
              <label class="checkbox-label">
                <input type="checkbox" name="pointBlank" data-action="selectPointBlank" />
                <span class="checkbox-text">
                  <i class="fas fa-bullseye-arrow"></i>
                  Point Blank Range
                </span>
              </label>
              <label class="checkbox-label">
                <input type="checkbox" name="beyondSkill" data-action="selectBeyondSkill" />
                <span class="checkbox-text">
                  <i class="fas fa-exclamation-triangle"></i>
                  Beyond Skill Range
                </span>
              </label>
              <label class="checkbox-label">
                <input type="checkbox" name="letItFly" data-action="selectLetItFly" />
                <span class="checkbox-text">
                  <i class="fas fa-dice-d20"></i>
                  Let it Fly (Pure D20E)
                </span>
              </label>
            </div>

            <div class="option-row">
              <label>Aiming:</label>
              <select name="attackerAim" class="styled-select">
                {{selectOptions attackerAimChoices selected="simple"}}
              </select>
            </div>
          {{/if}}
        {{/if}}
      </div>
    {{/if}}

    {{! Spell Options }}
    {{#if rollTarget.type}}
      {{#if (eq rollTarget.type "spell")}}
        <div class="option-section spell-section">
          <div class="section-title">
            <i class="fas fa-wand-magic"></i>
            <span>Spell Options</span>
          </div>

          {{! Spell info display }}
          <div class="spell-info-display">
            <div class="info-badge characteristic">
              <i class="fas fa-brain"></i>
              <span>{{rollTarget.mentalCharacteristic}} ({{rollTarget.mentalCharValue}}, +{{rollTarget.value}})</span>
            </div>
            <div class="info-badge mana">
              <i class="fas fa-flask"></i>
              <span>{{rollTarget.system.manaCost}} Mana</span>
            </div>
            <div class="info-badge apc">
              <i class="fas fa-bolt"></i>
              <span>{{rollTarget.system.apc}} APC</span>
            </div>
            {{#if (gt rollTarget.system.manaUpkeep 0)}}
              <div class="info-badge upkeep">
                <i class="fas fa-repeat"></i>
                <span>{{rollTarget.system.manaUpkeep}}/round</span>
              </div>
            {{/if}}
          </div>

          {{! Upcast option }}
          {{#if rollTarget.system.canAscend}}
            <div class="option-row">
              <label>Upcast Level:</label>
              <select name="upcastLevel" class="styled-select">
                <option value="0">Base Level ({{rollTarget.system.level}})</option>
                <option value="1">+1 Level (+1 Mana, +1 APC)</option>
                <option value="2">+2 Levels (+2 Mana, +2 APC)</option>
                <option value="3">+3 Levels (+3 Mana, +3 APC)</option>
                <option value="4">+4 Levels (+4 Mana, +4 APC)</option>
                <option value="5">+5 Levels (+5 Mana, +5 APC)</option>
                <option value="6">+6 Levels (+6 Mana, +6 APC)</option>
                <option value="7">+7 Levels (+7 Mana, +7 APC)</option>
              </select>
            </div>
          {{/if}}
        </div>
      {{/if}}
    {{/if}}

    {{! Skill Options }}
    {{#if (eq rollType "skill")}}
      <div class="option-section skill-section">
        <div class="section-title">
          <i class="fas fa-dice-d20"></i>
          <span>Skill Options</span>
        </div>

        {{! Choose which sub-attribute to use }}
        <div class="option-row">
          <label>Use Sub-Attribute:</label>
          <select name="skillSubAttribute" class="styled-select">
            <option value="{{rollTarget.subAttribute1}}" selected>
              {{rollTarget.subAttribute1Label}} (+{{rollTarget.subAttribute1Value}})
            </option>
            <option value="{{rollTarget.subAttribute2}}">
              {{rollTarget.subAttribute2Label}} (+{{rollTarget.subAttribute2Value}})
            </option>
          </select>
        </div>
      </div>
    {{/if}}

    {{! Advantage/Disadvantage }}
    {{#if hasAdvantage}}
      <div class="option-section">
        <div class="section-title">
          <i class="fas fa-balance-scale"></i>
          <span>{{localize "PRISMRPG.Roll.advantageDisadvantage"}}</span>
        </div>
        <div class="option-row">
          <select name="advantage" class="styled-select advantage-select">
            {{selectOptions choiceAdvantage selected=advantage}}
          </select>
        </div>
      </div>
    {{/if}}

    {{! Modifier }}
    {{#if hasModifier}}
      <div class="option-section">
        <div class="section-title">
          <i class="fas fa-plus-minus"></i>
          <span>{{localize "PRISMRPG.Roll.modifierBonusMalus"}}</span>
        </div>
        <div class="option-row">
          <select name="modifier" class="styled-select modifier-select">
            {{selectOptions choiceModifier selected=modifier}}
          </select>
        </div>
      </div>
    {{/if}}

    {{! Visibility }}
    <div class="option-section">
      <div class="section-title">
        <i class="fas fa-eye"></i>
        <span>{{localize "PRISMRPG.Roll.visibility"}}</span>
      </div>
      <div class="option-row">
        <select name="visibility" class="styled-select">
          {{selectOptions rollModes selected=visibility localize=true}}
        </select>
      </div>
    </div>
  </div>
</div>
