/* ─────────────────────────────────────────────────────────────────
 * css/action-picker-gated.css
 *
 * C.W2 of the action-picker dispatch (2026-05-23). Styles ONLY
 * the gated extension items (webhook + custom_json) in the
 * action-picker gallery, plus the sub-modal config dialogs.
 *
 * Pairs with: js/builder/action-picker-gated.js
 *
 * Does NOT style the base picker (.ap-item from action-picker.css
 * owned by C.W1). We only add the apg-* suffix layers — same
 * tokens, role-disabled state, sub-modal layout.
 *
 * LABEL: PILOT-READY — visual polish pass deferred to design QA.
 * ───────────────────────────────────────────────────────────────── */

/* ── Gated item in the picker gallery ─────────────────────────── */
.apg-item {
  /* Inherit base .ap-item layout. We only override the disabled
     visual + bolt on a small "lock" badge via ::after. */
  position: relative;
}

.apg-item.apg-disabled,
.apg-item[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  /* Suppress click visual feedback. Don't display:none — honest
     labeling: the user sees the capability + WHY they can't use it. */
  pointer-events: auto;
}

.apg-item.apg-disabled:hover,
.apg-item[disabled]:hover {
  /* Keep tooltip discoverable; don't lift on hover. */
  background: inherit;
  transform: none;
}

.apg-item.apg-disabled::after,
.apg-item[disabled]::after {
  content: "🔒";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 12px;
  line-height: 1;
  opacity: 0.85;
}

/* Icon + label + description vertical stack inside a gated item.
   Falls back to flex-column if the base picker doesn't already
   provide a layout primitive. */
.apg-item .apg-icon {
  font-size: 22px;
  line-height: 1;
  display: block;
  margin-bottom: 6px;
}
.apg-item .apg-label {
  font-weight: 600;
  font-size: 14px;
  display: block;
  margin-bottom: 2px;
}
.apg-item .apg-desc {
  font-size: 12px;
  opacity: 0.75;
  display: block;
}

/* ── Sub-modal container (Webhook + Custom JSON + empty state) ── */
.apg-modal {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 14px;
  max-width: 460px;
  width: 100%;
  box-sizing: border-box;
}

.apg-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.apg-help {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  opacity: 0.8;
}

/* ── Option list (URL picker / handler picker) ─────────────────── */
.apg-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.02);
}

.apg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 44px; /* tap target floor */
  box-sizing: border-box;
  background: #fff;
  border: 1px solid transparent;
}

.apg-row:hover {
  background: #f4f6fa;
}

.apg-row input[type="radio"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.apg-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0; /* allow ellipsis on long URLs */
  flex: 1 1 auto;
}

.apg-row-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.apg-row-sub {
  font-size: 12px;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Method radios (POST/GET) ──────────────────────────────────── */
.apg-method {
  display: flex;
  gap: 16px;
  font-size: 13px;
}
.apg-method label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 44px;
}

/* ── Action buttons (Cancel + Save / Close) ────────────────────── */
.apg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.apg-actions button {
  min-width: 88px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #fff;
}
.apg-actions .apg-save {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
}
.apg-actions .apg-save:disabled {
  background: #b6c4d8;
  border-color: #b6c4d8;
  cursor: not-allowed;
}
.apg-actions .apg-cancel:hover {
  background: #f4f6fa;
}

/* ── Empty-state modal ─────────────────────────────────────────── */
.apg-modal.apg-empty .apg-title {
  color: #9b6f00;
}
.apg-modal.apg-empty .apg-help {
  opacity: 0.95;
}

/* ── Mobile / small viewport ──────────────────────────────────── */
@media (max-width: 480px) {
  .apg-modal {
    padding: 16px 14px 12px;
    gap: 12px;
  }
  .apg-actions {
    flex-direction: column-reverse;
  }
  .apg-actions button {
    width: 100%;
  }
}
