/* hooks.css — Hooks management styles (.hk- prefix) */

/* ── Header ── */
.hk-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #222;
}
.hk-header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: #e5e5e5;
}
.hk-btn-back {
  background: none;
  border: none;
  color: #999;
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.hk-btn-back:active { color: #fff; }
.hk-btn-add {
  background: #2563eb;
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hk-btn-add:active { background: #1d4ed8; }

/* ── Tool filter bar ── */
.hk-tool-bar {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid #1a1a1a;
  overflow-x: auto;
}
.hk-tool-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.hk-tool-btn.active {
  background: #1e293b;
  color: #e5e5e5;
  border-color: #475569;
}
.hk-tool-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.hk-tool-badge {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #000;
  border-radius: 4px;
  flex-shrink: 0;
}
.hk-coming-soon {
  font-size: 9px;
  color: #f59e0b;
  background: #2e2a1a;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 2px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ── Tool card badge (inline in hook card) ── */
.hk-tool-card-badge {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #000;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ── Scope bar ── */
.hk-scope-bar {
  display: flex;
  gap: 0;
  padding: 8px 16px;
  border-bottom: 1px solid #1a1a1a;
}
.hk-scope-btn {
  flex: 1;
  padding: 7px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  background: #111;
  border: 1px solid #333;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hk-scope-btn:first-child { border-radius: 6px 0 0 6px; }
.hk-scope-btn:last-child { border-radius: 0 6px 6px 0; }
.hk-scope-btn.active {
  background: #1e293b;
  color: #60a5fa;
  border-color: #2563eb;
}

/* ── Project picker ── */
.hk-project-picker {
  padding: 8px 16px;
  border-bottom: 1px solid #1a1a1a;
  display: none;
}
.hk-project-picker.visible { display: block; }
.hk-project-select {
  width: 100%;
  padding: 8px 10px;
  background: #111;
  color: #e5e5e5;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 13px;
}

/* ── List ── */
.hk-list {
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}
.hk-empty {
  padding: 40px 16px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

/* ── Event group ── */
.hk-event-group {
  margin: 0 12px 8px 12px;
}
.hk-event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  cursor: pointer;
  border-radius: 6px;
  user-select: none;
}
.hk-event-header:active { background: #1a1a1a; }
.hk-event-chevron {
  color: #555;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.hk-event-group.expanded .hk-event-chevron {
  transform: rotate(90deg);
}
.hk-event-name {
  font-size: 13px;
  font-weight: 600;
  color: #a5b4fc;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.hk-event-count {
  font-size: 11px;
  color: #666;
  background: #1a1a1a;
  padding: 1px 7px;
  border-radius: 10px;
}
.hk-event-hooks {
  display: none;
  padding: 4px 0 4px 8px;
}
.hk-event-group.expanded .hk-event-hooks {
  display: block;
}

/* ── Hook card ── */
.hk-card {
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.hk-card.hk-system {
  border-color: #1a2744;
  background: #0c1524;
}
.hk-card-body {
  flex: 1;
  min-width: 0;
}
.hk-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

/* ── Type badge ── */
.hk-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.hk-badge-command { background: #1a2e1a; color: #4ade80; }
.hk-badge-prompt  { background: #2e1a2e; color: #c084fc; }
.hk-badge-agent   { background: #2e2a1a; color: #fbbf24; }

/* ── Matcher tag ── */
.hk-matcher {
  font-size: 11px;
  color: #888;
  background: #1a1a1a;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hk-matcher-all {
  color: #555;
  font-style: italic;
}

/* ── System lock badge ── */
.hk-lock {
  color: #475569;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* ── Async badge ── */
.hk-async-badge {
  font-size: 10px;
  color: #38bdf8;
  background: #0c2d48;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── failOnError badge (Gemini) ── */
.hk-foe-badge {
  font-size: 10px;
  color: #f87171;
  background: #2d1111;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Command/Prompt preview ── */
.hk-preview {
  font-size: 12px;
  color: #999;
  font-family: 'SF Mono', 'Fira Code', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Card actions ── */
.hk-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.hk-btn-icon {
  background: none;
  border: none;
  color: #666;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.hk-btn-icon:active { background: #222; color: #e5e5e5; }
.hk-btn-icon.hk-btn-danger:active { color: #ef4444; }
.hk-btn-icon.hk-btn-dup { color: #777; }
.hk-btn-icon.hk-btn-dup:active { color: #60a5fa; }

/* ── Form ── */
.hk-form {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}
.hk-form-title {
  font-size: 16px;
  font-weight: 600;
  color: #e5e5e5;
  margin-bottom: 16px;
}
.hk-form-group {
  margin-bottom: 14px;
}
.hk-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.hk-form-hint {
  font-size: 11px;
  color: #555;
  margin-top: 4px;
}
.hk-form-select,
.hk-form-input,
.hk-form-textarea {
  width: 100%;
  padding: 10px 12px;
  background: #111;
  color: #e5e5e5;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
.hk-form-textarea {
  min-height: 80px;
  resize: vertical;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
}
.hk-form-input:focus,
.hk-form-select:focus,
.hk-form-textarea:focus {
  outline: none;
  border-color: #2563eb;
}

/* ── Tool selector (form) ── */
.hk-tool-selector {
  display: flex;
  gap: 8px;
}
.hk-tool-sel-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.hk-tool-sel-btn.active {
  background: #1e293b;
  color: #e5e5e5;
  border-color: #60a5fa;
}

/* ── Type selector (radio-like buttons) ── */
.hk-type-selector {
  display: flex;
  gap: 0;
}
.hk-type-btn {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  background: #111;
  border: 1px solid #333;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hk-type-btn:first-child { border-radius: 6px 0 0 6px; }
.hk-type-btn:last-child { border-radius: 0 6px 6px 0; }
.hk-type-btn.active {
  color: #fff;
}
.hk-type-btn.active[data-type="command"] { background: #1a2e1a; border-color: #4ade80; color: #4ade80; }
.hk-type-btn.active[data-type="prompt"]  { background: #2e1a2e; border-color: #c084fc; color: #c084fc; }
.hk-type-btn.active[data-type="agent"]   { background: #2e2a1a; border-color: #fbbf24; color: #fbbf24; }

/* ── Conditional fields ── */
.hk-conditional { display: none; }
.hk-conditional.visible { display: block; }

/* ── Toggle row ── */
.hk-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.hk-toggle-label {
  font-size: 13px;
  color: #ccc;
}
.hk-toggle {
  position: relative;
  width: 44px;
  height: 24px;
}
.hk-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.hk-toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #333;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.hk-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.hk-toggle input:checked + .hk-toggle-slider {
  background: #2563eb;
}
.hk-toggle input:checked + .hk-toggle-slider::before {
  transform: translateX(20px);
}

/* ── Form footer ── */
.hk-form-footer {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #222;
  margin-top: 8px;
}
.hk-btn-save {
  flex: 1;
  padding: 12px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.hk-btn-save:active { background: #1d4ed8; }
.hk-btn-save:disabled { background: #333; color: #666; }
.hk-btn-cancel {
  padding: 12px 20px;
  background: #222;
  color: #ccc;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.hk-btn-cancel:active { background: #333; }

/* ── Error banner ── */
.hk-error {
  background: #2d1111;
  color: #f87171;
  padding: 8px 16px;
  font-size: 13px;
  border-bottom: 1px solid #4a1111;
  display: none;
}
.hk-error.visible { display: block; }

/* ── Codex limitation note ── */
.hk-codex-note {
  font-size: 12px;
  color: #38bdf8;
  background: #0c2d48;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  line-height: 1.4;
  display: none;
}
.hk-codex-note.visible { display: block; }

/* ── Event type support hint ── */
.hk-type-hint {
  font-size: 11px;
  color: #f59e0b;
  margin-top: 4px;
  display: none;
}
.hk-type-hint.visible { display: block; }

/* ── Duplicate scope picker (bottom sheet) ── */
.hk-dup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.hk-dup-sheet {
  background: #1a1a1a;
  border-radius: 14px 14px 0 0;
  width: 100%;
  max-width: 420px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px 0;
  animation: hk-slide-up 0.2s ease-out;
}
@keyframes hk-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.hk-dup-title {
  padding: 14px 20px 10px;
  font-size: 15px;
  font-weight: 600;
  color: #e5e5e5;
}
.hk-dup-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: #ccc;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.1s;
}
.hk-dup-option:active {
  background: #252525;
}
.hk-dup-option svg {
  color: #888;
  flex-shrink: 0;
}
.hk-dup-divider {
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: 1px solid #222;
  margin-top: 4px;
}
.hk-dup-cancel {
  padding: 14px 20px;
  text-align: center;
  color: #ef4444;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-top: 1px solid #222;
  margin-top: 4px;
}
.hk-dup-cancel:active { background: #252525; }

/* ── Duplicate tool picker row ── */
.hk-dup-tool-row {
  display: flex;
  gap: 8px;
  padding: 8px 20px 12px;
}
.hk-dup-tool-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: #888;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.hk-dup-tool-btn.active {
  background: #1e293b;
  color: #e5e5e5;
  border-color: #60a5fa;
}
