export default function GlobalControls({ settings, setSettings, onRun, onSave, onPersist, dirty, running }) {
  return (
    <section className="screener-card">
      <h3>실행 옵션</h3>
      <div className="param-row">
        <label style={{ width: 80, fontSize: 12 }}>Top N</label>
        <input type="number" value={settings.top_n}
               onChange={(e) => setSettings({ ...settings, top_n: parseInt(e.target.value, 10) })}
               min={5} max={100} style={{ width: 80 }} />
      </div>
      <div className="param-row">
        <label style={{ width: 80, fontSize: 12 }}>ATR window</label>
        <input type="number" value={settings.atr_window}
               onChange={(e) => setSettings({ ...settings, atr_window: parseInt(e.target.value, 10) })}
               min={5} max={50} style={{ width: 80 }} />
      </div>
      <div className="param-row">
        <label style={{ width: 80, fontSize: 12 }}>손절 ×ATR</label>
        <input type="number" value={settings.atr_stop_mult} step={0.1}
               onChange={(e) => setSettings({ ...settings, atr_stop_mult: parseFloat(e.target.value) })}
               min={0.5} max={5} style={{ width: 80 }} />
      </div>
      <div className="param-row">
        <label style={{ width: 80, fontSize: 12 }}>R:R 비율</label>
        <input type="number" value={settings.rr_ratio} step={0.1}
               onChange={(e) => setSettings({ ...settings, rr_ratio: parseFloat(e.target.value) })}
               min={1} max={10} style={{ width: 80 }} />
      </div>
      <button onClick={onRun} disabled={running}
              style={{ marginTop: 16, width: '100%', padding: 10, background: '#fbbf24', color: '#0b0f17', border: 'none', borderRadius: 6, fontWeight: 600 }}>
        {running ? '실행 중…' : '지금 실행 (미리보기)'}
      </button>
      <button onClick={onSave} disabled={running}
              style={{ marginTop: 8, width: '100%', padding: 8 }}>
        스냅샷 저장
      </button>
      <button onClick={onPersist} disabled={!dirty}
              style={{ marginTop: 8, width: '100%', padding: 8, opacity: dirty ? 1 : 0.5 }}>
        설정 저장 (디폴트 갱신)
      </button>
    </section>
  );
}
